The mx4j implementation of queryName does not handle correctly pattern
matching.
This patch identify that a name contains a patern and do the patern
matching as it should have been done by the mx4j MBeanServer.
Fixes#28
Message-Id: <1462447227-8367-1-git-send-email-amnon@scylladb.com>
With the addition of the APIMBeanServer there is no longer a need for
the pulling functionality to be perform for MBean registration.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This register the APIBuilder as the MBeanServerBuilder which will cause
the APIMBeanServer to be used as the MBeanServer.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The APIBuilder is an implementation for the MBeanServerBuilder that is
used to instantiate the APIMBeanServer as the platform MBeanServer.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The APIMBeanServer is serve as a proxy for the MBeanServer.
It intercept calls to the MBeanServer and check for the column family
and stream registeration before they are perform.
Current implementation override queryNames as it's the one that is being
used by nodetool.
Additional methods can be override in the future if needed.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The MX4J introspector does not support *MXBean interfaces name, This
causes a problem with the garbage collector and java related MBeans.
To bypass that limitation the APIMBeanIntrospector inherit from
MBeanIntrospector and override the relevant functionality so MXBean
will be treated like MBean.
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>
Sometimes it is usefull to get a reverse of the map return by the API.
For example instread of ip address to hostid to get the hostid to ip
address.
Though it is possible to reverse a map, there is no need, it's easier to
generate the reverse mapping.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1458405434-8491-2-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>
The 'nodetool scrub' command ends up calling the variant that is not
wired up to the Scylla API which causes the following error to be
printed out to the user:
[penberg@nero scylla-tools-java]$ ./bin/nodetool scrub
error: For input string: ""
-- StackTrace --
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:592)
at java.lang.Integer.parseInt(Integer.java:615)
at com.scylladb.jmx.api.APIClient.getIntValue(APIClient.java:216)
at com.scylladb.jmx.api.APIClient.getIntValue(APIClient.java:220)
at org.apache.cassandra.service.StorageService.scrub(StorageService.java:1291)
Fix the problem by implementing the said scrub() variant.
Message-Id: <1458035736-26349-1-git-send-email-penberg@scylladb.com>
Make the error messages returned by Scylla API server human readable
from 'nodetool'.
For example, if an API URL is missing, print out the following error:
[penberg@nero scylla-tools-java]$ ./bin/nodetool getcompactionthreshold ks test4
nodetool: Scylla API server HTTP GET to URL 'column_family/minimum_compaction/ks:test4' failed: Not found
See 'nodetool help' or 'nodetool help <command>'.
instead of the scary-looking error that we now print:
[penberg@nero scylla-tools-java]$ ./bin/nodetool getcompactionthreshold ks test4
error: Not found
-- StackTrace --
java.lang.RuntimeException: Not found
at com.scylladb.jmx.api.APIClient.getException(APIClient.java:116)
at com.scylladb.jmx.api.APIClient.getRawValue(APIClient.java:160)
at com.scylladb.jmx.api.APIClient.getRawValue(APIClient.java:174)
at com.scylladb.jmx.api.APIClient.getIntValue(APIClient.java:216)
at com.scylladb.jmx.api.APIClient.getIntValue(APIClient.java:220)
at org.apache.cassandra.db.ColumnFamilyStore.getMinimumCompactionThreshold(ColumnFamilyStore.java:475)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[snip]
Message-Id: <1458032300-17704-1-git-send-email-penberg@scylladb.com>
Running 'nodetool status' now reports the following if the JMX proxy is
not able to connect to an API server:
nodetool: Unable to connect to Scylla API server: java.net.ConnectException: Connection refused
See 'nodetool help' or 'nodetool help <command>'.
instead of the scary-looking:
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:393)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:185)
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:214)
That happens because the MBean propagates a
'javax.ws.rs.ProcessingException' to nodetool which does not have it in
it's classpath and loading via RMI fails.
Fixes#25.
Message-Id: <1457697628-31792-1-git-send-email-penberg@scylladb.com>
This patch init the jmx proxy from the RMIServerSocketFactoryImp init
function. This way the jmx can be set to listen on local port only.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The RMIServerSocketFactoryImp is the way origin handle local port
configuration.
When used, the jmx can be set to listen on local traffic only.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This patch adds the streaming session files receiving and sending
information. It is needed for the streaming information.
The constructor now expect the file information, so the
sessionInfoCompositeData was changed to add an empty value for them.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This will allow to creat ProgressInfo object from json object and json
Array it needed to report stream file information.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This patch takes the implementation of getTokenToEndpointMap from Origin
which sorts the map result.
Fixesscylladb/scylla#722
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1456142885-20838-1-git-send-email-amnon@scylladb.com>
Fix the stubbed implementation of forceRepairRangeAsync() which is
used, for example, when the "--start-token"/"--end-token" options are
passed to "nodetool repair".
forceRepairRangeAsync() works similarly to the existing forceRepairAsync()
just sending the additional start/end tokens as two new options to the
REST API. Unlike the parallel Cassandra code, we don't do any fancy
processing on these tokens to intersect them with the node's token ranges -
we'll do this intersection in the C++ code, where the repair is actually
done.
Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <1455808238-25692-1-git-send-email-nyh@scylladb.com>
The dropped messages thread pull information from the API, in various
scenario it can face a connection problem (specifically on startup and
shutdown) or other related exception, when scylla shutds down. It shold
ignore the connection problem, as it is been taken care of by another
thread that check the status and will shutdown when needed.
For other exception, it logs them while continue to connect.
Fixesscylladb/scylla#902
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1455799819-17957-1-git-send-email-amnon@scylladb.com>
StorageService.getTokens should return only the tokens of the current
node, not all the tokens.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1454240935-21903-1-git-send-email-amnon@scylladb.com>
This patch uses the system api to set log level.
After this patch the nodetool setloglevel would support modifying a log
level of a log object.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1453367412-29722-1-git-send-email-amnon@scylladb.com>
This removes a debug print that was left in the code by accident.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1452673361-8242-1-git-send-email-amnon@scylladb.com>
This patch import and modify the StreamingMetrics from orgin. It will
pull periodically the API to check for the current stream and when it
will find any, it will register their MBean.
After this patch during streaming (ie. node is adding to the cluster) it
will be possible to check with jconsole and see the stream.
A nodetool netstats example:
$ nodetool netstats
Mode: NORMAL
Bootstrap 331955a0-aeff-11e5-895c-000000000000
/127.0.0.2
Sending 1 files, 140724545317112 bytes total. Already sent 0
files, 0 bytes total
Read Repair Statistics:
Attempted: 6
Mismatch (Blocking): 0
Mismatch (Background): 0
Pool Name Active Pending Completed
Commands n/a 0 85
Responses n/a 0 46
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The API of the session info returns parameters in snake case instead of
camel case.
This patch chagne the expected field to match the API. It was also
modified to accept empty fields and store them as null.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The API was modify to return the load map as a map of string to double
instead of formatted string.
This patch change the code to support the udpated API.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This patch adds a method to the APIClient that return a map of String
and Double.
It support both simple and with query parameters.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This patch clean the redundant output the jmx proxy creates.
It set the trace level of the called method to finest and remove some
println leftovers.
Fixes#22
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
The API now uses explicit parameters to pass the parameters to repair.
This patch changes how the parameters are passed to the API to be
compatible with the changed API.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Reviewed-by: Nadav Har'El <nyh@scylladb.com>
"nodetool repair" ends up calling one of the dozen forceAsyncRepair()
functions. This function ignored its option rather than passing it on,
so this patch fixes that.
Note that there are still many more forceAsyncRepair() overloads which
similarly ignore their options, and it is possible that certain invocation
of "nodetool repair" will need them, so we will need to fix all of them
in the future.
After this patch, "nodetool repair" no longer works because now Scylla
needs to be fixed to understand the "parallelism" and "incremental" options
passed to it.
Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Scylla's repair REST API (see scylla/api/storage_service.cc) takes all
repair options as one "options" string. The options are separated by ",",
and for each option, the name and value are separated by ":". The existing
code wrongly used "=" instead of ":", so this patch fixes it.
Signed-off-by: Nadav Har'El <nyh@scylladb.com>
The describeRingJMX method, returns a formated output. The output should
be similiar to origin as oppose to the current implementation that
returns a json representation.
After the change an example of nodetool describering:
$ nodetool describering keyspace1
Schema Version:1074c31b-1f39-3df2-90ff-7f0b64bb3ea4
TokenRange:
TokenRange(start_token:7485973865401664349,
end_token:-338297331236877217, endpoints:[127.0.0.1],
rpc_endpoints:[127.0.0.1],
endpoint_details:[EndpointDetails(host:127.0.0.1,
datacenter:datacenter1, rack:rack1)])
TokenRange(start_token:-338297331236877217,
end_token:7485973865401664349, endpoints:[127.0.0.2],
rpc_endpoints:[127.0.0.2],
endpoint_details:[EndpointDetails(host:127.0.0.2,
datacenter:datacenter1, rack:rack1)])
On sycall-jmx:
Fixes#21
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
repairAsync() builds an "options" argument from the options map it gets,
but then forgot to pass this argument to the request :-)
This is part of issue scylladb/#714.
Signed-off-by: Nadav Har'El <nyh@scylladb.com>
The API uses the source_dc as a query parameter, the jmx should use the
same.
In addition, the rebuild method can get null as a datacenter value and
in that case it should not pass a parameter.
Fixesscylladb/scylla#668.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This changes the CompactionManager getCompactionHistory to use the new
get_compaction_history API.
It uses the CompactionHistoryTabularData to parse and report the
results.
After this patch nodetool compactionhistory would work.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This patch import and modify CompactionHistoryTabularData from origin.
It will be used by the getCompactionHistory method in CompactionManager.
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
There was a confusion in the API between key and keyspace.
It was changed in the API so the JMX should be modified accordingly.
After this change
nodetool listsnapshots
Will show the current snapshots.
On scylla-jmx:
Fixes#15
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Similiar to origin, the load map should return a formated load value.
After this patch the nodetool status command:
$nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID
Rack
UN 127.0.0.1 394.97 MB 256 ?
292a6c7f-2063-484c-b54d-9015216f1750 rack1
UN 127.0.0.2 151.07 MB 256 ?
102b6ecd-2081-4073-8172-bf818c35e27b rack1
Under scylla-jmx
Fixes#18
Signed-off-by: Amnon Heiman <amnon@scylladb.com>