dcapwell commented on code in PR #3954: URL: https://github.com/apache/cassandra/pull/3954#discussion_r1992436550
########## src/java/org/apache/cassandra/service/accord/journal/AccordTopologyUpdate.java: ########## @@ -55,178 +56,181 @@ static AccordTopologyUpdate newTopology(Journal.TopologyUpdate update) { return new NewTopology(update); } - class RangesForEpochSerializer implements IVersionedSerializer<CommandStores.RangesForEpoch> + class RangesForEpochSerializer implements org.apache.cassandra.io.Serializer<CommandStores.RangesForEpoch> { public static final RangesForEpochSerializer instance = new RangesForEpochSerializer(); @Override - public void serialize(CommandStores.RangesForEpoch from, DataOutputPlus out, int version) throws IOException + public void serialize(CommandStores.RangesForEpoch from, DataOutputPlus out) throws IOException { out.writeUnsignedVInt32(from.size()); - from.forEach((epoch, ranges) -> { - try - { - out.writeLong(epoch); - KeySerializers.ranges.serialize(ranges, out, version); - } - catch (Throwable t) - { - throw new IllegalStateException("Serialization error", t); - } - }); + for (int i = 0; i < from.size(); i++) + { + out.writeLong(from.epochAtIndex(i)); + KeySerializers.ranges.serialize(from.rangesAtIndex(i), out); + } } @Override - public CommandStores.RangesForEpoch deserialize(DataInputPlus in, int version) throws IOException + public CommandStores.RangesForEpoch deserialize(DataInputPlus in) throws IOException { int size = in.readUnsignedVInt32(); Ranges[] ranges = new Ranges[size]; long[] epochs = new long[size]; for (int i = 0; i < ranges.length; i++) { epochs[i] = in.readLong(); - ranges[i] = KeySerializers.ranges.deserialize(in, version); + ranges[i] = KeySerializers.ranges.deserialize(in); } Invariants.require(ranges.length == epochs.length); return new CommandStores.RangesForEpoch(epochs, ranges); } @Override - public long serializedSize(CommandStores.RangesForEpoch t, int version) + public long serializedSize(CommandStores.RangesForEpoch from) { - return TypeSizes.sizeofUnsignedVInt(t.size()); + long size = TypeSizes.sizeofUnsignedVInt(from.size()); Review Comment: this was a bug, didn't account for the epoch ranges -- 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