diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000..472f47c72a
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "scylla-jmx"]
+ path = scylla-jmx
+ url = git@github.com:scylladb/scylla-jmx.git
+ branch = master
diff --git a/build.xml b/build.xml
index e3964e3aee..324633a959 100644
--- a/build.xml
+++ b/build.xml
@@ -40,6 +40,8 @@
+
+
@@ -166,6 +168,11 @@
+
+
+
+
+
@@ -453,6 +460,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -641,6 +660,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -1054,6 +1085,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -1069,6 +1111,7 @@
+
@@ -1216,6 +1259,7 @@
+
diff --git a/lib/hk2-api-2.4.0-b31.jar b/lib/hk2-api-2.4.0-b31.jar
new file mode 100644
index 0000000000..6a70ef3c18
Binary files /dev/null and b/lib/hk2-api-2.4.0-b31.jar differ
diff --git a/lib/hk2-locator-2.4.0-b31.jar b/lib/hk2-locator-2.4.0-b31.jar
new file mode 100644
index 0000000000..1f38d250d1
Binary files /dev/null and b/lib/hk2-locator-2.4.0-b31.jar differ
diff --git a/lib/hk2-utils-2.4.0-b31.jar b/lib/hk2-utils-2.4.0-b31.jar
new file mode 100644
index 0000000000..211ce37b11
Binary files /dev/null and b/lib/hk2-utils-2.4.0-b31.jar differ
diff --git a/lib/jackson-annotations-2.9.9.jar b/lib/jackson-annotations-2.9.9.jar
new file mode 100644
index 0000000000..8e059d9711
Binary files /dev/null and b/lib/jackson-annotations-2.9.9.jar differ
diff --git a/lib/jackson-core-2.9.9.jar b/lib/jackson-core-2.9.9.jar
new file mode 100644
index 0000000000..02bd446ddf
Binary files /dev/null and b/lib/jackson-core-2.9.9.jar differ
diff --git a/lib/jackson-databind-2.9.9.jar b/lib/jackson-databind-2.9.9.jar
new file mode 100644
index 0000000000..80d4c47a9f
Binary files /dev/null and b/lib/jackson-databind-2.9.9.jar differ
diff --git a/lib/jackson-jaxrs-base-2.9.9.jar b/lib/jackson-jaxrs-base-2.9.9.jar
new file mode 100644
index 0000000000..24c743b498
Binary files /dev/null and b/lib/jackson-jaxrs-base-2.9.9.jar differ
diff --git a/lib/jackson-jaxrs-json-provider-2.9.9.jar b/lib/jackson-jaxrs-json-provider-2.9.9.jar
new file mode 100644
index 0000000000..8bdc2d4b1f
Binary files /dev/null and b/lib/jackson-jaxrs-json-provider-2.9.9.jar differ
diff --git a/lib/jackson-module-jaxb-annotations-2.9.9.jar b/lib/jackson-module-jaxb-annotations-2.9.9.jar
new file mode 100644
index 0000000000..e431a02e7e
Binary files /dev/null and b/lib/jackson-module-jaxb-annotations-2.9.9.jar differ
diff --git a/lib/javax.annotation-api-1.2.jar b/lib/javax.annotation-api-1.2.jar
new file mode 100644
index 0000000000..9ab39ffa4b
Binary files /dev/null and b/lib/javax.annotation-api-1.2.jar differ
diff --git a/lib/javax.inject-2.4.0-b31.jar b/lib/javax.inject-2.4.0-b31.jar
new file mode 100644
index 0000000000..1f60d98a76
Binary files /dev/null and b/lib/javax.inject-2.4.0-b31.jar differ
diff --git a/lib/javax.json-1.0.4.jar b/lib/javax.json-1.0.4.jar
new file mode 100644
index 0000000000..09967d8158
Binary files /dev/null and b/lib/javax.json-1.0.4.jar differ
diff --git a/lib/javax.json-api-1.0.jar b/lib/javax.json-api-1.0.jar
new file mode 100644
index 0000000000..d276c793c7
Binary files /dev/null and b/lib/javax.json-api-1.0.jar differ
diff --git a/lib/javax.ws.rs-api-2.0.1.jar b/lib/javax.ws.rs-api-2.0.1.jar
new file mode 100644
index 0000000000..7eb68b4a0a
Binary files /dev/null and b/lib/javax.ws.rs-api-2.0.1.jar differ
diff --git a/lib/jersey-client-2.22.1.jar b/lib/jersey-client-2.22.1.jar
new file mode 100644
index 0000000000..687843e168
Binary files /dev/null and b/lib/jersey-client-2.22.1.jar differ
diff --git a/lib/jersey-common-2.22.1.jar b/lib/jersey-common-2.22.1.jar
new file mode 100644
index 0000000000..9ee53873df
Binary files /dev/null and b/lib/jersey-common-2.22.1.jar differ
diff --git a/lib/jersey-guava-2.22.1.jar b/lib/jersey-guava-2.22.1.jar
new file mode 100644
index 0000000000..70f3a0761a
Binary files /dev/null and b/lib/jersey-guava-2.22.1.jar differ
diff --git a/lib/jsr305-2.0.2.jar b/lib/jsr305-2.0.2.jar
new file mode 100644
index 0000000000..43807b02f3
Binary files /dev/null and b/lib/jsr305-2.0.2.jar differ
diff --git a/lib/jsr311-api-1.1.1.jar b/lib/jsr311-api-1.1.1.jar
new file mode 100644
index 0000000000..ec8bc81854
Binary files /dev/null and b/lib/jsr311-api-1.1.1.jar differ
diff --git a/lib/scylla-apiclient-1.0.jar b/lib/scylla-apiclient-1.0.jar
new file mode 100644
index 0000000000..4773caebbb
Binary files /dev/null and b/lib/scylla-apiclient-1.0.jar differ
diff --git a/scylla-jmx b/scylla-jmx
new file mode 160000
index 0000000000..04ea3ab7e0
--- /dev/null
+++ b/scylla-jmx
@@ -0,0 +1 @@
+Subproject commit 04ea3ab7e02dbbb37eeb696f55ca4c5fe2a1ee5b
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionHistoryTabularData.java b/src/java/org/apache/cassandra/db/compaction/CompactionHistoryTabularData.java
index 485f1a0908..96f9d03ca7 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionHistoryTabularData.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionHistoryTabularData.java
@@ -17,6 +17,8 @@
*/
package org.apache.cassandra.db.compaction;
+import javax.json.JsonArray;
+import javax.json.JsonObject;
import javax.management.openmbean.*;
import java.util.Map;
import java.util.UUID;
@@ -82,4 +84,35 @@ public static TabularData from(UntypedResultSet resultSet) throws OpenDataExcept
}
return result;
}
+
+ public static TabularData from(JsonArray resultSet) throws OpenDataException {
+ TabularDataSupport result = new TabularDataSupport(TABULAR_TYPE);
+ for (int i = 0; i < resultSet.size(); i++) {
+ JsonObject row = resultSet.getJsonObject(i);
+ String id = row.getString("id");
+ String ksName = row.getString("ks");
+ String cfName = row.getString("cf");
+ long compactedAt = row.getJsonNumber("compacted_at").longValue();
+ long bytesIn = row.getJsonNumber("bytes_in").longValue();
+ long bytesOut = row.getJsonNumber("bytes_out").longValue();
+
+ JsonArray merged = row.getJsonArray("rows_merged");
+ StringBuilder sb = new StringBuilder();
+ if (merged != null) {
+ sb.append('{');
+ for (int m = 0; m < merged.size(); m++) {
+ JsonObject entry = merged.getJsonObject(m);
+ if (m > 0) {
+ sb.append(',');
+ }
+ sb.append(entry.getString("key")).append(':').append(entry.getString("value"));
+
+ }
+ sb.append('}');
+ }
+ result.put(new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
+ new Object[] { id, ksName, cfName, compactedAt, bytesIn, bytesOut, sb.toString() }));
+ }
+ return result;
+ }
}
diff --git a/src/java/org/apache/cassandra/db/compaction/ScyllaCompactionManager.java b/src/java/org/apache/cassandra/db/compaction/ScyllaCompactionManager.java
new file mode 100644
index 0000000000..f8b7e9c840
--- /dev/null
+++ b/src/java/org/apache/cassandra/db/compaction/ScyllaCompactionManager.java
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.db.compaction;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.TabularData;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.apache.cassandra.metrics.CompactionMetrics;
+
+import com.scylladb.jmx.api.APIClient;
+
+/**
+ * A singleton which manages a private executor of ongoing compactions.
+ *
+ * Scheduling for compaction is accomplished by swapping sstables to be
+ * compacted into a set via DataTracker. New scheduling attempts will ignore
+ * currently compacting sstables.
+ */
+
+/*
+ * Copyright 2015 Cloudius Systems
+ *
+ * Modified by Cloudius Systems
+ */
+public class ScyllaCompactionManager implements CompactionManagerMBean {
+ public static final String MBEAN_OBJECT_NAME = "org.apache.cassandra.db:type=CompactionManager";
+ private static final Logger logger = Logger.getLogger(CompactionManager.class.getName());
+ protected final APIClient client;
+
+ public void log(String str) {
+ logger.finest(str);
+ }
+
+ public ScyllaCompactionManager(APIClient client) {
+ this.client=client;
+// super(MBEAN_OBJECT_NAME, client, new CompactionMetrics());
+ }
+
+ /** List of running compaction objects. */
+ @Override
+ public List