From b53be3a4ec623dfee51887c4fcd7f8a4d29efeeb Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Mon, 24 Aug 2015 10:35:05 +0300 Subject: [PATCH] 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 --- .../org/apache/cassandra/service/StorageService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/cassandra/service/StorageService.java b/src/main/java/org/apache/cassandra/service/StorageService.java index b40e49b..d6521c6 100644 --- a/src/main/java/org/apache/cassandra/service/StorageService.java +++ b/src/main/java/org/apache/cassandra/service/StorageService.java @@ -735,8 +735,7 @@ public class StorageService extends NotificationBroadcasterSupport */ public Map getOwnership() { log(" getOwnership()"); - // TBD - return c.getMapInetAddressFloatValue(""); + return c.getMapInetAddressFloatValue("/storage_service/ownership/"); } /** @@ -749,8 +748,11 @@ public class StorageService extends NotificationBroadcasterSupport public Map effectiveOwnership(String keyspace) throws IllegalStateException { log(" effectiveOwnership(String keyspace) throws IllegalStateException"); - // TBD - return c.getMapInetAddressFloatValue(""); + try { + return c.getMapInetAddressFloatValue("/storage_service/ownership/" + keyspace); + } catch (Exception e) { + throw new IllegalStateException("Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless"); + } } public List getKeyspaces() {