From 85e1b0754420147fad063cfb03b0ccab7c0d711f Mon Sep 17 00:00:00 2001 From: Calle Wilund Date: Wed, 17 Aug 2016 08:36:02 +0000 Subject: [PATCH] MessagingService: update to c3 compat Note: c3 adds configurable size threshold counting of messages sent, dividing info "large"/"small" partitions (+gossiper). Message bulk queries in v3 mbean reflects this. Scylla does not (yet?) have such a threshold divider, so this is highly incomplete and just delegates to old apis that "sort-of" fit. --- .../cassandra/net/MessagingService.java | 73 ++++++++++++++++++- .../cassandra/net/MessagingServiceMBean.java | 56 +++++++++++++- 2 files changed, 126 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/cassandra/net/MessagingService.java b/src/main/java/org/apache/cassandra/net/MessagingService.java index d8d4b1f..a663030 100644 --- a/src/main/java/org/apache/cassandra/net/MessagingService.java +++ b/src/main/java/org/apache/cassandra/net/MessagingService.java @@ -22,9 +22,12 @@ */ package org.apache.cassandra.net; +import static java.util.Collections.emptyMap; + import java.lang.management.ManagementFactory; -import java.net.*; -import java.util.*; +import java.net.UnknownHostException; +import java.util.HashMap; +import java.util.Map; import java.util.Map.Entry; import javax.json.JsonArray; @@ -125,6 +128,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Pending tasks for Command(Mutations, Read etc) TCP Connections */ + @Override public Map getCommandPendingTasks() { log(" getCommandPendingTasks()"); return c.getMapStringIntegerValue("/messaging_service/messages/pending"); @@ -133,6 +137,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Completed tasks for Command(Mutations, Read etc) TCP Connections */ + @Override public Map getCommandCompletedTasks() { log("getCommandCompletedTasks()"); Map res = c @@ -143,6 +148,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Dropped tasks for Command(Mutations, Read etc) TCP Connections */ + @Override public Map getCommandDroppedTasks() { log(" getCommandDroppedTasks()"); return c.getMapStringLongValue("/messaging_service/messages/dropped"); @@ -151,6 +157,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Pending tasks for Response(GOSSIP & RESPONSE) TCP Connections */ + @Override public Map getResponsePendingTasks() { log(" getResponsePendingTasks()"); return c.getMapStringIntegerValue("/messaging_service/messages/respond_pending"); @@ -159,6 +166,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Completed tasks for Response(GOSSIP & RESPONSE) TCP Connections */ + @Override public Map getResponseCompletedTasks() { log(" getResponseCompletedTasks()"); return c.getMapStringLongValue("/messaging_service/messages/respond_completed"); @@ -167,6 +175,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * dropped message counts for server lifetime */ + @Override public Map getDroppedMessages() { log(" getDroppedMessages()"); Map res = new HashMap(); @@ -181,6 +190,8 @@ public final class MessagingService implements MessagingServiceMBean { /** * dropped message counts since last called */ + @SuppressWarnings("deprecation") + @Override public Map getRecentlyDroppedMessages() { log(" getRecentlyDroppedMessages()"); Map map = new HashMap(); @@ -192,6 +203,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Total number of timeouts happened on this node */ + @Override public long getTotalTimeouts() { log(" getTotalTimeouts()"); Map timeouts = getTimeoutsPerHost(); @@ -205,6 +217,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Number of timeouts per host */ + @Override public Map getTimeoutsPerHost() { log(" getTimeoutsPerHost()"); return c.getMapStringLongValue("/messaging_service/messages/timeout"); @@ -213,6 +226,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Number of timeouts since last check. */ + @Override public long getRecentTotalTimouts() { log(" getRecentTotalTimouts()"); long timeoutCount = getTotalTimeouts(); @@ -224,6 +238,7 @@ public final class MessagingService implements MessagingServiceMBean { /** * Number of timeouts since last check per host. */ + @Override public Map getRecentTimeoutsPerHost() { log(" getRecentTimeoutsPerHost()"); Map timeouts = getTimeoutsPerHost(); @@ -238,9 +253,63 @@ public final class MessagingService implements MessagingServiceMBean { return result; } + @Override public int getVersion(String address) throws UnknownHostException { log(" getVersion(String address) throws UnknownHostException"); return c.getIntValue(""); } + @Override + public Map getLargeMessagePendingTasks() { + // TODO: implement for realsies + return getCommandPendingTasks(); + } + + @Override + public Map getLargeMessageCompletedTasks() { + // TODO: implement for realsies + return getCommandCompletedTasks(); + } + + @Override + public Map getLargeMessageDroppedTasks() { + // TODO: implement for realsies + return getCommandDroppedTasks(); + } + + @Override + public Map getSmallMessagePendingTasks() { + // TODO: implement for realsies + return getResponsePendingTasks(); + } + + @Override + public Map getSmallMessageCompletedTasks() { + // TODO: implement for realsies + return getResponseCompletedTasks(); + } + + @Override + public Map getSmallMessageDroppedTasks() { + // TODO: implement for realsies + return emptyMap(); + } + + @Override + public Map getGossipMessagePendingTasks() { + // TODO: implement for realsies + return emptyMap(); + } + + @Override + public Map getGossipMessageCompletedTasks() { + // TODO: implement for realsies + return emptyMap(); + } + + @Override + public Map getGossipMessageDroppedTasks() { + // TODO: implement for realsies + return emptyMap(); + } } diff --git a/src/main/java/org/apache/cassandra/net/MessagingServiceMBean.java b/src/main/java/org/apache/cassandra/net/MessagingServiceMBean.java index 3fbd5c1..5a508e0 100644 --- a/src/main/java/org/apache/cassandra/net/MessagingServiceMBean.java +++ b/src/main/java/org/apache/cassandra/net/MessagingServiceMBean.java @@ -15,8 +15,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* + * Copyright 2015 Cloudius Systems + * + * Modified by Cloudius Systems + */ + package org.apache.cassandra.net; + + import java.net.UnknownHostException; import java.util.Map; @@ -25,6 +34,51 @@ import java.util.Map; * Command/Response - Pending/Completed Tasks */ public interface MessagingServiceMBean { + /** + * Pending tasks for large message TCP Connections + */ + public Map getLargeMessagePendingTasks(); + + /** + * Completed tasks for large message) TCP Connections + */ + public Map getLargeMessageCompletedTasks(); + + /** + * Dropped tasks for large message TCP Connections + */ + public Map getLargeMessageDroppedTasks(); + + /** + * Pending tasks for small message TCP Connections + */ + public Map getSmallMessagePendingTasks(); + + /** + * Completed tasks for small message TCP Connections + */ + public Map getSmallMessageCompletedTasks(); + + /** + * Dropped tasks for small message TCP Connections + */ + public Map getSmallMessageDroppedTasks(); + + /** + * Pending tasks for gossip message TCP Connections + */ + public Map getGossipMessagePendingTasks(); + + /** + * Completed tasks for gossip message TCP Connections + */ + public Map getGossipMessageCompletedTasks(); + + /** + * Dropped tasks for gossip message TCP Connections + */ + public Map getGossipMessageDroppedTasks(); + /** * Pending tasks for Command(Mutations, Read etc) TCP Connections */ @@ -79,6 +133,6 @@ public interface MessagingServiceMBean { * Number of timeouts since last check per host. */ public Map getRecentTimeoutsPerHost(); - + public int getVersion(String address) throws UnknownHostException; }