aratno commented on code in PR #4446:
URL: https://github.com/apache/cassandra/pull/4446#discussion_r2599031856


##########
src/java/org/apache/cassandra/replication/Shard.java:
##########
@@ -375,4 +375,56 @@ void 
collectShardReconciledOffsetsToBuilder(ReconciledKeyspaceOffsets.Builder ke
     {
         logs.values().forEach(log -> keyspaceBuilder.put(log.logId, 
log.collectReconciledOffsets(), range));
     }
+
+    public DebugInfo getDebugInfo()
+    {
+        List<LogDebugInfo> logInfos = new ArrayList<>();
+        for (CoordinatorLog log : logs.values())
+        {
+            logInfos.add(new LogDebugInfo(log.getLogId().toString(), 
log.getDebugState()));
+        }
+        return new DebugInfo(logInfos);
+    }
+
+    public static class DebugInfo
+    {
+        public final List<LogDebugInfo> logs;
+
+        private DebugInfo(List<LogDebugInfo> logs)
+        {
+            this.logs = logs;
+        }
+    }
+
+    public static class LogDebugInfo
+    {
+        public final String logId;
+        public final CoordinatorLog.DebugState debugState;
+
+        private LogDebugInfo(String logId, CoordinatorLog.DebugState 
debugState)
+        {
+            this.logId = logId;
+            this.debugState = debugState;
+        }
+    }
+
+    public String getKeyspace()
+    {
+        return keyspace;
+    }
+
+    public Range<Token> getRange()
+    {
+        return range;
+    }
+
+    public int getLocalNodeId()
+    {
+        return localNodeId;
+    }
+
+    public Participants getParticipants()
+    {
+        return participants;
+    }

Review Comment:
   You can refactor this a bit by having Shard.DebugState be a map of LogId -> 
CoordinatorLog.DebugState. Part of the idea of DebugState is that it doesn't 
increase the visibility of these fields to public. Could you include these 
public getters (which exist for the vtable) in Shard.DebugState?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to