You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "mansikhara (via GitHub)" <gi...@apache.org> on 2026/10/07 21:23:38 UTC

[PR] CASSSIDECAR-506: Report unknown node status as "Unknown" instead of "… [cassandra-sidecar]

mansikhara opened a new pull request, #391:
URL: https://github.com/apache/cassandra-sidecar/pull/391

   …?" in ring and token range replica responses


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSSIDECAR-506: Report unknown node status as "Unknown" instead of "… [cassandra-sidecar]

Posted by "sarankk (via GitHub)" <gi...@apache.org>.
sarankk commented on code in PR #391:
URL: https://github.com/apache/cassandra-sidecar/pull/391#discussion_r4221395981


##########
adapters/adapters-base/src/test/java/org/apache/cassandra/sidecar/adapters/base/RingProviderTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.sidecar.adapters.base;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Unit tests for {@link RingProvider}
+ */
+class RingProviderTest
+{
+    private static final String LIVE_NODE = "127.0.0.1:7000";
+    private static final String DEAD_NODE = "127.0.0.2:7000";
+    private static final String UNCLASSIFIED_NODE = "127.0.0.3:7000";
+
+    @Test
+    void testStatusOfLiveAndDeadNodes()
+    {
+        RingProvider.Status status = new RingProvider.Status(List.of(LIVE_NODE), List.of(DEAD_NODE));
+
+        assertThat(status.of(LIVE_NODE)).isEqualTo("Up");
+        assertThat(status.of(DEAD_NODE)).isEqualTo("Down");
+    }
+
+    @Test
+    void testStatusOfNodeNeitherLiveNorDeadIsUnknown()
+    {
+        RingProvider.Status status = new RingProvider.Status(List.of(LIVE_NODE), List.of(DEAD_NODE));
+
+        // Clients parse the status into an enum, so it must not be "?"
+        assertThat(status.of(UNCLASSIFIED_NODE)).isEqualTo("Unknown");
+    }
+
+    @Test
+    void testStateOfNodeNeitherJoiningLeavingNorMovingIsNormal()
+    {
+        RingProvider.State state = new RingProvider.State(Collections.emptyList(),

Review Comment:
   Nit: use List.of() here as well



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSSIDECAR-506: Report unknown node status as "Unknown" instead of "… [cassandra-sidecar]

Posted by "mansikhara (via GitHub)" <gi...@apache.org>.
mansikhara commented on code in PR #391:
URL: https://github.com/apache/cassandra-sidecar/pull/391#discussion_r4213014192


##########
adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/RingProvider.java:
##########
@@ -175,7 +175,8 @@ String of(String endpoint)
                 return NodeStatus.UP.displayName();
             if (deadNodes.contains(endpoint))
                 return NodeStatus.DOWN.displayName();
-            return UNKNOWN_SHORT;
+            // Report "Unknown" rather than "?" so clients can parse the status as an enum value
+            return UNKNOWN;

Review Comment:
   UNKNOWN_SHORT is still used after this change. It's the fallback for load when an endpoint is missing from the load map (RingProvider.java:112), and the owns value from formatOwns when effective ownership isn't available. Using ? there matches nodetool ring/status.                                                                  
                                                                                            
   I left those two out of scope on purpose. Both fields are free-form display strings, and clients don't parse them. For example, Cassandra Analytics only serializes load()/owns() in RingInstance and never maps them to an enum. Only status gets parsed, which caused the failure in CASSSIDECAR-506. Changing load/owns would change the API output without fixing anything.                                                        
   
   If you'd still prefer a single placeholder throughout, I can switch both to "Unknown" and remove UNKNOWN_SHORT in this PR. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSSIDECAR-506: Report unknown node status as "Unknown" instead of "… [cassandra-sidecar]

Posted by "sarankk (via GitHub)" <gi...@apache.org>.
sarankk commented on code in PR #391:
URL: https://github.com/apache/cassandra-sidecar/pull/391#discussion_r4212724466


##########
adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/RingProvider.java:
##########
@@ -175,7 +175,8 @@ String of(String endpoint)
                 return NodeStatus.UP.displayName();
             if (deadNodes.contains(endpoint))
                 return NodeStatus.DOWN.displayName();
-            return UNKNOWN_SHORT;
+            // Report "Unknown" rather than "?" so clients can parse the status as an enum value
+            return UNKNOWN;

Review Comment:
   Can we also remove `UNKNOWN_SHORT` if it is not used elsewhere? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSSIDECAR-506: Report unknown node status as "Unknown" instead of "… [cassandra-sidecar]

Posted by "sarankk (via GitHub)" <gi...@apache.org>.
sarankk merged PR #391:
URL: https://github.com/apache/cassandra-sidecar/pull/391


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org