Commit Graph

262 Commits

Author SHA1 Message Date
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
Pekka Enberg
a38bbfd603 Merge "JMX to listen on local traffic by default" from Amnon
"By default Origin accept local JMX connection. This series import the
 code from origin to set the jmx to listen to local traffic only and
 change the run script so that the default behaviuor would be local only
 traffic."
2016-03-11 14:33:54 +02:00
Amnon Heiman
105a1b5a1b scylla-jmx: Support local only jmx port by default
This patch set the jmx proxy to listen on local traffic by default and
adds a command line switch to allow remote conectivity.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-03-01 19:52:26 +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
Pekka Enberg
00a62ca126 Merge "Adding file information to stream" from Amnon
"This series depends on scylla patch fixing the stream information.

Now that the API report on file information in the stream they need to be
populated to the jmx.

After this patch the nodetool netstats report about file information:

$ nodetool  netstats
Mode: NORMAL
Bootstrap ee150e80-dcef-11e5-bee0-000000000000
    /127.0.0.2
        Sending 1 files, 0 bytes total. Already sent 1 files, 8391192 bytes total
            txnofile 8391192/8391192 bytes(100%) sent to idx:0/127.0.0.2
Read Repair Statistics:
Attempted: 6
Mismatch (Blocking): 0
Mismatch (Background): 0
Pool Name                    Active   Pending      Completed
Commands                        n/a         0          16268
Responses                       n/a         0              2

Fixes scylladb/scylla#948"
2016-02-27 20:26:09 +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
Takuya ASADA
af8ce2d2ea dist: run as scylla on Ubuntu as well
Fixes #873

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <1454607403-28849-1-git-send-email-syuu@scylladb.com>
2016-02-07 10:19:29 +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
Lucas Meneghel Rodrigues
6692f5a3c0 pom.xml: Add log4j classes
After observing logs of scylla-jmx, I started to notice
the following message:

Running '/bin/journalctl --unit scylla-jmx.service'
[stdout] -- Logs begin at Sat 2016-01-23 10:02:51 UTC, end at Sat 2016-01-23 10:07:26 UTC. --
[stdout] Jan 23 10:05:15 ip-172-30-0-9 systemd[1]: Started Scylla JMX.
[stdout] Jan 23 10:05:15 ip-172-30-0-9 systemd[1]: Starting Scylla JMX...
[stdout] Jan 23 10:05:16 ip-172-30-0-9 scylla-jmx[2685]: Using config file: /etc/scylla/scylla.yaml
[stdout] Jan 23 10:05:22 ip-172-30-0-9 scylla-jmx[2685]: Connecting to http://127.0.0.1:10000
[stdout] Jan 23 10:05:22 ip-172-30-0-9 scylla-jmx[2685]: Starting the JMX server
[stdout] Jan 23 10:05:29 ip-172-30-0-9 scylla-jmx[2685]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[stdout] Jan 23 10:05:29 ip-172-30-0-9 scylla-jmx[2685]: SLF4J: Defaulting to no-operation (NOP) logger implementation
[stdout] Jan 23 10:05:29 ip-172-30-0-9 scylla-jmx[2685]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

So we're potentially losing a lot of information on our jmx service logs.
Let's update the log4j dependencies, and add the other ones that are
necessary for the logging to work.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@scylladb.com>
Message-Id: <1453746313-15054-1-git-send-email-lmr@scylladb.com>
2016-01-25 20:32:46 +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
Avi Kivity
358e7387ea version: rename development version to 666.development
Follows scylla-server.
Message-Id: <1452774312-10210-1-git-send-email-avi@scylladb.com>
2016-01-14 14:40:45 +02:00
Avi Kivity
d090136085 Use serial garbage collector
The serial garbage collector has the smallest memory footprint and the
smallest impact on the rest of the system, esp. in large multicores.
Message-Id: <1452433737-4413-1-git-send-email-avi@scylladb.com>
2016-01-11 11:54:46 +02:00
Avi Kivity
24cebcc9a1 dist: do not always restart jmx on shutdown
Restart=always leads to the following loop:

 1. scylla terminates abnormally
 2. scylla-jmx sees that, and terminates
 3. systemd sees that scylla-jmx terminated, and restarts it.
 4. scylla-jmx requires scylla, so systemd starts it.
 5. goto 1.

To prevent the loop, set Restart=on-abnormal; systemd will restart scylla-jmx
if some JVM bug got it killed, but not otherwise.

The downside to this patch is that if scylla-server goes down, so does
scylla-jmx, but if scylla-server is then restarted, scylla-jmx stays down.
To get scylla and scylla-jmx to start together, we need to create
scylla.service that requires both of them.
2016-01-07 09:11:51 +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
Pekka Enberg
10caab8590 Merge "Adding streaming metrics support" from Amnon
"This series will enable straming support and the nodetool netstats command.

After this series:
$ 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            121
Responses                       n/a         0             64

Fixes scylladb/scylla #731"
2015-12-31 13:14:33 +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
Pekka Enberg
cd910aafa9 Merge "Support the changed load_map API" from Amnon
"The storage_service api was changed to return a map of string, double instead
 of formatted numbers.  This change update the JMX proxy to support this API.

 While going over the code a potential bug was found and was fix.

 The series adds method to the APIClient to return a map of string, double and
 uses that function to call the API."
2015-12-30 11:31:46 +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
Pekka Enberg
4dfa0737ac Rename urchin-mbean.jar to scylla-jmx.jar
Urchin is an obsolete working name for Scylla. Rename the Jar file to
scylla-jmx.jar.

Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-12-17 09:27:58 +02:00
Amnon Heiman
c452a9f7ba Limit JVM maximum heap size to 256 MB
This patch limit the JVM maximum heap size to 256MB.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2015-12-17 09:17:20 +02:00
Pekka Enberg
7c34fb8ce0 dist/ubuntu: Remove unneeded startup parameters
Fixes #19.

Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-12-16 17:56:07 +02:00
Pekka Enberg
4c2c4c85f1 Merge "Update the get history to be compatible with the API" from Amnon
"After this series the nodetool compacthistory displays:

$ nodetool compactionhistory
Compaction History:
id                                       keyspace_name      columnfamily_name            compacted_at              bytes_in       bytes_out      rows_merged
09d71860-a3f3-11e5-b1cf-000000000000     system             peers                        1450269994214             365            365
09d73f70-a3f3-11e5-88b4-000000000001     system             local                        1450269994215             816            690"
2015-12-16 15:16:52 +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
Takuya ASADA
c25a844410 dist: remove unneeded parameters
Since scylla-jmx supports to read configuration from scylla.yaml, we
don't need to pass these parameters from program arguments.

Fixes #17.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
2015-12-14 11:29:28 +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