diff --git a/CHANGES.txt b/CHANGES.txt index ffaa1b5d00..fd0d30a969 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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) diff --git a/modules/accord b/modules/accord index 090cb49bfb..2f287b6c35 160000 --- a/modules/accord +++ b/modules/accord @@ -1 +1 @@ -Subproject commit 090cb49bfb52357fee0f554d5ba0f0b012195280 +Subproject commit 2f287b6c357d0fecb61ab0ba6910270a311ad775 diff --git a/src/java/org/apache/cassandra/service/accord/journal/AccordTopologyUpdate.java b/src/java/org/apache/cassandra/service/accord/journal/AccordTopologyUpdate.java index c0b2f9ad60..b45de2c477 100644 --- a/src/java/org/apache/cassandra/service/accord/journal/AccordTopologyUpdate.java +++ b/src/java/org/apache/cassandra/service/accord/journal/AccordTopologyUpdate.java @@ -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); } } diff --git a/test/unit/org/apache/cassandra/index/accord/RouteIndexTest.java b/test/unit/org/apache/cassandra/index/accord/RouteIndexTest.java index 60f06ba238..77f379571f 100644 --- a/test/unit/org/apache/cassandra/index/accord/RouteIndexTest.java +++ b/test/unit/org/apache/cassandra/index/accord/RouteIndexTest.java @@ -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 diff --git a/test/unit/org/apache/cassandra/service/accord/AccordConfigurationServiceTest.java b/test/unit/org/apache/cassandra/service/accord/AccordConfigurationServiceTest.java index 94e07b9a9e..3bea823ae2 100644 --- a/test/unit/org/apache/cassandra/service/accord/AccordConfigurationServiceTest.java +++ b/test/unit/org/apache/cassandra/service/accord/AccordConfigurationServiceTest.java @@ -180,7 +180,7 @@ public class AccordConfigurationServiceTest public AsyncResult 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); } }; diff --git a/test/unit/org/apache/cassandra/service/accord/journal/AccordTopologyUpdateTest.java b/test/unit/org/apache/cassandra/service/accord/journal/AccordTopologyUpdateTest.java index 109aa3ed46..a1f7a738d0 100644 --- a/test/unit/org/apache/cassandra/service/accord/journal/AccordTopologyUpdateTest.java +++ b/test/unit/org/apache/cassandra/service/accord/journal/AccordTopologyUpdateTest.java @@ -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); }; }