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.
This commit is contained in:
Calle Wilund 2016-08-17 08:36:02 +00:00
parent f4759f05e7
commit 85e1b07544
2 changed files with 126 additions and 3 deletions

View File

@ -22,9 +22,12 @@
*/ */
package org.apache.cassandra.net; package org.apache.cassandra.net;
import static java.util.Collections.emptyMap;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.net.*; import java.net.UnknownHostException;
import java.util.*; import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import javax.json.JsonArray; import javax.json.JsonArray;
@ -125,6 +128,7 @@ public final class MessagingService implements MessagingServiceMBean {
/** /**
* Pending tasks for Command(Mutations, Read etc) TCP Connections * Pending tasks for Command(Mutations, Read etc) TCP Connections
*/ */
@Override
public Map<String, Integer> getCommandPendingTasks() { public Map<String, Integer> getCommandPendingTasks() {
log(" getCommandPendingTasks()"); log(" getCommandPendingTasks()");
return c.getMapStringIntegerValue("/messaging_service/messages/pending"); 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 * Completed tasks for Command(Mutations, Read etc) TCP Connections
*/ */
@Override
public Map<String, Long> getCommandCompletedTasks() { public Map<String, Long> getCommandCompletedTasks() {
log("getCommandCompletedTasks()"); log("getCommandCompletedTasks()");
Map<String, Long> res = c Map<String, Long> res = c
@ -143,6 +148,7 @@ public final class MessagingService implements MessagingServiceMBean {
/** /**
* Dropped tasks for Command(Mutations, Read etc) TCP Connections * Dropped tasks for Command(Mutations, Read etc) TCP Connections
*/ */
@Override
public Map<String, Long> getCommandDroppedTasks() { public Map<String, Long> getCommandDroppedTasks() {
log(" getCommandDroppedTasks()"); log(" getCommandDroppedTasks()");
return c.getMapStringLongValue("/messaging_service/messages/dropped"); 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 * Pending tasks for Response(GOSSIP & RESPONSE) TCP Connections
*/ */
@Override
public Map<String, Integer> getResponsePendingTasks() { public Map<String, Integer> getResponsePendingTasks() {
log(" getResponsePendingTasks()"); log(" getResponsePendingTasks()");
return c.getMapStringIntegerValue("/messaging_service/messages/respond_pending"); 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 * Completed tasks for Response(GOSSIP & RESPONSE) TCP Connections
*/ */
@Override
public Map<String, Long> getResponseCompletedTasks() { public Map<String, Long> getResponseCompletedTasks() {
log(" getResponseCompletedTasks()"); log(" getResponseCompletedTasks()");
return c.getMapStringLongValue("/messaging_service/messages/respond_completed"); return c.getMapStringLongValue("/messaging_service/messages/respond_completed");
@ -167,6 +175,7 @@ public final class MessagingService implements MessagingServiceMBean {
/** /**
* dropped message counts for server lifetime * dropped message counts for server lifetime
*/ */
@Override
public Map<String, Integer> getDroppedMessages() { public Map<String, Integer> getDroppedMessages() {
log(" getDroppedMessages()"); log(" getDroppedMessages()");
Map<String, Integer> res = new HashMap<String, Integer>(); Map<String, Integer> res = new HashMap<String, Integer>();
@ -181,6 +190,8 @@ public final class MessagingService implements MessagingServiceMBean {
/** /**
* dropped message counts since last called * dropped message counts since last called
*/ */
@SuppressWarnings("deprecation")
@Override
public Map<String, Integer> getRecentlyDroppedMessages() { public Map<String, Integer> getRecentlyDroppedMessages() {
log(" getRecentlyDroppedMessages()"); log(" getRecentlyDroppedMessages()");
Map<String, Integer> map = new HashMap<String, Integer>(); Map<String, Integer> map = new HashMap<String, Integer>();
@ -192,6 +203,7 @@ public final class MessagingService implements MessagingServiceMBean {
/** /**
* Total number of timeouts happened on this node * Total number of timeouts happened on this node
*/ */
@Override
public long getTotalTimeouts() { public long getTotalTimeouts() {
log(" getTotalTimeouts()"); log(" getTotalTimeouts()");
Map<String, Long> timeouts = getTimeoutsPerHost(); Map<String, Long> timeouts = getTimeoutsPerHost();
@ -205,6 +217,7 @@ public final class MessagingService implements MessagingServiceMBean {
/** /**
* Number of timeouts per host * Number of timeouts per host
*/ */
@Override
public Map<String, Long> getTimeoutsPerHost() { public Map<String, Long> getTimeoutsPerHost() {
log(" getTimeoutsPerHost()"); log(" getTimeoutsPerHost()");
return c.getMapStringLongValue("/messaging_service/messages/timeout"); return c.getMapStringLongValue("/messaging_service/messages/timeout");
@ -213,6 +226,7 @@ public final class MessagingService implements MessagingServiceMBean {
/** /**
* Number of timeouts since last check. * Number of timeouts since last check.
*/ */
@Override
public long getRecentTotalTimouts() { public long getRecentTotalTimouts() {
log(" getRecentTotalTimouts()"); log(" getRecentTotalTimouts()");
long timeoutCount = getTotalTimeouts(); long timeoutCount = getTotalTimeouts();
@ -224,6 +238,7 @@ public final class MessagingService implements MessagingServiceMBean {
/** /**
* Number of timeouts since last check per host. * Number of timeouts since last check per host.
*/ */
@Override
public Map<String, Long> getRecentTimeoutsPerHost() { public Map<String, Long> getRecentTimeoutsPerHost() {
log(" getRecentTimeoutsPerHost()"); log(" getRecentTimeoutsPerHost()");
Map<String, Long> timeouts = getTimeoutsPerHost(); Map<String, Long> timeouts = getTimeoutsPerHost();
@ -238,9 +253,63 @@ public final class MessagingService implements MessagingServiceMBean {
return result; return result;
} }
@Override
public int getVersion(String address) throws UnknownHostException { public int getVersion(String address) throws UnknownHostException {
log(" getVersion(String address) throws UnknownHostException"); log(" getVersion(String address) throws UnknownHostException");
return c.getIntValue(""); return c.getIntValue("");
} }
@Override
public Map<String, Integer> getLargeMessagePendingTasks() {
// TODO: implement for realsies
return getCommandPendingTasks();
}
@Override
public Map<String, Long> getLargeMessageCompletedTasks() {
// TODO: implement for realsies
return getCommandCompletedTasks();
}
@Override
public Map<String, Long> getLargeMessageDroppedTasks() {
// TODO: implement for realsies
return getCommandDroppedTasks();
}
@Override
public Map<String, Integer> getSmallMessagePendingTasks() {
// TODO: implement for realsies
return getResponsePendingTasks();
}
@Override
public Map<String, Long> getSmallMessageCompletedTasks() {
// TODO: implement for realsies
return getResponseCompletedTasks();
}
@Override
public Map<String, Long> getSmallMessageDroppedTasks() {
// TODO: implement for realsies
return emptyMap();
}
@Override
public Map<String, Integer> getGossipMessagePendingTasks() {
// TODO: implement for realsies
return emptyMap();
}
@Override
public Map<String, Long> getGossipMessageCompletedTasks() {
// TODO: implement for realsies
return emptyMap();
}
@Override
public Map<String, Long> getGossipMessageDroppedTasks() {
// TODO: implement for realsies
return emptyMap();
}
} }

View File

@ -15,8 +15,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/*
* Copyright 2015 Cloudius Systems
*
* Modified by Cloudius Systems
*/
package org.apache.cassandra.net; package org.apache.cassandra.net;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Map; import java.util.Map;
@ -25,6 +34,51 @@ import java.util.Map;
* Command/Response - Pending/Completed Tasks * Command/Response - Pending/Completed Tasks
*/ */
public interface MessagingServiceMBean { public interface MessagingServiceMBean {
/**
* Pending tasks for large message TCP Connections
*/
public Map<String, Integer> getLargeMessagePendingTasks();
/**
* Completed tasks for large message) TCP Connections
*/
public Map<String, Long> getLargeMessageCompletedTasks();
/**
* Dropped tasks for large message TCP Connections
*/
public Map<String, Long> getLargeMessageDroppedTasks();
/**
* Pending tasks for small message TCP Connections
*/
public Map<String, Integer> getSmallMessagePendingTasks();
/**
* Completed tasks for small message TCP Connections
*/
public Map<String, Long> getSmallMessageCompletedTasks();
/**
* Dropped tasks for small message TCP Connections
*/
public Map<String, Long> getSmallMessageDroppedTasks();
/**
* Pending tasks for gossip message TCP Connections
*/
public Map<String, Integer> getGossipMessagePendingTasks();
/**
* Completed tasks for gossip message TCP Connections
*/
public Map<String, Long> getGossipMessageCompletedTasks();
/**
* Dropped tasks for gossip message TCP Connections
*/
public Map<String, Long> getGossipMessageDroppedTasks();
/** /**
* Pending tasks for Command(Mutations, Read etc) TCP Connections * Pending tasks for Command(Mutations, Read etc) TCP Connections
*/ */