From 2e7ecdb6819d5e6f087097680ef4f60de41c8067 Mon Sep 17 00:00:00 2001 From: Chris Goffinet Date: Thu, 7 Apr 2011 19:40:33 +0000 Subject: [PATCH] Support a byte[] key for getNaturalEndpoints so clustertool get_endpoints does not throw exception patch by goffinet; reviewed by stuhood for CASSANDRA-2437 git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1089955 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/cassandra/service/StorageService.java | 5 +++++ .../org/apache/cassandra/service/StorageServiceMBean.java | 1 + src/java/org/apache/cassandra/tools/NodeProbe.java | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index 42fd07ba85..6a572487e1 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -1543,6 +1543,11 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe * @param key - key for which we need to find the endpoint return value - * the endpoint responsible for this key */ + public List getNaturalEndpoints(String table, byte[] key) + { + return getNaturalEndpoints(table, partitioner.getToken(ByteBuffer.wrap(key))); + } + public List getNaturalEndpoints(String table, ByteBuffer key) { return getNaturalEndpoints(table, partitioner.getToken(key)); diff --git a/src/java/org/apache/cassandra/service/StorageServiceMBean.java b/src/java/org/apache/cassandra/service/StorageServiceMBean.java index c37969b2db..cc992bb5c1 100644 --- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java +++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java @@ -133,6 +133,7 @@ public interface StorageServiceMBean * @param key - key for which we need to find the endpoint return value - * the endpoint responsible for this key */ + public List getNaturalEndpoints(String table, byte[] key); public List getNaturalEndpoints(String table, ByteBuffer key); /** diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java index 8e9740946c..86084261d4 100644 --- a/src/java/org/apache/cassandra/tools/NodeProbe.java +++ b/src/java/org/apache/cassandra/tools/NodeProbe.java @@ -443,7 +443,7 @@ public class NodeProbe public List getEndpoints(String keyspace, String key) { // FIXME: string key - return ssProxy.getNaturalEndpoints(keyspace, ByteBuffer.wrap(key.getBytes(UTF_8))); + return ssProxy.getNaturalEndpoints(keyspace, key.getBytes(UTF_8)); } public Set getStreamDestinations()