rishabh-src commented on code in PR #2153:
URL: https://github.com/apache/zookeeper/pull/2153#discussion_r1583424429
##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java:
##########
@@ -545,8 +553,16 @@ public void loadData() throws IOException,
InterruptedException {
.filter(session ->
zkDb.getSessionWithTimeOuts().get(session) == null)
.forEach(session -> killSession(session,
zkDb.getDataTreeLastProcessedZxid()));
- // Make a clean snapshot
- takeSnapshot();
+ // Make a clean snapshot if needed
+ /* A snapshot is not needed when loading data during leader election.
A new snapshot is not needed to return to
+ * the current state because the current state was reached by loading
the data tree using an old snapshot.
+ * During leader election, there are no ongoing transactions that
could be lost either. If a snapshot is needed
+ * to send to a learner during leader election, that snapshot will be
taken as part of leader election, so
+ * snapshotting does not need to be done here as well.
+ */
Review Comment:
Thanks a lot for the info @horizonzy , is this session info used for
something upon restart that is necessary for correctness? Is it mainly
important for telemetry? If it is not needed for correctness could skipping
this snapshotting step during leader election be made a configurable option?
--
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]