dcapwell commented on code in PR #3416:
URL: https://github.com/apache/cassandra/pull/3416#discussion_r1778883333
##########
src/java/org/apache/cassandra/service/accord/AccordService.java:
##########
@@ -387,10 +412,48 @@ public synchronized void startup()
if (state != State.INIT)
return;
journal.start(node);
- configService.start();
+ ClusterMetadataService cms = ClusterMetadataService.instance();
+ class Ref { List<ClusterMetadata> historic = Collections.emptyList();}
+ Ref ref = new Ref();
+ configService.start((optMaxEpoch -> {
+ // when max epoch isn't know, this means the node started for the
first time; check cluster's min epoch
+ // when max epoch is known, then there is no reason to discover
min epoch (we already did it)
+ if (optMaxEpoch.isPresent()) return;
+ List<ClusterMetadata> historic = ref.historic =
discoverHistoric(node, cms);
+ for (ClusterMetadata m : historic)
+ configService.reportMetadataInternal(m);
+ }));
+ ClusterMetadata current = cms.metadata();
+ if (!ref.historic.isEmpty())
+ {
+ List<ClusterMetadata> historic = ref.historic;
+ long lastHistoric = ref.historic.get(historic.size() -
1).epoch.getEpoch();
+ // new epochs added while loading... load the deltas
+ for (ClusterMetadata metadata :
ClusterMetadataService.instance().processor().reconstructFull(Epoch.create(lastHistoric
+ 1), Epoch.create(current.epoch.getEpoch() - 1)))
+ {
+ historic.add(metadata);
+ configService.reportMetadataInternal(metadata);
+ }
+
+ // sync doesn't happen when this node isn't in the epoch
+ //TODO (now, correctness): sync points use "closed" and not
"syncComplete", so need to call TM.epochRedundant or TM.onEpochClosed
+ // epochRedundant implies all txn that have been proposed for this
epoch have been executed "globally" - we don't have this knowlege
+ // epochClosed implies no "new" txn can be proposed
+ for (ClusterMetadata m : historic)
+ {
+ Topology t = AccordTopology.createAccordTopology(m);
+ long epoch = t.epoch();
+ for (Id id : t.nodes())
+ node.onRemoteSyncComplete(id, epoch);
+ //TODO (correctness): is this true?
+ node.onEpochClosed(t.ranges(), t.epoch());
+ node.onEpochRedundant(t.ranges(), t.epoch());
Review Comment:
double check with @belliottsmith on this
--
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]