You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "belliottsmith (via GitHub)" <gi...@apache.org> on 2025/07/04 09:53:15 UTC
Re: [PR] CASSANDRA-20715: Accord: Topology serializer has a lot of repeated data, can dedup to shrink the cost [cassandra]
belliottsmith commented on code in PR #4202:
URL: https://github.com/apache/cassandra/pull/4202#discussion_r2184904384
##########
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:
I don't see why this class is needed for these serializers - why aren't we just using `Object2IntHashMap` directly? It would be more efficient, require no new types, and be more obvious to a reader. If you want to introduce a helper method for both serialising the array/list, and building the lookup that would make sense to me.
--
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