This is a new extention of ObjectName that uses less memory.
TableMetricNameFactory and AllTableMetricNameFactory can
create it instead of regular ObjectName to save memory.
It is possible to save memory because each name created by
TableMetricNameFactory (or AllTableMetricNameFactory) shares
most of its data with other names created by the same factory
and there's no need to create multiple copies.
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
Next patch will introduce new ObjectName implementation that
will use less memory. This new object won't be serializable.
This means it won't be possible to transport it to a remote
caller. We want to keep this new object local to JMX server as well.
This patch makes sure that every ObjectName returned
from APIBeanServer is transformed into a regular ObjectName.
It also makes sure that every ObjectInstance returned from
APIBeanServer has its ObjectName swapped with a regular ObjectName.
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
JmxMBeanServer is a concrete implementation of a MBeanServer.
We want to use it directly because we need to bypass calls to
JmxMBeanServer.registerMBean and JmxMBeanServer.unregisterMBean.
They take ObjectName as parameter, copy it using
ObjectName.getInstance(ObjectName) and pass it to registerMBean
and unregisterMBean of JmxMBeanServer.getMBeanServerInterceptor().
We want to avoid this copy and pass the ObjectName argument directly
to JmxMBeanServer.getMBeanServerInterceptor().
To do that this patch:
1. changes all MBeanServer variables to JmxMBeanServer
2. creates JmxMBeanServer in APIBuilder making sure accessing
interceptors is allowed
3. makes sure that JmxMBeanServer.getMBeanServerInterceptor().registerMBean
is called wherever JmxMBeanServer.registerMBean was called
4. makes sure that JmxMBeanServer.getMBeanServerInterceptor().unregisterMBean
is called whenever JmxMBeanServer.unregisterMBean was called
Next patch will use different ObjectName implementation that will
use less memory and this patch is crucial because without it every ObjectName
is transformed with ObjectName.getInstance which turns the object into
a regular ObjectName.
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
When a node is part of a cluster but is down (like in the situation where
a cluster is taken down and up again but not all nodes are up). There is
no application_state information for that node.
This patch check that the information exists before using it to prevent
null pointer exception.
After this patch, a call to nodetool gossipinfo would return the
available information without failing.
See scylladb/scylla#3330
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <20180329115345.29357-1-amnon@scylladb.com>
Refs scylladb/scylla#2340 (trunk/1.7)
Must proxy "register" call, otherwise unregistration of mbeans
will instead try to double-register. Code for this somehow fell away.
Message-Id: <1494417610-9720-1-git-send-email-calle@scylladb.com>
nodetool from scylla-tools-java still uses it. Currently `nodetool compact` fails like this:
error: forceKeyspaceCompaction(java.lang.String, [Ljava.lang.String;)
-- StackTrace --
java.lang.NoSuchMethodException: forceKeyspaceCompaction(java.lang.String, [Ljava.lang.String;)
Fixesscylladb/scylla#2261
Probably broken by 3e146845b4
Message-Id: <1491470483-6147-1-git-send-email-tgrabiec@scylladb.com>
This patch fixes two issues with the histogram implementation:
* Need to all update before trying to read values from the histogram.
* The histogram values return from the API in microseconds and not nano.
See Scylladb/scylla#2155
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <20170315130725.22261-1-amnon@scylladb.com>
When parsing the snapshot disk sizes, it should be long and not int.
See scylladb/scylla#2104
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1487760019-1354-1-git-send-email-amnon@scylladb.com>
Actually removes a bunch of code to manage the JMX connector,
since as of jdk8u102, the standard jmx connector answers to
property setting bind address -> can restrict access.
Note that the RMI connector will now (as is jdk normal)
_bind_ to 0.0.0.0, but it will not answer non-local requests
if "remote" is not enabled. This is the default jdk behaviour.
In any case, we rely on setting the appropriate properties
instead, and also allow pass-through of -D flags to java,
which in turn means those who wish can turn on both auth
and ssl, set key/trust stores etc etc.
Message-Id: <1485357178-20714-1-git-send-email-calle@scylladb.com>
This patch change the sorting of tokensEndpointMap so it will use the
order returned by the API.
See Scylladb/scylla#1945
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The getMapStrValue return a map from the API. This change the
implementation to use linkedHashMap so the map will be sorted according
to the API order.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
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.
Currently, we have a scary looking dtest failure when attempting to force flush a
Nodetool command '/data/jenkins/workspace/scylla-1.3-dtest/label/monster/mode/release/smp/1/scylla/resources/cassandra/bin/nodetool -h localhost -p 7100 flush' failed; exit status: 2; stderr: Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
error: javax.ws.rs.ProcessingException (no security manager: RMI class loader disabled)
-- StackTrace --
java.lang.ClassNotFoundException: javax.ws.rs.ProcessingException (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:396)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:186)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:219)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:245)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:1020)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:298)
at com.sun.proxy.$Proxy7.forceKeyspaceFlush(Unknown Source)
at org.apache.cassandra.tools.NodeProbe.forceKeyspaceFlush(NodeProbe.java:290)
at org.apache.cassandra.tools.NodeTool$Flush.execute(NodeTool.java:1227)
at org.apache.cassandra.tools.NodeTool$NodeToolCmd.run(NodeTool.java:288)
at org.apache.cassandra.tools.NodeTool.main(NodeTool.java:202)
The problem is rather innocent: the API call fails and we leak
javax.ws.rs.ProcessingException, which is not available in nodetool's
classpath. In fact, we already fixed the problem for GETs in commit
02e0598 ("APIClient: Fix error handling if connection to API server
fails") so do the same thing for POSTs.
Message-Id: <1471589525-26435-1-git-send-email-penberg@scylladb.com>
When removing the pull based timers in the API the sum method in the
APITimer was left stubed by mistake.
This patch take the sum from the histogram as it should be.
Another missed changes are the units, in the yammer library the Timer
does unit conversion before returning the values.
This patch takes the unit conversion from the yammer library to be
compatible.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1464173726-7482-1-git-send-email-amnon@scylladb.com>
With the change to APITimer there is no longer a need to periodically
pull the API.
The verb will be register on the object initialization and will be
updated whenever they are been used.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>