Journal.TopologyUpdate should not store the local topology as it can be inferred from the global on

patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20785
This commit is contained in:
David Capwell 2025-07-24 15:56:05 -07:00
parent 49b99c9319
commit e48d0dcd2c
6 changed files with 7 additions and 11 deletions

View File

@ -1,4 +1,5 @@
5.1
* Journal.TopologyUpdate should not store the local topology as it can be inferred from the global on (CASSANDRA-20785)
* Accord: Topology serializer has a lot of repeated data, can dedup to shrink the cost (CASSANDRA-20715)
* Stream individual files in their own transactions and hand over ownership to a parent transaction on completion (CASSANDRA-20728)
* Limit the number of held heap dumps to not consume disk space excessively (CASSANDRA-20457)

@ -1 +1 @@
Subproject commit 090cb49bfb52357fee0f554d5ba0f0b012195280
Subproject commit 2f287b6c357d0fecb61ab0ba6910270a311ad775

View File

@ -112,9 +112,6 @@ public interface AccordTopologyUpdate
out.writeUnsignedVInt32(e.getKey());
RangesForEpochSerializer.instance.serialize(e.getValue(), out);
}
//TODO (desired): local to what? Rather than serializing local we can serialize the node its relative too? that why when we deserialize we do globa.forNode(node)
// this also decreases the size as we don't have redundent shards
TopologySerializers.compactTopology.serialize(from.local, out);
TopologySerializers.compactTopology.serialize(from.global, out);
}
@ -129,9 +126,8 @@ public interface AccordTopologyUpdate
CommandStores.RangesForEpoch rangesForEpoch = RangesForEpochSerializer.instance.deserialize(in);
commandStores.put(commandStoreId, rangesForEpoch);
}
Topology local = TopologySerializers.compactTopology.deserialize(in);
Topology global = TopologySerializers.compactTopology.deserialize(in);
return new Journal.TopologyUpdate(commandStores, local, global);
return new Journal.TopologyUpdate(commandStores, global);
}
@Override
@ -144,7 +140,6 @@ public interface AccordTopologyUpdate
size += RangesForEpochSerializer.instance.serializedSize(e.getValue());
}
size += TopologySerializers.compactTopology.serializedSize(from.local);
size += TopologySerializers.compactTopology.serializedSize(from.global);
return size;
}
@ -296,7 +291,7 @@ public interface AccordTopologyUpdate
{
public ImmutableTopoloyImage(TopologyImage image)
{
super(image.update.commandStores, image.update.local, image.update.global);
super(image.update.commandStores, image.update.global);
}
}

View File

@ -528,7 +528,7 @@ public class RouteIndexTest extends CQLTester
NodeId tcmNodeId = ClusterMetadata.current().myNodeId();
AccordService as = new AccordService(AccordTopology.tcmIdToAccord(tcmNodeId));
Topology topology = new Topology(1, Shard.create(TokenRange.fullRange(tableId, getPartitioner()), ofSorted(new Node.Id(1)), ofSorted(new Node.Id(1))));
as.unsafeStartupWithOverrides(new Journal.TopologyUpdate(storeRangesForEpochs, topology, topology));
as.unsafeStartupWithOverrides(new Journal.TopologyUpdate(storeRangesForEpochs, topology));
for (CommandStore commandStore : as.node().commandStores().all())
((AccordCommandStore)commandStore).unsafeUpsertRedundantBefore(emptyRedundantBefore);
// the reason for the mocking is to speed up compaction. Collecting the info from the stores has been slow and its always empty in this test... so stub it out to speed up the test

View File

@ -180,7 +180,7 @@ public class AccordConfigurationServiceTest
public AsyncResult<Void> onTopologyUpdate(Topology topology, boolean isLoad, boolean startSync)
{
// Fake journal save
journal_.saveTopology(new Journal.TopologyUpdate(new Int2ObjectHashMap<>(), topology, topology), () -> {});
journal_.saveTopology(new Journal.TopologyUpdate(new Int2ObjectHashMap<>(), topology), () -> {});
return super.onTopologyUpdate(topology, isLoad, startSync);
}
};

View File

@ -127,7 +127,7 @@ public class AccordTopologyUpdateTest
Node.Id self = rs.pick(topology.nodes());
return new Journal.TopologyUpdate(commandStores, topology.forNode(self), topology);
return new Journal.TopologyUpdate(commandStores, topology);
};
}