Repository navigation
Persist the DMS version in resources.json serial #7046
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
Changes from all commits
b87d0fd
beeca57
ec206eb
9c50d7a
1b37103
4733464
f67caca
d7fed16
356b242
4ed7390
c810375
d2383c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,7 @@ Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged | |
| "state_version": 3, | ||
| "cli_version": "[CLI_VERSION]", | ||
| "lineage": "[UUID]", | ||
| "serial": 1, | ||
| "features": { | ||
| "deployment_history": {} | ||
| }, | ||
|
|
@@ -175,14 +176,22 @@ API message: Fault injected by test. | |
| } | ||
| ] | ||
|
|
||
| === The state shows the resource still exists but the operation is marked failed | ||
| === The local state file records failed version 2 | ||
| >>> print_state.py --no-dms | ||
| { | ||
| "state_version": 3, | ||
| "cli_version": "[CLI_VERSION]", | ||
| "lineage": "[UUID]", | ||
| "serial": 2, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also extract serial from resources.json? To show that it's one before the "serial" as returnd by print_state.py
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already do that. print_state.py --no-dms prints the local state. The remote state is not updated on bundle destroy that's why it's missing |
||
| "features": { | ||
| "deployment_history": {} | ||
| }, | ||
| "state": {} | ||
| } | ||
|
|
||
| === The remote checkpoint stays at serial 1 while DMS advances to version 2 | ||
| >>> MSYS_NO_PATHCONV=1 [CLI] workspace export /Workspace/Users/[USERNAME]/.bundle/dms-failed-delete-[UNIQUE_NAME]/default/state/resources.json --format RAW | ||
| {"serial":1} | ||
|
|
||
| >>> print_state.py | ||
| {"serial":2} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| bundle: | ||
| name: dms-stale-local-state-$UNIQUE_NAME | ||
|
|
||
| experimental: | ||
| deployment_history: true | ||
|
|
||
| resources: | ||
| jobs: | ||
| foo: | ||
| name: foo |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = true | ||
| EnvMatrix.DMS = [""] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
|
|
||
| === Setup (LOG.setup): reconstruct full version 1 without a history marker, then deploy version 2 | ||
| >>> jq -c {serial, features} .databricks/resources.v1.json | ||
| {"serial":1,"features":null} | ||
|
|
||
| >>> jq -c {serial, features} .databricks/resources.v2.json | ||
| {"serial":2,"features":{"deployment_history":{}}} | ||
|
|
||
| === Local recorded serial 3 ahead of DMS version 2 is rejected | ||
| >>> update_file.py .databricks/bundle/default/resources.json "serial": 2 "serial": 3 | ||
|
|
||
| >>> musterr [CLI] bundle deploy | ||
| Error: inconsistent deployment state: resource state serial (3) is ahead of deployment history version (2) | ||
|
|
||
|
|
||
| === 1. Config false and env false: newer remote state replaces the local copy and reads DMS | ||
| >>> cp .databricks/resources.v1.json .databricks/bundle/default/resources.json | ||
|
|
||
| >>> DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false [CLI] bundle summary --force-pull -o json | ||
| Warn: Deployment history setting (false) does not match the existing state (true). Using the existing state. | ||
| {"job_id":"[FOO_ID]"} | ||
|
|
||
| >>> cmp .databricks/resources.v2.json .databricks/bundle/default/resources.json | ||
|
|
||
| >>> print_requests.py --dms //resources --get --oneline | ||
| {"method": "GET", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/resources"} | ||
|
|
||
| === 2. Config removed and env false: restore the same snapshot, then read remote DMS state | ||
| >>> cp .databricks/resources.v1.json .databricks/bundle/default/resources.json | ||
|
|
||
| >>> DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false [CLI] bundle summary --force-pull -o json | ||
| Warn: Deployment history setting (false) does not match the existing state (true). Using the existing state. | ||
| {"job_id":"[FOO_ID]"} | ||
|
|
||
| >>> cmp .databricks/resources.v2.json .databricks/bundle/default/resources.json | ||
|
|
||
| >>> print_requests.py --dms //resources --get --oneline | ||
| {"method": "GET", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/resources"} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| title "Setup (LOG.setup): reconstruct full version 1 without a history marker, then deploy version 2" | ||
| { | ||
| $CLI bundle deploy | ||
| DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=true print_state.py > .databricks/resources.v1.json | ||
| DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=true replace_ids.py | ||
| update_file.py databricks.yml 'name: foo' 'name: updated' | ||
| $CLI bundle deploy | ||
| cp .databricks/bundle/default/resources.json .databricks/resources.v2.json | ||
| deployment_id=$(MSYS_NO_PATHCONV=1 $CLI workspace get-status "/Workspace/Users/${CURRENT_USER_NAME}/.bundle/dms-stale-local-state-${UNIQUE_NAME}/default/state/resources.deployment.json" -o json | jq -r '.object_id') | ||
| add_repl "$deployment_id" DEPLOYMENT_ID | ||
| } &> LOG.setup | ||
| trace jq -c '{serial, features}' .databricks/resources.v1.json | ||
| trace jq -c '{serial, features}' .databricks/resources.v2.json | ||
|
|
||
| title "Local recorded serial 3 ahead of DMS version 2 is rejected" | ||
| trace update_file.py .databricks/bundle/default/resources.json '"serial": 2' '"serial": 3' | ||
| trace musterr $CLI bundle deploy | ||
|
|
||
| rm -f "$OUT_REQUESTS" | ||
|
|
||
| title "1. Config false and env false: newer remote state replaces the local copy and reads DMS" | ||
| update_file.py databricks.yml 'deployment_history: true' 'deployment_history: false' | ||
| trace cp .databricks/resources.v1.json .databricks/bundle/default/resources.json | ||
| trace DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false $CLI bundle summary --force-pull -o json | jq -c '{job_id: .resources.jobs.foo.id}' | ||
| trace cmp .databricks/resources.v2.json .databricks/bundle/default/resources.json | ||
| trace print_requests.py --dms //resources --get --oneline | ||
|
|
||
| title "2. Config removed and env false: restore the same snapshot, then read remote DMS state" | ||
| update_file.py databricks.yml $'experimental:\n deployment_history: false\n\n' '' | ||
| trace cp .databricks/resources.v1.json .databricks/bundle/default/resources.json | ||
| trace DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false $CLI bundle summary --force-pull -o json | jq -c '{job_id: .resources.jobs.foo.id}' | ||
| trace cmp .databricks/resources.v2.json .databricks/bundle/default/resources.json | ||
| trace print_requests.py --dms //resources --get --oneline | ||
|
|
||
| DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=true $CLI bundle destroy --auto-approve &> LOG.cleanup | ||
| rm -f "$OUT_REQUESTS" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| EnvMatrix.DMS = [""] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,6 @@ | |
| }, | ||
| "cli_version": "0.0.0-dev", | ||
| "lineage": "test-lineage", | ||
| "serial": 1, | ||
| "serial": 0, | ||
| "state": {} | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,6 @@ | |
| }, | ||
| "cli_version": "0.0.0-dev", | ||
| "lineage": "test-lineage", | ||
| "serial": 1, | ||
| "serial": 0, | ||
| "state": {} | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mention that it's serial of post-migration and it's not updated further?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'll be a followup PR. Right now it's still just the serial that's being updated every time.