Skip to content

Persist the DMS version in resources.json serial - #7046

Open
shreyas-goenka wants to merge 12 commits into
mainfrom
shreyas-goenka_data/shreyas-goenka/dms-serial-stack
Open

shreyas-goenka wants to merge 12 commits into
mainfrom
shreyas-goenka_data/shreyas-goenka/dms-serial-stack

Conversation

@shreyas-goenka

@shreyas-goenka shreyas-goenka commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Persist the known DMS version ID in the existing serial field of resources.json. Resource contents still live in DMS.

The serial in this file is a cache, not a new source of truth: Open and GetSerial() continue to use the service version. Legacy files with an omitted or zero serial remain supported. A claimed version is cached even if it is in progress or fails; unsuccessful version creation does not advance it.

Tests

New acceptance test that asserts that even if there's an outdated local state, the serial from remote is read and DMS takes priority.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: d2383c8

Run: 38884454406

Env 🔄​flaky ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 295 21 5:41
✅​ aws-windows-latest-4core-16gb 297 19 5:03
🔄​ azure linux-2core-8gb 2 292 21 5:48
🔄​ azure-windows-latest-4core-16gb 2 294 19 5:40
✅​ gcp linux-2core-8gb 295 21 5:27
✅​ gcp-windows-latest-4core-16gb 297 19 6:41
Test Name azure linux-2core-8gb azure-windows-latest-4core-16gb
🔄​ TestFsCpDir ✅​p 🔄​f
🔄​ TestFsCpDir/uc-volumes_to_uc-volumes ✅​p 🔄​f
🔄​ TestFsCpFileToDir 🔄​f ✅​p
🔄​ TestFsCpFileToDir/uc-volumes_to_dbfs 🔄​f ✅​p
Top 6 slowest tests (at least 2 minutes):
duration env testname
5:20 gcp-windows-latest-4core-16gb TestAccept
3:44 azure linux-2core-8gb TestAccept
3:41 gcp linux-2core-8gb TestAccept
3:41 aws linux-2core-8gb TestAccept
3:39 azure-windows-latest-4core-16gb TestAccept
3:38 aws-windows-latest-4core-16gb TestAccept

@github-actions github-actions Bot added the DABs DABs related issues label Oct 14, 2026
@shreyas-goenka
shreyas-goenka marked this pull request as ready for review October 14, 2026 13:19
@shreyas-goenka
shreyas-goenka requested review from a team as code owners October 14, 2026 13:19
Base automatically changed from shreyas-goenka_data/shreyas-goenka/dms-config-env-stack to main October 14, 2026 13:39
@shreyas-goenka
shreyas-goenka force-pushed the shreyas-goenka_data/shreyas-goenka/dms-serial-stack branch from 0934179 to 1b37103 Compare October 14, 2026 13:39
@shreyas-goenka
shreyas-goenka requested a review from denik October 14, 2026 14:07

# The service owns the version and the file persists no serial, so take it from the deployment.
# Rebuilt in header order, since the file has no serial key to overwrite in place.
# The file's serial is a copy of the DMS version to ensure outdated resource state is not read.

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does it show it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show what?

"state_version": 3,
"cli_version": "[CLI_VERSION]",
"lineage": "[UUID]",
"serial": 2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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

Comment thread acceptance/bundle/dms/stale-local-state/script Outdated
// VersionID is the DMS counterpart of Data.Serial - same meaning, but owned by the service
// rather than the file, so it lives outside Data and is never written to resources.json.
// VersionID is the service-owned counter for recorded deployments. A copy is stored in
// resources.json as Serial to ensure outdated resource state is not read.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not correct, right? It's only a copy first time, then number in resources.json stays behind.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet. In a followup.

Comment thread bundle/direct/dstate/state_test.go Outdated
{name: "legacy missing serial", omitSerial: true, deploymentID: "123", lastVersionID: 7},
{name: "legacy zero serial", deploymentID: "123", lastVersionID: 7},
{name: "cached serial behind service", cachedSerial: 2, deploymentID: "123", lastVersionID: 7},
{name: "cached serial ahead of service", cachedSerial: 99, deploymentID: "123", lastVersionID: 7},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not this error? resources.json with higher serial but dms feature set means there were multiple migrations and we're not using correct deployment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to error here? The remote is the source of truth. If for any reason local has a higher serial, it's corrupted. Even if we error all we could direct the user to do is to delete the corrupted local state file.

WDYT? Unless we should guide users here that you might want to delete the remote state?

In any case this is a rare enough edge case that would never happen.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbf, there is a scenario where the user might want to destroy their existing state? MAYBE? Lets just error - seems like the safest thing to do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an error

@shreyas-goenka
shreyas-goenka requested a review from denik October 15, 2026 16:02
Comment thread bundle/direct/dstate/state.go
Comment thread bundle/direct/dstate/state.go Outdated
Comment thread bundle/direct/dstate/state_test.go Outdated
lastVersionID int
wantErr string
}{
{name: "legacy missing serial", omitSerial: true, deploymentID: "123", lastVersionID: 7},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: field-per-line is more readable.

@shreyas-goenka
shreyas-goenka requested a review from denik October 16, 2026 11:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants