belliottsmith commented on code in PR #4460:
URL: https://github.com/apache/cassandra/pull/4460#discussion_r2486328542
##########
src/java/org/apache/cassandra/service/accord/AccordService.java:
##########
@@ -471,7 +458,32 @@ public void finishInitialization()
TopologyRange remote = fetchTopologies(highestKnown + 1);
if (remote != null) // TODO (required): if remote.min >
highestKnown + 1, should we decide if we need to truncate our local topologies?
Probably not until startup has finished.
+ {
remote.forEach(configService::reportTopology, remote.min,
Integer.MAX_VALUE);
+ if (remote.current > highestKnown)
+ highestKnown = remote.current;
+ }
+
+ // Subscribe to TCM events, and collect any we may have missed to
report now
+ ChangeListener prevListener =
MetadataChangeListener.instance.collector.getAndSet(new ChangeListener()
+ {
+ @Override
+ public void notifyPostCommit(ClusterMetadata prev,
ClusterMetadata next, boolean fromSnapshot)
+ {
+ if (state != State.SHUTDOWN)
+ configService.maybeReportMetadata(next);
+ }
+ });
+
+ Invariants.require((prevListener instanceof
MetadataChangeListener.PreInitStateCollector),
+ "Listener should have been initialized with
Accord pre-init state collector, but was " + prevListener.getClass());
+
+ MetadataChangeListener.PreInitStateCollector preinit =
(MetadataChangeListener.PreInitStateCollector) prevListener;
Review Comment:
I think the idea here was to avoid double reporting maybe? Because we only
use the maybeReportTopology logic on startup, and we may fetch that topology
again during the distributed TopologyRange fetch. I am sure another change
could be made to make it neat, I am fine with either approach.
--
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]