dcapwell commented on code in PR #4202:
URL: https://github.com/apache/cassandra/pull/4202#discussion_r2191106842


##########
src/java/org/apache/cassandra/service/accord/serializers/TopologySerializers.java:
##########
@@ -159,4 +167,127 @@ public long serializedSize(Topology topology)
             return size;
         }
     };
+
+    public static final UnversionedSerializer<Topology> compactTopology = new 
UnversionedSerializer<>()
+    {
+        @Override
+        public void serialize(Topology topology, DataOutputPlus out) throws 
IOException
+        {
+            out.writeLong(topology.epoch());
+            CollectionSerializers.serializeList(topology.staleIds(), out, 
TopologySerializers.nodeId);
+
+            List<Shard> shards = topology.shards();
+
+            // need to loop twice; once to collect tables/ranges, and another 
to save shards
+            ImmutableUniqueList<TableId> tables;

Review Comment:
   ok i took a look again and its the following
   
   1) `ImmutableUniqueList` is only *new* in the PR as git didn't see this as a 
migration; moved from `test` to `src`
   2) serializing the list; I need to write the data in insertion order.  
`Object2IntHashMap` isn't based off insertion order and isn't stable, so the 
serialization needs to do one of the following: copy the keys to a list and 
sorted by value, or maintain a `index -> type` mapping.  In both cases I argue 
`ImmutableUniqueList` is more efficient (the extra list doesn't need to be 
sorted, and is cheaper than the  `index -> type` mapping).



-- 
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-unsubscr...@cassandra.apache.org

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


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

Reply via email to