Skip to content
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

sql: Check for concurrent DSC job in legacy schema changer #137868

Conversation

spilchen
Copy link
Contributor

@spilchen spilchen commented Dec 20, 2024

Running the legacy schema changer and the declarative schema changer concurrently can cause issues due to their different approaches to updating descriptors. Normally we have checks to prevent the legacy schema changer from running in such scenarios, timing issues persisted—particularly between ALTER VIEW .. RENAME (legacy) and DROP VIEW (DSC). In these cases, the view rename could delete the descriptor being processed by the drop view operation.

This change addresses the timing issue by adding a check for an active DSC job at the start of the legacy schema changer job. With this fix, the issue could no longer be reproduced, whereas it was consistently reproducible before.

Epic: none
Closes: #137487
Closes: #137828
Release note (bug fix): Fixed a timing issue between ALTER VIEW .. RENAME and DROP VIEW that caused repeated failures in the DROP VIEW job.

@spilchen spilchen self-assigned this Dec 20, 2024
@spilchen spilchen requested a review from a team as a code owner December 20, 2024 21:04
Copy link

blathers-crl bot commented Dec 20, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rafiss rafiss added backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3 labels Dec 20, 2024
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

nice investigation!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @spilchen)

Running the legacy schema changer and the declarative schema changer
concurrently can cause issues due to their different approaches to
updating descriptors. Normally we have checks to prevent the legacy
schema changer from running in such scenarios, timing issues
persisted—particularly between `ALTER VIEW .. RENAME` (legacy) and `DROP
VIEW` (DSC). In these cases, the view rename could delete the descriptor
being processed by the drop view operation.

This change addresses the timing issue by adding a check for an active
DSC job at the start of the legacy schema changer job. With this fix,
the issue could no longer be reproduced, whereas it was consistently
reproducible before.

Epic: none
Closes: cockroachdb#137487
Release note (bug fix): Fixed a timing issue between `ALTER VIEW ..
RENAME` and `DROP VIEW` that caused repeated failures in the `DROP VIEW`
job.
@spilchen spilchen force-pushed the gh-137487/241220/1654/check-for-dsc-in-legacy branch from 37beafc to 53ee43c Compare December 21, 2024 01:31
@spilchen
Copy link
Contributor Author

TFTR!

bors r+

Copy link

blathers-crl bot commented Dec 21, 2024

Based on the specified backports for this PR, I applied new labels to the following linked issue(s). Please adjust the labels as needed to match the branches actually affected by the issue(s), including adding any known older branches.


Issue #137487: branch-release-24.1, branch-release-24.2, branch-release-24.3.


Issue #137828: branch-release-23.2, branch-release-24.1, branch-release-24.2, branch-release-24.3.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link

blathers-crl bot commented Dec 21, 2024

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 53ee43c to blathers/backport-release-23.2-137868: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3
Projects
None yet
3 participants