belliottsmith commented on code in PR #4202:
URL: https://github.com/apache/cassandra/pull/4202#discussion_r2194557820
##########
src/java/org/apache/cassandra/service/accord/serializers/TopologySerializers.java:
##########
@@ -159,4 +168,141 @@ 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
+ Object2IntHashMap<TableId> tables;
+ Object2IntHashMap<TokenRange> ranges;
+ {
+ Object2IntHashMap<TableId> tablesBuilder = new
Object2IntHashMap<>(-2);
Review Comment:
suggestion: for tableId at least, do we even really need to serialize as a
separate collection and encode indexes? We should visit `Shard` in `TableId`
order, so we could just always have one active `TableId` and simply encode a
boolean indicating whether we need to deserialize a new one?
--
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]