Commit Graph

292 Commits

Author SHA1 Message Date
Amnon Heiman ad49d05780 ClientRequestMetrics: Using the APITimer
The APITimer uses a different endpoint not to break existing API.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-05-17 11:30:55 +03:00
Amnon Heiman 2c07ca2e09 LatencyMetrics: Move to APITimer
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>
2016-05-17 11:26:18 +03:00
Amnon Heiman 801af00ddb APIMetrics, APIMetricsRegistry: Return APIMeter and APITimer
Some of the specific functionality is needed from the APIMeter and
APITimer.

The MetricsRegistry now return the specific objects so they can be used
in their adapted form.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-05-17 11:22:43 +03:00
Amnon Heiman d3b8ef1ae5 APITimer: Non pull based Timer
The yammer Timer object calculate rate based on a timer, which causes
periodic calls to the API.

This replaces the implementation so that a timer would get all its
values from the API.

For object registration the APITimer still inherit from Timer but
override all its functionality.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-05-17 11:12:01 +03:00
Amnon Heiman eca6451832 APIHistogram: Support APITimer
With the move to APITimer, in many occasion a histogram will not update
itself, instead it will be updated by the APITimer.

This breaks the update values functionality so that a histogram that is
included in an APITimer will not try to update it self.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-05-17 11:08:05 +03:00
Amnon Heiman 4d1f8ed7c9 APIMeter: Move out of pull mode
This replaces the APIMeter implementation so it will not pull the API
regularly.

To by complient with the yammer object registration mechanism, it still
inherit from Meter, but all the functionalities are overriden.

Now all the data is taken from the API including the rate statistics.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-05-17 10:03:12 +03:00
Amnon Heiman adf466519f APIClient: Support for non pull APIMeter
APIMeter will be modified not to use pulling and to retrieve the derived
information from the API.

To support that the APIClient was changed so it would be able to cache
json objects and histogram.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-05-17 09:35:42 +03:00
Amnon Heiman a028e59699 CacheEntry: Support caching of jsonobject
This will allow to store json objects in the cache.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-05-17 09:32:50 +03:00
Amnon Heiman 853963f833 APIMBeanServer: overload the queryName implementation
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>
2016-05-05 16:40:20 +03:00
Amnon Heiman 50c8ff548f Main: remove the pulling registration
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>
2016-05-02 15:03:23 +03:00
Amnon Heiman 3e95c89310 RMIServerSocketFactoryImpl: regsiter the APIBuilder
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>
2016-05-02 15:03:23 +03:00
Amnon Heiman 1daa5eb030 Adding the APIBuilder
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>
2016-05-02 15:03:16 +03:00
Amnon Heiman 4e02c52aee Adding the APIMBeanServer
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>
2016-05-02 15:02:08 +03:00
Amnon Heiman 645d04083c APIMBeanIntrospector: Creating an introspector for the MBeanserver
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>
2016-05-02 15:00:57 +03:00
Amnon Heiman 0bfaba0a82 StreamingMetrics: Preparation for removing pull mode
This patch expose the check stream registration as an external static
method.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-05-02 14:55:42 +03:00
Amnon Heiman 5c33a8afa7 ColumnFamilyStore: Preparation for removing the pull mode
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>
2016-05-02 14:55:32 +03:00
Amnon Heiman c63ec3e96b StorageService: Add takeMultipleColumnFamilySnapshot support
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.

Fixes scylladb/scylla#1133

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1461659678-22030-1-git-send-email-amnon@scylladb.com>
2016-04-26 14:28:33 +03:00
Amnon Heiman 5903271c4d EndpointState: log and ignore not supported states
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

Fixes scylladb/scylla#1164.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1460465073-3567-1-git-send-email-amnon@scylladb.com>
2016-04-12 15:53:16 +03:00
Amnon Heiman 94f144e9b3 StorageService: Get the broadcast address from the API
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.

Fixes scylladb/scylla#1027

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1458405434-8491-3-git-send-email-amnon@scylladb.com>
2016-03-22 09:43:13 +02:00
Amnon Heiman a60c3156c6 ApiClient: Add getReverseMapStrValue method
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>
2016-03-22 09:42:57 +02:00
Amnon Heiman 8f90d413a1 ProcessingException was changed to IllegalStateException
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>
2016-03-22 08:55:35 +02:00
Pekka Enberg 2cd5a5f048 StorageService: Fix scrub() variant API wiring
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>
2016-03-16 08:35:30 +02:00
Pekka Enberg c4d8d7087e APIClient: Make API server errors human readable
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>
2016-03-16 08:34:47 +02:00
Pekka Enberg 02e0598506 APIClient: Fix error handling if connection to API server fails
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>
2016-03-14 11:50:29 +02:00
Amnon Heiman f3610f1a02 Main: use the RMIServerSocketFactoryImp jmx init
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>
2016-03-01 19:49:31 +02:00
Amnon Heiman 39a19b144d Import RMIServerSocketFactoryImp from origin
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>
2016-03-01 19:47:55 +02:00
Amnon Heiman 767517f6be SessionInfo: Add receiving_files and sending_files support
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>
2016-02-27 03:34:22 +02:00
Amnon Heiman afd49d7bd4 ProgressInfo: Add creation from json object and json array
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>
2016-02-27 03:28:19 +02:00
Amnon Heiman d589f3a3a3 StorageService: Sort the results of getTokenToEndpointMap
This patch takes the implementation of getTokenToEndpointMap from Origin
which sorts the map result.

Fixes scylladb/scylla#722

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1456142885-20838-1-git-send-email-amnon@scylladb.com>
2016-02-22 14:10:22 +02:00
Nadav Har'El 15ad444c40 scylla-jmx: implement forceRepairRangeAsync
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>
2016-02-21 11:36:31 +02:00
Amnon Heiman ea0c593a75 MessagingService: Ignore exception on the dropped messages thread
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.

Fixes scylladb/scylla#902

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1455799819-17957-1-git-send-email-amnon@scylladb.com>
2016-02-18 14:54:53 +02:00
Amnon Heiman 691f86983b StorageService: getTokens should return the tokens of the current node
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>
2016-02-01 11:01:13 +02:00
Amnon Heiman 3e1a8961a2 StorageService: setLoggingLevel
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>
2016-01-21 12:05:54 +02:00
Pekka Enberg eec251805a CompactionManager: Fix compaction manager API URLs
The URLs had "compaction_manager" twice in them...
2016-01-21 09:22:51 +02:00
Amnon Heiman b6d55f0623 Remove leftover println from StreamingMetrics
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>
2016-01-18 10:50:23 +02:00
Pekka Enberg d0757c4505 CompactionManager: Fix JSON conversion in getCompactions()
This makes 'nodetool compactionstats' work:

  [penberg@nero cassandra]$ ./bin/nodetool compactionstats
  pending tasks: 0
     compaction type    keyspace       table   completed    total   unit   progress
          compaction   keyspace1   standard1      170719   500096   keys     34.14%
          compaction   keyspace1   standard1      174781   441600   keys     39.58%
  Active compaction remaining time :   0h00m00s

Fixes scylladb/scylla#745.
2016-01-05 15:15:49 +02:00
Amnon Heiman 2ccb657fca Main: start the stream metrics pulling
This patch adds a call to main to start the stream metrics pulling.
2015-12-31 12:47:24 +02:00
Amnon Heiman 686207b59a Import the StreamingMetrics from origin
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>
2015-12-31 12:44:34 +02:00
Amnon Heiman cda7448314 StreamSummary: Accept null values
This patch allows the StreamSummary to support missing values that return
from the API.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-31 12:44:34 +02:00
Amnon Heiman 2840880e95 SessionInfoCompositeData: to support null values
This patch allows the SessionInfoCompositeData to accept null values.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-31 12:44:34 +02:00
Amnon Heiman 36c4a7df27 SessionInfo: allow null and modified API
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>
2015-12-31 12:44:34 +02:00
Amnon Heiman ccb474e424 StorageService: Support the update getLoadMap API
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>
2015-12-30 10:50:57 +02:00
Amnon Heiman e0e7dcdb5c APIClient: Add a mapStringDouble method
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>
2015-12-30 10:50:49 +02:00
Amnon Heiman 71c4e892f6 APIClient: Fixing parsing long as int
The APIClient use getInt to return a long value wich can cause number
trancation.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-30 10:07:33 +02:00
Amnon Heiman 2eb9f19236 Clean the jmxproxy output
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>
2015-12-30 09:27:33 +02:00
Amnon Heiman 6c2bb34ca3 StorageService: change repair to the updated API
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>
2015-12-29 17:24:20 +02:00
Nadav Har'El 69c6913668 scylla-jmx: fix the forceRepairAsync() used by "nodetool repair"
"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>
2015-12-29 09:25:11 +02:00
Nadav Har'El f8b4dfed38 scylla-jmx: use ":", not "=", to build options list
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>
2015-12-28 15:55:32 +02:00
Amnon Heiman 4f275cc44b StorageService: format the describering output
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>
2015-12-28 09:56:44 +02:00
Nadav Har'El 9b03fa1074 scylla-jmx: repairAsync: don't ignore options
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>
2015-12-27 19:56:37 +02:00
Amnon Heiman c8b9198f3b FailureDetector: the ip address should have a leading slash
The ip address of the nodes should have a leading forward slash.

Fixes scylladb/scylla#508

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-24 17:21:07 +02:00
Amnon Heiman 75479531e0 StorageService: rename the dc parameter in rebuild
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.

Fixes scylladb/scylla#668.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-18 11:01:47 +02:00
Pekka Enberg 7543882d6c Clean up after unused imports
Remove unused imports that Eclipse complains about.

Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-12-17 09:29:48 +02:00
Pekka Enberg 0f044e2f47 Rename "com.cloudius.urchin" package to "com.scylladb.jmx"
Move the Scylla JMX code under "com.scylladb.jmx" package.

Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-12-17 09:28:17 +02:00
Amnon Heiman 107664dbf1 CompactionManager: Switch to the update compaction history API
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>
2015-12-16 14:52:21 +02:00
Amnon Heiman 8e7c432374 Importing CompactionHistoryTabularData from origin
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>
2015-12-16 14:51:52 +02:00
Amnon Heiman 21696bec1f APIClient: snapshot details should align to the API
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>
2015-12-14 09:06:50 +02:00
Amnon Heiman fb9f3c8961 StorageService: getLoadMap should format the load
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>
2015-12-14 09:05:21 +02:00
Amnon Heiman 67b244b8e4 StorageService: Fix a typo in the get snapshots API
Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-08 10:41:14 +02:00
Amnon Heiman 7f945be732 Main: call the GCInspector register method
Starts the GCInspector

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-07 13:00:07 +02:00
Amnon Heiman 7b9ea44354 Import the GCInspectorMXBean from origin
Although there is little relevant information in the GC inspector, some
application like cassandra-stress looks for it and fails if it cannot be
found.

This patch import the GCInspectorMBean and its implementation.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-07 13:00:07 +02:00
Amnon Heiman ba0ed7cbc7 createColumnFamilyGauge to support double values return from the API
There are cases where the API uses double to return a value that the JMX
expect to be long.

For example in mean column row size. This type difference should not be
a problem and the result should be cast to long or int.

This patch allows the values to be double and cast the result to int or
long.

This fix (scylla-jmx)
Fixes #12

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-03 12:38:35 +02:00
Amnon Heiman 3a69e3d9da ColumnFamilyStore: getSSTableCountPerLevel should return null not empty array
When getSSTableCountPerLevel is called and the system is not using level
compaction the expected return is null and not an empty array.

This fix (scylla-jmx)
Fixes #11

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-03 12:20:30 +02:00
Amnon Heiman e194ca85a4 ColumnFamilyStore: Use the combine API with metrics
The column family store API was changed so it would have a single API to
return the snapshot size.

This changes the JMX to use the same API regardless if it is called from
the ColumnFamilyMetrics or from ColumnFamilyStore.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-02 14:32:47 +02:00
Amnon Heiman 695e23bd4e RecentEstimatedHistogram: Support empty histogram
The RecentEstimatedHistogram updates its value from the API with an
array of recent values.

This array can be empty, in that case the getBuckets method should just
return a zero size array.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-19 11:55:34 +02:00
Amnon Heiman e0dea0c27e EstimatedHistogram: Support empty histogram
When creating an estimated histogram from buckets it is a valid option
to get a zero size array as the buckets array.

In that case the newOffsets method would get a negative value for its
size, which should result in a zero length array of offsets.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-19 11:52:17 +02:00
Amnon Heiman 5362b2045d APIClient: Support Empty histogram
An empty histogram can return a valid response from the API but without
any buckets.
This is a valid scenario and common for counters of features that are
not supported yet.
In those cases, the APIClient should return a zero length array.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-19 11:49:31 +02:00
Amnon Heiman 9f9dc88643 FailureDetector: Change getAllEndpointStates implementation
This patch change getAllEndpointStates implementation. The proxy now
gets from the API a list of objects, it creates the endpoint map from it
and create the result string.

After this patch the nodetool gossipinfo should be formatted like
origin.

After this patch the nodetool gossipinfo return:

./bin/nodetool gossipinfo
127.0.0.2
  generation:1447850743
  heartbeat:78
  RACK:rack1
  DC:datacenter1
  HOST_ID:459137d7-2c7c-4b65-9ef8-f1c93b29dd6b
  RPC_ADDRESS:127.0.0.2
  RELEASE_VERSION:2.1.8
  LOAD:86677
  STATUS:NORMAL,9219539092146142451
  SCHEMA:59adb24e-f3cd-3e02-97f0-5b395827453f
  NET_VERSION:0
127.0.0.1
  generation:1447850742
  heartbeat:75
  RACK:rack1
  DC:datacenter1
  HOST_ID:5216770b-6fc5-4d5b-8c87-33304fd87bc8
  RPC_ADDRESS:127.0.0.1
  RELEASE_VERSION:2.1.8
  LOAD:12655
  STATUS:NORMAL,927478638459366287
  SCHEMA:59adb24e-f3cd-3e02-97f0-5b395827453f
  NET_VERSION:0

Fix #508

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-18 14:48:15 +02:00
Amnon Heiman e01ece2fcd Import ApplicationState, EndpointState and HeartBeatState from origin
This patch import ApplicationState, EndpointState and HeartBeatState
from origin that are used to report the endpoint state map.

The classes where modified to be created by the API objects.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-18 13:58:07 +02:00
Amnon Heiman 1292bd9ba4 MessagingService: Add the depricated getRecentTimeoutsPerHost and
getRecentTotalTimeouts

This patch adds the impelementation for the depricated method
getRecentTimeoutsPerHost and getRecentTotalTimeouts.

The implementatin is based on origin, the recent version of the method,
return the delta from the last call to the method.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-17 11:57:07 +02:00
Amnon Heiman db7aad26f5 MessagingService add dropped and recently dropped messages impl
This patch adds the implementation of the dropped messages and the
recent dropped messages.

The MessagingService holds a timer that periodically load the dropped
messages from the API and distribute the results between the
DroppedMessagesMetrics instances.

This mimic the timer behaviour in origin, only it does one API call for
all Verb.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-17 11:56:03 +02:00
Amnon Heiman 896fd64de9 Import the DroppedMessageMetrics from origin
This patch import the DroppedMessageMetrics from origin, as oppose to
origin, it does not run timers but relay on the Messaging sevice.

This save the timer and API call for each of the Verb.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-16 11:52:29 +02:00
Amnon Heiman 1cb048effe Create and register the APISettableMetrics
This patch adds the ability to create and register the
APISettableMettics.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-16 11:29:21 +02:00
Amnon Heiman ac049129de Adding the APISettableMeter
Sometimes it is required that a meter will not handle its own data, like
the APIMeter does.

This patch break the added functionality of APIMeter into two classes,
APISettableMeter is a Meter with a set value method and APIMeter adds
the functionality that reads from the API.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-16 11:27:31 +02:00
Amnon Heiman b783a0d09a MessagingService: Add dropped and timeout support
This adds the implementation for dropped messages and timeout messages
counters in MessagingService.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-11 09:49:50 +02:00
Pekka Enberg e530c13f87 Merge "Adding deprecated implementation to cache" from Amnon
"This series adds some deprecated methods implemenetation to the CacheService
depnding on its metrics.

It also stub the getDrainProgress in StorageService."
2015-11-11 09:40:04 +02:00
Amnon Heiman fadfb9443c StorageService: Add describering functionality
This patch adds the describering method to StorageService, the
implementation is based on the storage_service API that is define in
storage_service.json

The implementation reflect the changes in the API, that returns an
object vs. the jmx_describe ring.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-11-11 09:14:05 +02:00
Pekka Enberg 81aa2a8279 Merge "JMX proxy to support configuration file" from Amnon
"Scylla's configuration can change the listening address and port of the API,
the jmx proxy need to use this same configuration.

This series adds the ability to add a path to a yaml configuration file and the
jmx proxy would read its configuration from there.  Configuration from system
properties/command line is still supported and the configuration hirarchy is as
follow from highest to lowest:
* command line
* configuration file according to the hirarchy:
  - command line
  - SCYLLA_CONF
  - SCYLLA_HOME
  - relative conf directory
* default values

The configuration definition was moved to a configuraion class that responsible
for getting the information from the command line and the configuration file."
2015-11-11 09:08:08 +02:00
Amnon Heiman 27c0eb8c99 StorageService: move should pass the parameter to the API
When calling the API move method, the proxy should pass the new_token
parameter.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-11-11 08:53:27 +02:00
Amnon Heiman 07b319d827 StorageService: Stub the getDrainProgress
Drain progress is not implemented yet, it is needed by the nodetool
command so it will not fail.

This patches the functionality until the API will be ready, which, in
that time it would be revert.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-10 17:03:50 +02:00
Amnon Heiman 01477809ac CacheService: Add depricated unimplemented methods
This patch follow origin in the implementation of the depricated methods
in CacheService. It propogate the request to the relevant metrics.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-10 16:54:48 +02:00
Amnon Heiman 54d451de88 CacheMetrics: Add recent hit rate
The depricated recent hit rate implementation was add from Origin as it
is still been used by external system.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-10 15:58:51 +02:00
Amnon Heiman 43e07fda0e Use the configuration object
This patch changes the APIClient to read the connection string from the
configuration object.

Main uses the same configuraion API to print it's connecting message and
call the configuration setup.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-08 12:12:27 +02:00
Amnon Heiman 39b50f63c7 Adding a configuration object for the jmx proxy
This patch adds a configuration object to the jmx proxy that support
both the system/command line based properties and it accept a yaml
configuration file. The later options allows the jmx to read scylla
configuration file and connect to it based on this configuration.

The configuration file reader uses a yaml parser that was added to the
pom.xml

If no configuration file is found in the command line, it would look for
SCYLLA_CONF then SCYLLA_HOME then for relative 'conf' directory

Signed-off-by: Amnon Heiman <amnon@scylladb.com>

need merge apiconfig
2015-11-08 12:12:27 +02:00
Avi Kivity 72f6f5dab4 Merge "Enabling nodetool netstats" from Amnon
"This series adds the jmx implementation to enable netstats.
After this series netstats should complete successfuly.
A run example:

$ ./bin/nodetool netstats
Mode: NORMAL
repair 397c91a0-8205-11e5-83e4-000000000001
repair 3977d5ba-8205-11e5-83e4-000000000001
repair 3977d624-8205-11e5-83e4-000000000001
repair 397c8fc8-8205-11e5-83e4-000000000001
.......
......
repair 3977d502-8205-11e5-83e4-000000000001
Read Repair Statistics:
Attempted: 1
Mismatch (Blocking): 0
Mismatch (Background): 0
Pool Name                    Active   Pending      Completed
Commands                        n/a         0          21182
Responses                       n/a         0            597"
2015-11-08 11:48:40 +02:00
Amnon Heiman 9b14550d0a StorageService: register the StreamManagerMBean
This patch adds the registration of StreamManagerMBean to
StorageService, similiar to the way it is done in origin.

After this patch the StreamManager will be available via Jconsole.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-03 11:33:40 +02:00
Amnon Heiman 3cb168bed3 MessagingService: Add tasks statistics
This patch adds the implementation of:
getResponsePendingTasks()
getResponseCompletedTasks()
getDroppedMessages()

The implementation is based on the messaging_service API that defined in
messaging_service.json.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-03 11:33:40 +02:00
Amnon Heiman 20778b2df6 Add StreamManagerMBean with its subclasses
The StreamManager getStreams returns an hirarchy of classes. This patch
import StreamManagerMBean with the class hirarchy and add an
implementation to StreamManager.

The implementation is based on the stream_manager API.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-03 11:28:44 +02:00
Amnon Heiman 1db077618d APIClient: Add getMapStringIntegerValue and getMapStringLongValue
This patch adds two map reader function to the APIClient, one that parse
map<String,Integer> and one for map<String,Long>

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-11-03 11:18:33 +02:00
Amnon Heiman 00694ce40a StorageService: getLoadString should return units
This address issue #512

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-10-29 15:54:29 +02:00
Amnon Heiman 649922fed8 Updating the http client and support API exception
The API returns errors with an HTTP code 400, 404 or 500 depending on
the cause with a json object that contains the failure reason.  The
error message should be populate to the JMX calling client, translated
to the appropriate exception.

This patch adds the ability to detect API failure and throw a runtime
exception with the returned message.

It is up to the calling method what to do with the exception, if it
would do nothing, the calling client would get a RuntimeException,
depends on origin MBean definition, the caller can catch the exception
and throw a specific kind.

Note that any exception that is thrown must be known to the JMX client
or it will not be able to process it.

As a first step, this patch replaces the jersey client to the newer
version under glassfish, which has an easy way of getting a Reply
object, and check its status before returning the results.

The only difference in the method that uses the APIClient is the use of
MultivaluedHashMap.

The following MBean implementation where changed

ColumnFamily
CompactionManager
Gossiper
EndpointSnitchInfo
CacheService
StorageProxy
StorageService

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-10-28 11:25:37 +02:00
Amnon Heiman a707b487f0 StorageService: remove node should use hostid and not token
There is a confusion in origin, the MBean declare token as the parameter
to remove, but the implementation actually uses host id.

This patch modify scylla implementation to pass a host id as the
parameter to remove.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-26 10:31:43 +02:00
Pekka Enberg dc76d2550e Merge "Support deprecated method in StorageProxy" from Amnon
"This series adds latency related depricated methods to the storage
 proxy.

 The implmenetation mimic origin, in which the depricated methods calls
 the counters that replaces them."
2015-10-26 09:15:20 +02:00
Amnon Heiman ae26226339 ClientRequestMetrics: pass the url similiar to LatencyMetrics
In LatencyMetrics the URL is passed without the ending slash, this
patch use the same notation in ClientRequestMetrics.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-25 13:36:10 +02:00
Avi Kivity ee7f5354b1 Avoid non-final variables in anonymous classes
Required by Java 7.
2015-10-25 13:22:05 +02:00
Amnon Heiman 392765fa2e StorageProxy: Add depricated method implementation based on metrics
This follow origin by adding the implementation for the depricated
metrics methods.

Similiar to origin, the implementation calls the implementation in the
metrics.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-22 10:43:29 +03:00
Pekka Enberg b11c108fcf Remove obsolete comments from ColumnFamilyStore 2015-10-21 14:28:17 +03:00
Pekka Enberg 8e0fb98fc4 Merge "Adding estimated histogram support for nodetool cfhistogram" from Amnon
"This series together with the cfhistogram series in scylla adds the
 missing functionality so that nodetoold cfhistogram would work.

 After both series will be apply an execution example is:

 ./bin/nodetool cfhistograms keyspace1 standard1
 keyspace1/standard1 histograms
 Percentile  SSTables     Write Latency      Read Latency    Partition Size        Cell Count
                               (micros)          (micros)           (bytes)
 50%             0.00           6866.00        4866323.00               310                 5
 75%             0.00           8239.00       10090808.00               310                 5
 95%             0.00          20501.00       17436917.00               310                 5
 98%             0.00          35425.00       25109160.00               310                 5
 99%             0.00          51012.00       25109160.00               310                 5
 Min             0.00           2300.00         654950.00               259                 5
 Max             0.00       20924300.00       25109160.00               310                 5"
2015-10-21 14:26:40 +03:00
Amnon Heiman 3667682075 ColumnFamilyStore: add support for estimated latency
This patch uses the estimated latency that was added to the column
family metrics to get the recent and estimated latency.

It follows the same logic as origin does to call the logic in metrics.

The following method implementation will be added:

getMemtableColumnsCount
getRecentSSTablesPerReadHistogram
getSSTablesPerReadHistogram
getLifetimeReadLatencyHistogramMicros
getRecentReadLatencyHistogramMicros
getRecentReadLatencyMicros
getLifetimeWriteLatencyHistogramMicros
getRecentWriteLatencyHistogramMicros
getRecentWriteLatencyMicros
getRangeCount
getTotalRangeLatencyMicros
getLifetimeRangeLatencyHistogramMicros
getRecentRangeLatencyHistogramMicros
getRecentRangeLatencyMicros

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-21 14:22:06 +03:00
Amnon Heiman db3b3cdeee ColumnFamilyMetrics: add estimted per read histogram support
This uses the recent estimated histogram and the API based estimated
histogram to support the sstable per read recent and total estimated
histogram.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-21 14:22:06 +03:00
Amnon Heiman 960aa6f509 LatencyMetrics: Support totalLatencyHistogram and recentLatencyHistogram
This adds the depricated total and recent estimated histogram.
It uses the new RecentEstimatedHistogram for the recent value and the
API based estimated histogram for the total latency.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-21 14:22:06 +03:00
Amnon Heiman 6df716e5f7 Add an EstimateHistogramWrapper
The EstimatedHistogramWrapper is a helper class that holds the API
related data, so that a class that uses an EstimatedHistogram can
replace it with the wrapper and keep most of its code as is.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-21 14:21:53 +03:00
Amnon Heiman a7c30493cd APIClient to support EstimatedHistogram
This patch modify the CacheEntry to support both String and
EstimatedHistogram.

It is possible to add more supported types in the future when needed.

In the APIClient, the cache will now support both String and
EstimatedHistogram in a similiar way.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>

apiclient need to merge to cache
2015-10-21 14:20:48 +03:00
Amnon Heiman 931571c3ed EstimatedHistogram: Add constructor from data
This patch allows to create an EstimatedHistogram from an array of data
value.

It will be used by the APIClient to return EstimatedHistogram

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-21 14:20:04 +03:00
Amnon Heiman a568e52cb5 Adding the RecentEstimatedHistogram
Some of the jmx methods uses the notion of recent estimated histogram.
In origin the implementation uses an estimated histogram and clean the
histogram values on each call.

The RecentEstimatedHistogram mimic this behaviour, it store the latest
values of the last call. In each call new values are stored in the
histogram and the results is the delta between the last two calls.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-21 14:19:57 +03:00
Amnon Heiman 3bf092c83b StorageService: handle loadNewSStable and forceKeyspaceCleanup
keyspace cleanup was changed from GET to POST and load sstable was
missing the keyspace name.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-21 12:27:59 +03:00
Nadav Har'El f05c6709dd Fix "nodetool repair" error
The existing scylla-jmx code had reversed logic for the success of the repair:
it reported to "nodetool repair" a failure when the repair was successful :-)

Note that "nodetool repair" waits until a FINISHED notification, and then reports
a failure if it previously got any SESSION_FAILED notification; So if repair was
successful, all we need to do is to avoid sending a "SESSION_FAILED" message.
But we don't need to send any additional "SESSION_SUCCESS" message to signal
success. That message type is only used to report progress to the user (a
"session" is part of the repair work, so seeing sessions completing shows
progress), but because Scylla doesn't support this progress report yet, we
can't send these notifications yet, and there's no point in sending one such
message at the end - it's only confusing (especially when the text is the same
as that of the FINISHED message).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-10-15 09:50:35 +03:00
Amnon Heiman 6ed255f2e3 EndpointSnitchInfo: Cache results for data center and rack
This cache the get data center and get rack results for 10s, it has a
direct impact on nodetool status and nodetool ring

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-07 10:24:50 +03:00
Amnon Heiman 929d0aedd4 EndpointSnitchInfo formatting 2015-10-07 10:14:49 +03:00
Amnon Heiman c5c0fb41fe APIClient: Adding cache support to the APIClient
Some operations are not changing frequently and are called multiple time
during a nodetool execution.

This patch adds the ability to cache results for a define period of time
(typically it will be for a few seconds) so that during the same
nodetool command call, the results will be retrieved from the cache.

It is currently only implemented for string values, other commands will
be added when needed.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-07 10:13:05 +03:00
Amnon Heiman 38af24d49d Adding CacheEntry to be used by the APIClient cache 2015-10-07 09:43:37 +03:00
Pekka Enberg a90e080ee6 Merge "Complete the nodetool cfstats support" from Amnon
"This series complete the scylla series to support the nodetool cfstatus support.

After this series it will be possible to call nodetoold cfstatus and get a meaningfull output.

An output example:
./bin/nodetool cfstats keyspace1
Keyspace: keyspace1
        Read Count: 87657
        Read Latency: 1.1418900715287998 ms.
        Write Count: 87177
        Write Latency: 0.022303761313190406 ms.
        Pending Flushes: 0
                Table: standard1
                SSTable count: 8
                SSTables in each level: [               Space used (live): 92356832
                Space used (total): 92356832
                Space used by snapshots (total): 0
                Off heap memory used (total): 106430512
                SSTable Compression Ratio: 0.0
                Number of keys (estimate): 328672
                Memtable cell count: 100000
                Memtable data size: 84800254
                Memtable off heap memory used: 105906176
                Memtable switch count: 4
                Local read count: 92854
                Local read latency: 1.039 ms
                Local write count: 93880
                Local write latency: 1.045 ms
                Pending flushes: 0
                Bloom filter false positives: 0
                Bloom filter false ratio: 0.00000
                Bloom filter space used: 208416
                Bloom filter off heap memory used: 524336
                Index summary off heap memory used: 0
                Compression metadata off heap memory used: 0
                Compacted partition minimum bytes: 259
                Compacted partition maximum bytes: 310"
2015-10-06 12:23:09 +03:00
Amnon Heiman a8292e3e09 ColumnFamilyMetrics: add estimated row count histogram
This adds the estimated row count histogram support to
ColumnFamilyMetrics

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 12:54:31 +03:00
Amnon Heiman 54fe3d7ccf ColumnFamilyMetrics: Use schedule for the column family timer
The logic of that timer, should be that after some defined time from the
previous request a new one will be sent, the actuall rate is
meaningless and only cause delyed request to be sent in a higher
frequency after the delayed reponse was returned.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 12:49:51 +03:00
Amnon Heiman f16c49a860 LatencyMetrics: combine the different constructors
This combine the different constructor into one constructor with the
logic and another one that calls it with a default value.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 12:48:26 +03:00
Amnon Heiman 9c7ab3fcf6 APIHistogram: Use the new histogram parameter name
The use of mean and variance as histogram parameter names makes more
sense.

This also make it safe to use an empty histogram that holds no samples.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 12:46:44 +03:00
Amnon Heiman d67e6e60fc EndPointSnitchInfo: Support null as host name
In origin an undocumented feature (bug?) is that passing null as a host
name for getRack and getDatacenter returns the rack or datacenter
according to the loopbck address.

This follow the same behaviour, so when the host is null, the function
will not fail but will call the API with the local loopback address

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-09-29 09:30:08 +03:00
Amnon Heiman 5feb4d3841 Adding depricated implementation to column_family
Some of the depricated method in column family are replaced by counters
in Origin. Still, some tools, like nodetool uses the depricated API.

This adds an implementation to some of the depricated method that is
based on the column family counters similiar to origin.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-09-17 13:43:19 +03:00
Amnon Heiman 713f8a5c75 Shuting down the the proxy after MAX_RETRY
This uses the column family timer to check that the API is still
available.

After MAX_RETRY (currently set to 30s) the proxy will shutdown.
This address issue #2

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-09-17 13:38:01 +03:00
Amnon Heiman 3e326bf2d0 APIClient: Fixing a problem with getString
The javax does not handle parsing JsonValue directly. So it is replaced
for the getString with a direct removal of the quotations.

The alternative is to replace the javax parser with a different one.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-09-14 13:32:15 +03:00
Amnon Heiman cce767e47e APIClient: getString to return parsed json value
getString should return the string value without the sarounding quotes.

For getRaw was introduce that return the API values in its raw value,
and getString was changed to use the json parser to get the string
values without the quotes.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudus-systems.com>
2015-09-11 09:25:37 +03:00
Amnon Heiman fe3b786053 Urchin-JMX: Adding the EndpointSnitchInfo implementation
This adds the call to the API for the EndpointSnitch, the url are based
on the endpoint_snitch_info.json swagger definition file.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudus-systems.com>
2015-09-11 09:25:00 +03:00
Pekka Enberg db6d48a695 Merge "Adding notification for the repair command" from Amnon
"The API is currently not supporting notification, but the repair
 command that perform via the nodetool relays on the notification to know
 when the command terminate.

 This series adds support for the repair notification, based on a timer
 and periodically check if a current repair command was terminated."
2015-08-31 09:41:01 +03:00
Amnon Heiman 67dca4da9d StorageService: Add notification suport for the repair command
This patch adds a notification support for the repair in StorageService.

When a repair command starts a timer is set to check the status of the
repair, when the repair complets it sends notification for the
successful or fail of the repair.

Because jconsole doesn't run method with variable number of parameters
an additional MBean method was added for async repair with only a
keyspace as its parameter.

All the forceAsycRepair methods are mapped to the asyncRepair metod that
replaces them in 2.2, when options will be supported in the repair, it
will be added to the jmx.

After this patch it is possible to register in the jconsole for
notification, perform a forceAsyncRepair and get the notification that
the repair complets
2015-08-27 21:02:28 +03:00
Amnon Heiman e96e62b6bd Add the RepairParallelism enum
This takes the RepairParallelism enum from origin

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-27 20:46:02 +03:00
Amnon Heiman 6fc2c5c720 APIClient add postInt
Sometimes a post command need to return, this adds a method to perform a
post command that returns an int value.

The general postGetVal, can be used for other types if needed.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-27 20:46:02 +03:00
Amnon Heiman 2cfe02acb8 LatencyMetrics: Support path parameter
This change adds path parameter support, for the cases that the path
parameter is the last on the path, for example in the ColumnFamily case

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-24 17:13:34 +03:00
Amnon Heiman 0ae282b548 Add the getEstimatedRowSizeHistogram implementation
The getEstimatedRowSizeHistogram is based on the column_family.json that
defined in the API.

The implementation in the MBean and in the metrics is now works with the
get histogram as long array method in the client.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-24 17:13:34 +03:00
Amnon Heiman bde40aed53 APIClient: Add a getter for estimated histogram buckets
This method returns the estimated histogram buckets. It is based on the
module definied in utils.json in the API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-24 17:13:34 +03:00
Amnon Heiman b53be3a4ec StorageService: Add the effectiveOwnership and getOwnership implementation
This adds the implementation of the effectiveOwnership and getOwnership
in StorageService. It uses the API that defined in storage_service.json.

After this patch the effectiveOwnership and getOwnership will be
available via jconsole.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-24 13:12:33 +03:00
Amnon Heiman 7e7e0ca367 APIClient: Add the getMapInetAddressFloatValue implementation
This adds the implementation to the stubed getMapInetAddressFloatValue,
it gets an array of 'key', 'value' and translate it into a map of key to
float.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-24 13:12:16 +03:00
Amnon Heiman 631a6537d9 Add depricated implemention to the StorageProxy
Some of the depricated function in StorgeProxy uses the Metrics object
to get the information.

This adds an implementation for the following:
getReadOperations
getTotalReadLatencyMicros
getRecentReadLatencyMicros
getTotalReadLatencyHistogramMicros
getRangeOperations
getTotalRangeLatencyMicros
getRecentRangeLatencyMicros
getWriteOperations
getTotalWriteLatencyMicros
getRecentWriteLatencyMicros

It uses the implementation in ClientRequestMetrics without adding new
functionality.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-10 09:00:47 +03:00
Amnon Heiman d1e16178df Moving the MBean to 2.1 (8)
This patch changes the MBeans to 2.1 version, with the changes an empty
stub implementation was added to the implementation so the code can
compile.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-30 12:01:05 +03:00
Amnon Heiman 057a3e27fd Cleaning file formatting
This patch cleans the file formatting of ColumnFamilyStore, CommitLog,
StorageProxy and StorageService.

Those files will be modified when moving to 2.1

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-30 11:37:03 +03:00
Amnon Heiman 6a89f19988 Use APITimer in ColumnFamilyMetrics, CommitLogMetrics and LatencyMetrics
This changes the Timer in ColumnFamilyMetrics, CommitLogMetrics and
LatencyMetrics to be an APITimer.
The APITimer is passed the url to get the data from.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 18:10:53 +03:00
Amnon Heiman 62eec8aaf2 Changing the newTimer in APIMetrics to return APITimer
The newTimer methods in the APIMetrics where modified to pass the url so
an APITimer would be returned from the registry.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 18:10:53 +03:00
Amnon Heiman 9d143efb07 Adding Timer creation to APIMetricsRegistry
This adds a Timer creation methods to the APIMetricsRegistry, the
newTimer method would create an APITimer and would pass it the url for
quering.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 18:10:53 +03:00
Amnon Heiman 479a0769d1 Clean up the APIMetricsRegistry
This is a clean up in the APIMetricsRegistry. It replaces snake case to
camel case, and perform a better formatting of the code.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 18:10:53 +03:00
Amnon Heiman 2d97995229 Adding the APITimer
The Timer object in the yammer library is used to regularly check a
histogram.

The APITimer is a Timer that uses the APIHistogram instead that in it
self calls the API to get its values.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 18:10:53 +03:00
Amnon Heiman e2cdc95b81 APIHistogram: Moving the histogram data collection to the API
This patch replace the Histogram data and statistic calculation from the
JMX proxy to the API.

This way the count, sum, min, max variance and square sum are calculated
always on the server.

When an update is perform, the API would return the statistic with a
sample of the last n elements as a sample.

This implementation insure that the counters are correct. The
implementation also allows to set the minimal update interval.

The implementation adds a mutable getter for each of the parameters so
they could be set to their new value.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 18:10:53 +03:00
Amnon Heiman e02313923b APIClient add a getJsonObj and getHistogram methods
The getJsonObj returns a json object. The getHistogram returns a
HistogramValue object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 18:10:53 +03:00
Amnon Heiman 5e19158c0f Adding the HistogramValue object
The HistogramValue object is used by the APIClient to returns a
histogram object from the API.

It contains the values that are defined in utils.json

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 18:10:53 +03:00
Amnon Heiman 7c8b1a86ca Adding the StorageMetrics
This adds the StorageMetrics, the implementation is based on the API.
The API definition are in storage_service under the metrics part.

After this patch, it will be possible to connect with jconsole and see
the StorageMetrics mbean.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-07 10:28:22 +03:00
Amnon Heiman 68cdf4acf4 Adding the CommitLogMetrics
This Adds the CommitLogMetrics object.
The implementation is based on the API, that define in commitlog.json

After this patch, it will be possible to connect with jconsole and see
the CommitLogMetrics.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-06 14:24:59 +03:00
Avi Kivity 3cef1a6f7a Merge "Adding the column family metrics API" from Amnon
"The column family matrics is a set of data related to the column family.

This series adds an API based on the ColumnFamilyMetrics mbean.
It has a stub implementation, just so the JMX proxy would get a response."
2015-07-05 17:34:48 +03:00
Avi Kivity 16368ca915 Merge "Adding the CacheMetric counters"
"The CacheMetric is used to return statistics on the cache.  This series adds
the definition of the CacheMetric and initilized it in the CacheSerivce.

After this series it will be possible to connect with jconsole and see that
there are 3 mbean available for key, row and counter cache statistics."
2015-07-05 16:47:53 +03:00
Amnon Heiman 81b26d2b53 Adding the CompactionMetrics
The CompactionMetrics is used to report statistics about compaction. It
is based on calling the API that defined in compaction_manager.json

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-02 10:08:00 +03:00
Amnon Heiman 1b36b044fb Instantiating the CompactionManger in Main 2015-07-02 09:23:29 +03:00
Amnon Heiman 84168d40fb Adding the CompactionManagerMBean
This adds the CompactionManagerMBean and its implementation
CompactionManager.

The implementation is based on the API, that is define in
compaction_manager.json

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-02 09:21:30 +03:00
Amnon Heiman ad23e435a1 Enhancing the APIClient
This patch adds the getListMapStrValue that returns a list of maps and a
helper method to create a map from json list, it
also adds a stub method for CQL queries.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-02 09:18:34 +03:00