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>
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>
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>
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.
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>
With the change in the meter implementation, retrieving a non existing
metrics would take time.
For this, the CacheService would mark caches that are not supported with
null url, so the metrics will be register but will return 0 for all
request (instead of going to the API that will return 0).
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
CacheMetrics is a general counter that is used for all possible caches.
For caches that we do not support, there is no need to go and fetch
their values.
When moving to the APITimer each such request will take longer (the
value will not be available as it use it) now it will be possible to
supply a null as a url which would cause to the metrics to return 0 for
all counters.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The APITimer uses a different endpoint not to break existing API.
The addNano functionality was removed as all of the values are updated
from the APi.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This expose the ColumnFamilyStore registration via static method.
It would allow an external object (ie. MBeanServer) to update the
registration on demand.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This patch adds the functionality of takeMultipleColumnFamilySnapshot to
StorageService.
It follow origin logic of first check that all keyspaces and column
families exists and has no snapshot with that name and then run snapshot
on each of the combinations.
Two methods where added to simplify the implementation, but that can be
reused. One to get a map from keyspace to column family and one with the
current snapshots.
Fixesscylladb/scylla#1133
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1461659678-22030-1-git-send-email-amnon@scylladb.com>
During upgrade or version inconsistency. The API can return an un
supported state.
Instead of throwing an expcetion the state will be ignore and a warning
will be written to the log.
An example (state where modified in the API)
$ nodetool gossipinfo
/127.0.0.1
generation:1460450456
heartbeat:32
The log shows:
Apr 12, 2016 3:40:20 PM org.apache.cassandra.gms.EndpointState
addApplicationState
WARNING: Unknown application state with id:25
Fixesscylladb/scylla#1164.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1460465073-3567-1-git-send-email-amnon@scylladb.com>
When getting the tokens of the current node, we use the get_token api
call with the local broadcast address.
The current implementation that tries to figure it out from the
configuration is prone to error.
Currently in a configuration where the broadcast address is set to the
local API and the listening API is set to 127.0.0.1 we get a call to
nodetool info will return an exception:
ID : 54185d5d-6f62-4884-814c-5d17c2776de9
Gossip active : true
Thrift active : true
Native Transport active: true
Load : 178.09 KB
Generation No : 1458349593
Uptime (seconds) : 11
Heap Memory (MB) : 47.23 / 247.50
Off Heap Memory (MB) : 2.75
error: Index: 0, Size: 0
-- StackTrace --
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.cassandra.tools.NodeProbe.getEndpoint(NodeProbe.java:812)
at org.apache.cassandra.tools.NodeProbe.getDataCenter(NodeProbe.java:830)
at org.apache.cassandra.tools.NodeTool$Info.execute(NodeTool.java:425)
at org.apache.cassandra.tools.NodeTool$NodeToolCmd.run(NodeTool.java:288)
at org.apache.cassandra.tools.NodeTool.main(NodeTool.java:202)
Becasue getTokens will return an empty list.
This patch changed how broadcast address is deduct. It Adds a reverse
mapping from hostid to ip address and use it with the get local id to
find the ip address in use.
This implementation would probably be replaced by a single API call in
the future.
After the change a call to nodetool info works.
Fixesscylladb/scylla#1027
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1458405434-8491-3-git-send-email-amnon@scylladb.com>
This patch fix the exception handling for connection problem, instead of
ProcessingException it now expect IllegalStateException.
The rest of the functionality remains the same.
Fixes#26
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1458602355-23601-1-git-send-email-amnon@scylladb.com>