-
Notifications
You must be signed in to change notification settings - Fork 181
direct: Fix WAL corruption after two consecutive failed deploys #5606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
14 changes: 14 additions & 0 deletions
14
acceptance/bundle/deploy/wal/header-only-wal/databricks.yml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| bundle: | ||
| name: test-bundle | ||
|
|
||
| resources: | ||
| jobs: | ||
| test_job: | ||
| name: "test-job" | ||
| tasks: | ||
| - task_key: "test-task" | ||
| spark_python_task: | ||
| python_file: ./test.py | ||
| new_cluster: | ||
| spark_version: 15.4.x-scala2.12 | ||
| node_type_id: i3.xlarge |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
|
|
||
| === First deploy (killed before recording the job, leaves a header-only WAL) | ||
| >>> errcode [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| [PROCESS_KILLED] | ||
|
|
||
| Exit code: [KILLED] | ||
|
|
||
| >>> cat .databricks/bundle/default/resources.json.wal | ||
| {"state_version":2,"cli_version":"[DEV_VERSION]","lineage":"[UUID]","serial":1} | ||
|
|
||
| === Second deploy (killed again, leaves another header-only WAL) | ||
| >>> errcode [CLI] bundle deploy --force-lock | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| [PROCESS_KILLED] | ||
|
|
||
| Exit code: [KILLED] | ||
|
|
||
| >>> cat .databricks/bundle/default/resources.json.wal | ||
| {"state_version":2,"cli_version":"[DEV_VERSION]","lineage":"[UUID]","serial":1} | ||
|
|
||
| === Third deploy (must recover and succeed, not blocked by the leftover WAL) | ||
| >>> errcode [CLI] bundle deploy --force-lock | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> errcode assert_not_exists.py .databricks/bundle/default/resources.json.wal | ||
|
|
||
| >>> errcode cat .databricks/bundle/default/resources.json | ||
| { | ||
| "serial": 1, | ||
| "state_keys": [ | ||
| "resources.jobs.test_job" | ||
| ] | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Two consecutive deploys are killed mid-apply, after UpgradeToWrite has written | ||
| # the WAL header but before Finalize runs (killed on the jobs/create call, before | ||
| # the job's state is recorded). A kill cannot be prevented by bailing out early, | ||
| # so each crash leaves a header-only WAL behind. Recovery must discard those | ||
| # no-op WALs without advancing the serial; otherwise the second crash would write | ||
| # its WAL header two serials ahead of the committed state and block every later | ||
| # command. Regression test for the dstate recovery fix. | ||
| kill_after.py "POST /api/2.2/jobs/create" 0 2 | ||
|
|
||
| title "First deploy (killed before recording the job, leaves a header-only WAL)" | ||
| trace errcode $CLI bundle deploy | ||
| trace cat .databricks/bundle/default/resources.json.wal | ||
|
|
||
| title "Second deploy (killed again, leaves another header-only WAL)" | ||
| trace errcode $CLI bundle deploy --force-lock | ||
| trace cat .databricks/bundle/default/resources.json.wal | ||
|
|
||
| title "Third deploy (must recover and succeed, not blocked by the leftover WAL)" | ||
| trace errcode $CLI bundle deploy --force-lock | ||
|
|
||
| trace errcode assert_not_exists.py .databricks/bundle/default/resources.json.wal | ||
| trace errcode cat .databricks/bundle/default/resources.json | jq -S '{serial: .serial, state_keys: (.state | keys)}' |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print("test") |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.