direct: Fix WAL corruption after two consecutive failed deploys#5598
Open
denik wants to merge 4 commits into
Open
direct: Fix WAL corruption after two consecutive failed deploys#5598denik wants to merge 4 commits into
denik wants to merge 4 commits into
Conversation
Contributor
Approval status: pending
|
Two consecutive failed deploys left the local state WAL with a serial ahead of the committed state, after which every bundle command failed WAL recovery until the WAL was deleted by hand. - Don't open the WAL for write when planning already failed, so a failed plan no longer leaves a header-only WAL behind. - Don't advance the serial when recovering a header-only WAL, so a crash between UpgradeToWrite and Finalize can't wedge later deploys. Co-authored-by: Isaac
InitForApply receives ctx and could log a diagnostic without returning an error, so the call site cannot prove it never will. Re-check logdiag before deploying. UpgradeToWrite takes no ctx and thus cannot log, so the earlier check alone is enough to guard opening the WAL. Co-authored-by: Isaac
Drop the hand-written resources.json.tmpl so the test no longer depends on the internal state-file format. Deploy the job normally, then inject a fault on the plan-stage refresh GET so the next two deploys fail while planning and the last one recovers. Co-authored-by: Isaac
Co-authored-by: Isaac
Collaborator
Integration test reportCommit: 9d377c6
22 interesting tests: 15 SKIP, 7 RECOVERED
Top 30 slowest tests (at least 2 minutes):
|
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.
Changes
Two failed deploys in a row left the direct-engine state WAL with a serial
ahead of the committed state, after which every
bundlecommand failed WALrecovery (
WAL serial (N) is ahead of expected) until the WAL was deleted byhand.
no longer leaves a header-only WAL behind.
between
UpgradeToWriteandFinalizecan't wedge later deploys either.Why
Previously error in plan or deploy could leave bundle locally undeployable until .wal is manually removed.
Tests
bundle/deploy/wal/two-failed-deploys: two plan failures (injected fault) nolonger leave a WAL; the next deploy succeeds.
bundle/deploy/wal/two-crashed-deploys: two deploys killed mid-apply recoverwithout wedging.
TestHeaderOnlyWALRecoveryDoesNotAdvanceSerial. Each test was confirmedto fail when its corresponding fix is reverted.
This pull request and its description were written by Isaac.