Skip to content

Commit

Permalink
make cassandra compact in the scope of keyspace
Browse files Browse the repository at this point in the history
Change-Id: I321121bd43ef4895a4a9fe815d818d62eb74c925
  • Loading branch information
javeme committed Jun 2, 2021
1 parent 8549b68 commit 5f347a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.baidu.hugegraph.backend.store.cassandra.CassandraTables.Vertex;
import com.baidu.hugegraph.config.CoreOptions;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.testutil.Whitebox;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.InsertionOrderUtil;
import com.baidu.hugegraph.util.UnitUtil;
Expand Down Expand Up @@ -157,7 +158,7 @@ protected void appendExtraMetrics(Map<String, Object> metrics,
appendCounterMetrics(metrics, probe, this.keyspace, this.tables,
"BloomFilterFalseRatio");

//Table timer Metrics
// Table timer Metrics
appendTimerMetrics(metrics, probe, this.keyspace, "WriteLatency");
appendTimerMetrics(metrics, probe, this.keyspace, "ReadLatency");
appendTimerMetrics(metrics, probe, null, "WriteLatency");
Expand Down Expand Up @@ -266,6 +267,13 @@ public Map<String, Object> compact() {
private Object compactHost(String host) {
try (NodeProbe probe = this.newNodeProbe(host)) {
Compact compact = new Compact();
/*
* Set the keyspace to be compacted
* NOTE: use Whitebox due to no public api is provided, args format
* is [<keyspace> <tables>...], the first arg means keyspace.
*/
Whitebox.invoke(compact, "args", new Class<?>[]{Object.class},
"add", this.keyspace);
compact.execute(probe);
return "OK";
} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected void appendExtraMetrics(Map<String, Object> metrics,
appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(),
"BloomFilterFalseRatio");

//Table timer Metrics
// Table timer Metrics
//appendTimerMetrics(metrics, probe, this.keyspace(), "WriteLatency");
//appendTimerMetrics(metrics, probe, this.keyspace(), "ReadLatency");
//appendTimerMetrics(metrics, probe, null, "WriteLatency");
Expand Down

0 comments on commit 5f347a9

Please sign in to comment.