alanwang67 commented on code in PR #4692:
URL: https://github.com/apache/cassandra/pull/4692#discussion_r3096487847


##########
src/java/org/apache/cassandra/service/accord/AccordService.java:
##########
@@ -1175,6 +1178,26 @@ public void awaitDone(TableId id, long epoch)
         getBlocking(node.durability().sync("Drop Keyspace/Table (Epoch " + 
epoch + ')', ExclusiveSyncPoint, TxnId.minForEpoch(epoch), ranges, Self, All, 
DatabaseDescriptor.getAccordRangeSyncPointTimeoutNanos(), NANOSECONDS), ranges, 
new LatencyRequestBookkeeping(null), startedAt, deadline, false);
     }
 
+    @Override
+    public Map<TableId, Set<org.apache.cassandra.dht.Range<Token>>> 
getInUseRanges()
+    {
+        Map<TableId, Set<org.apache.cassandra.dht.Range<Token>>> 
tableToRangeMap = new HashMap<>();
+        List<Ranges> globalRanges = 
getBlocking(node.commandStores().getInUseRanges());
+
+        for (Ranges ranges : globalRanges)
+        {
+            ranges.stream().forEach(r -> {
+                TokenRange tokenRange = (TokenRange) r;
+                if (!tableToRangeMap.containsKey(tokenRange.table()))
+                    tableToRangeMap.put(tokenRange.table(), new HashSet<>());
+
+                
tableToRangeMap.get(tokenRange.table()).add(tokenRange.toKeyspaceRange());
+            });
+        }

Review Comment:
   Ah didn't know there was a method like this, makes inserting into a map with 
a collection as a value a lot cleaner. 



-- 
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