From 8073af6e0652ca069c59780142632c4faa0c06d0 Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Mon, 1 Mar 2021 09:51:46 +0200 Subject: [PATCH] CompactionManager: add the compaction id when available This patch adds the compaction id in getCompactions if it returns by the API, if it's not the current behaviour will be used and it will return none. After this patch a call to nodetool compactionstats -H Will return: id compaction type keyspace table completed total unit progress c942bd30-7a62-11eb-84bc-576502584f9a COMPACTION keyspace1 standard1 1062 8576 keys 12.38% c9429620-7a62-11eb-8afb-576402584f9a COMPACTION keyspace1 standard1 972 8448 keys 11.51% Active compaction remaining time : 0h00m00s Fixes scylladb/scylla#7927 Signed-off-by: Amnon Heiman --- .../org/apache/cassandra/db/compaction/CompactionManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/main/java/org/apache/cassandra/db/compaction/CompactionManager.java index 0afdc18..f1b0e20 100644 --- a/src/main/java/org/apache/cassandra/db/compaction/CompactionManager.java +++ b/src/main/java/org/apache/cassandra/db/compaction/CompactionManager.java @@ -75,7 +75,7 @@ public class CompactionManager extends MetricsMBean implements CompactionManager result.put("keyspace", compaction.getString("ks")); result.put("columnfamily", compaction.getString("cf")); result.put("unit", compaction.getString("unit")); - result.put("compactionId", ""); + result.put("compactionId", (compaction.containsKey("id"))? compaction.getString("id") : ""); results.add(result); } return results;