Repository navigation
Conversation
MinutesSinceLastSuccessful{Snapshot,TxnLog,Timetable}Iteration start over at 0 every time the
server starts, because BackupStats and TimetableBackupStats take the process start time as the last
success. A backup server that keeps restarting before an iteration completes, for example one evicted
while staging a large txn log backlog or one crashing on startup, never looks stale, so alerts on
these gauges cannot fire.
Add MinutesSinceLastSuccessful{Snapshot,TxnLog,Timetable}IterationAcrossRestarts. Each successful
iteration writes its finish time to a small file in the backup status directory, and the stats seed
the new gauges from those files on startup. A missing or unreadable file falls back to the process
start time, as before. Writes go through a temp file and an atomic rename, and a failed write is
logged without affecting the backup.
The existing gauges keep their behavior. Alert actions that restart the server on a stale backup
rely on the reset; with a restart-safe value they would keep restarting the server until a backup
succeeds.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Lets wait for this PR and merge it in the latest 3.6.7 branch whenever its ready? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
MinutesSinceLastSuccessful{Snapshot,TxnLog,Timetable}Iterationstart over at 0 every time the server starts, becauseBackupStatsandTimetableBackupStatstake the process start time as the last success. A backup server that keeps restarting before an iteration completes, for example one evicted while staging a large txn log backlog or one crashing on startup, never looks stale, so alerts on these gauges cannot fire.This adds three gauges that survive restarts:
MinutesSinceLastSuccessfulSnapshotIterationAcrossRestartsandMinutesSinceLastSuccessfulTxnLogIterationAcrossRestartson the Backup MBeanMinutesSinceLastSuccessfulTimetableIterationAcrossRestartson the TimetableBackup MBeanEach successful iteration writes its finish time to a small file in the backup status directory (
zkBackupLastSuccessful{Snapshot,TxnLog,Timetable}Iteration), and the stats seed the new gauges from those files on startup. A missing or unreadable file falls back to the process start time, as before. Writes go through a temp file and an atomic rename, and a failed write is only logged.The existing gauges keep their behavior. Alert actions that restart the server on a stale backup rely on the reset; with a restart-safe value they would keep restarting the server until a backup succeeds.
The 3.8.x backup port (#175) will need the same change.
Tests
The following tests are written for this issue:
BackupStatsTest(new, uses an injected clock): the new gauges continue after a restart while the existing ones restart at 0; a failed iteration does not reset them and a successful one does; snapshot and txn log are tracked separately; a missing or corrupt file, or no status directory, falls back to process start; the timetable gauge behaves the same.BackupBeanTesttest2 and test3: after a restartedBackupManager, the new gauges report more than 0 minutes while the existing gauges are back at 0.The following is the result of the "mvn test" command on the appropriate module:
mvn -pl zookeeper-server test -Dtest='org.apache.zookeeper.server.backup.**.*Test,BackupManagerTest'on JDK 11: 45 run, 1 failure. The failure was the existinglastTimetableIterationDuration > 0assertion inBackupBeanTest.test3; run alone, test3 passed twice on this branch and twice on unmodifiedbranch-3.6.PersistedTimestamp:BackupBeanTest3/3 andBackupStatsTest6/6 passed.mvn -pl zookeeper-server -Pfull-build -DskipTests verify spotbugs:check checkstyle:check apache-rat:check: passed.Changes that Break Backward Compatibility (Optional)
None. Existing MBean attributes are unchanged; three attributes are added, and the backup status directory gains three small files.
🤖 Generated with GitHub Copilot CLI