[
https://issues.apache.org/jira/browse/CASSANDRA-17577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17542678#comment-17542678
]
Stefan Miklosovic commented on CASSANDRA-17577:
-----------------------------------------------
I have one question though
I have 3 nodes in 1 dc. When I do this:
{code}
admin@cqlsh> CREATE KEYSPACE abcd WITH replication = {'class':
'NetworkTopologyStrategy', 'dc1': 2};
admin@cqlsh> CREATE TABLE abcd.tb1 ( id uuid PRIMARY KEY );
admin@cqlsh> INSERT INTO abcd.tb1 (id ) VALUES (
4b34176f-f596-4645-bd36-e981f52ad38e );
admin@cqlsh> select token(id) FROM abcd.tb1 where id =
4b34176f-f596-4645-bd36-e981f52ad38e;
system.token(id)
----------------------
-7543363057972667092
(1 rows)
{code}
So, I would expect that when I do this, it should accept negative number too,
no?
{code}
admin@cqlsh> SHOW REPLICAS -7543363057972667092 abcd;
Improper SHOW command.
{code}
In other words, it seems to not accept negative token values.
> Add cqlsh SHOW REPLICAS by token command
> ----------------------------------------
>
> Key: CASSANDRA-17577
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17577
> Project: Cassandra
> Issue Type: New Feature
> Components: CQL/Interpreter
> Reporter: Brad Schoening
> Assignee: Brad Schoening
> Priority: Normal
> Fix For: 4.x
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> It is often useful to know when a query fails or a query is slow which nodes
> the query was routed too. For clusters with vnodes, determining this is not
> simple and requires an admin tool like 'nodetool getendpoints;.
> But, the Cassandra driver has cluster metadata which identifies which nodes
> are the replicas for a given token range. It should be straightforward to
> support this in CQLSH.
> Example with python driver:
> {quote}from cassandra.cluster import Cluster
> from cassandra.auth import PlainTextAuthProvider
> import cassandra.metadata
> from cassandra.metadata import Murmur3Token
>
> auth_provider = PlainTextAuthProvider(username='cassandra',
> password='cassandra')
> cluster = Cluster(['127.0.0.1'], auth_provider=auth_provider)
> session = cluster.connect('tests')
> cluster.metadata.token_map.get_replicas('tests',Murmur3Token(100))
> {color:#4c9aff}>>>
> cluster.metadata.token_map.get_replicas('tests',Murmur3Token(100)){color}
> {color:#4c9aff}[<Host: 127.0.0.1:9042 datacenter1>]{color}
>
> {quote}
> Users shouldn't require access to an admin tool like nodetool to access the
> cluster metadata. This is especially true for Cassandra-as-a-service
> offerings like AWS keyspaces or Instaclustr's managed service.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]