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/schemachanger: ensure dropping descriptors are not taken OFFLINE #86626

Closed
ajwerner opened this issue Aug 23, 2022 · 0 comments · Fixed by #86639
Closed

sql/schemachanger: ensure dropping descriptors are not taken OFFLINE #86626

ajwerner opened this issue Aug 23, 2022 · 0 comments · Fixed by #86639
Assignees
Labels
branch-release-22.2 Used to mark GA and release blockers, technical advisories, and bugs for 22.2 C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@ajwerner
Copy link
Contributor

ajwerner commented Aug 23, 2022

Describe the problem

In #83915 we moved descriptors to transition through OFFLINE before being dropped. This was done for two reasons:

  1. To enable us to drop descriptors in the same transaction where something which might fail occurs
  2. To fix a bug in the existing TXN_DROPPED state whereby virtual tables would see descriptors which should not be seen.

Note that TXN_DROPPED did not preclude (1). The problem with OFFLINE is that it is not backwards compatible, and the removal of TXN_DROPPED is not forwards compatible.

Jira issue: CRDB-18846

@ajwerner ajwerner added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. branch-release-22.2 Used to mark GA and release blockers, technical advisories, and bugs for 22.2 labels Aug 23, 2022
@ajwerner ajwerner self-assigned this Aug 23, 2022
@blathers-crl blathers-crl bot added the T-sql-schema-deprecated Use T-sql-foundations instead label Aug 23, 2022
Xiang-Gu pushed a commit to Xiang-Gu/cockroach that referenced this issue Aug 26, 2022
We added the `OFFLINE` and performed write operations during drops to move the
descriptor into that state in order to deal with the fact that synthetically
dropped descriptors would not appear so in virtual tables. Fortunately, this
shortcoming has been rectified. We now revive the TXN_DROPPED state. This
proves to be important because the `OFFLINE` state is not backwards compatible,
and the `TXN_DROPPED` state is. Ideally we'd find a way to move the descriptors
straight to `DROPPED` in the pre-commit case for all the cases we today
support, but doing that would require an overhaul of the dependency rules
which,at this point in the cycle, feels risky.

Fixes cockroachdb#86626

Release justification: Fixes a release-blocking backwards incompatibility.

Release note: None
Xiang-Gu pushed a commit to Xiang-Gu/cockroach that referenced this issue Aug 26, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
Xiang-Gu pushed a commit to ajwerner/cockroach that referenced this issue Aug 29, 2022
We added the `OFFLINE` and performed write operations during drops to move the
descriptor into that state in order to deal with the fact that synthetically
dropped descriptors would not appear so in virtual tables. Fortunately, this
shortcoming has been rectified. We now revive the TXN_DROPPED state. This
proves to be important because the `OFFLINE` state is not backwards compatible,
and the `TXN_DROPPED` state is. Ideally we'd find a way to move the descriptors
straight to `DROPPED` in the pre-commit case for all the cases we today
support, but doing that would require an overhaul of the dependency rules
which,at this point in the cycle, feels risky.

Fixes cockroachdb#86626

Release justification: Fixes a release-blocking backwards incompatibility.

Release note: None
Xiang-Gu pushed a commit to ajwerner/cockroach that referenced this issue Aug 29, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
ajwerner added a commit to ajwerner/cockroach that referenced this issue Aug 30, 2022
We added the `OFFLINE` and performed write operations during drops to move the
descriptor into that state in order to deal with the fact that synthetically
dropped descriptors would not appear so in virtual tables. Fortunately, this
shortcoming has been rectified. We now revive the TXN_DROPPED state. This
proves to be important because the `OFFLINE` state is not backwards compatible,
and the `TXN_DROPPED` state is. Ideally we'd find a way to move the descriptors
straight to `DROPPED` in the pre-commit case for all the cases we today
support, but doing that would require an overhaul of the dependency rules
which,at this point in the cycle, feels risky.

Fixes cockroachdb#86626

Release justification: Fixes a release-blocking backwards incompatibility.

Release note: None
ajwerner added a commit to ajwerner/cockroach that referenced this issue Aug 30, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
Xiang-Gu pushed a commit to Xiang-Gu/cockroach that referenced this issue Aug 31, 2022
We added the `OFFLINE` and performed write operations during drops to move the
descriptor into that state in order to deal with the fact that synthetically
dropped descriptors would not appear so in virtual tables. Fortunately, this
shortcoming has been rectified. We now revive the TXN_DROPPED state. This
proves to be important because the `OFFLINE` state is not backwards compatible,
and the `TXN_DROPPED` state is. Ideally we'd find a way to move the descriptors
straight to `DROPPED` in the pre-commit case for all the cases we today
support, but doing that would require an overhaul of the dependency rules
which,at this point in the cycle, feels risky.

Fixes cockroachdb#86626

Release justification: Fixes a release-blocking backwards incompatibility.

Release note: None
Xiang-Gu pushed a commit to Xiang-Gu/cockroach that referenced this issue Aug 31, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
postamar pushed a commit to postamar/cockroach that referenced this issue Aug 31, 2022
We added the `OFFLINE` and performed write operations during drops to move the
descriptor into that state in order to deal with the fact that synthetically
dropped descriptors would not appear so in virtual tables. Fortunately, this
shortcoming has been rectified. We now revive the TXN_DROPPED state. This
proves to be important because the `OFFLINE` state is not backwards compatible,
and the `TXN_DROPPED` state is. Ideally we'd find a way to move the descriptors
straight to `DROPPED` in the pre-commit case for all the cases we today
support, but doing that would require an overhaul of the dependency rules
which,at this point in the cycle, feels risky.

Fixes cockroachdb#86626

Release justification: Fixes a release-blocking backwards incompatibility.

Release note: None
postamar pushed a commit to postamar/cockroach that referenced this issue Aug 31, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
postamar pushed a commit to postamar/cockroach that referenced this issue Sep 1, 2022
We added the `OFFLINE` and performed write operations during drops to move the
descriptor into that state in order to deal with the fact that synthetically
dropped descriptors would not appear so in virtual tables. Fortunately, this
shortcoming has been rectified. We now revive the TXN_DROPPED state. This
proves to be important because the `OFFLINE` state is not backwards compatible,
and the `TXN_DROPPED` state is. Ideally we'd find a way to move the descriptors
straight to `DROPPED` in the pre-commit case for all the cases we today
support, but doing that would require an overhaul of the dependency rules
which,at this point in the cycle, feels risky.

Fixes cockroachdb#86626

Release justification: Fixes a release-blocking backwards incompatibility.

Release note: None
postamar pushed a commit to postamar/cockroach that referenced this issue Sep 1, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
ajwerner added a commit to ajwerner/cockroach that referenced this issue Sep 1, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
ajwerner added a commit to ajwerner/cockroach that referenced this issue Sep 1, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
ajwerner added a commit to ajwerner/cockroach that referenced this issue Sep 1, 2022
…ules

Previously we had implicit rules in opgen which were used to enforce
sequencing between transitions. This was brittle and made it hard to
collapse certain edges. Now that we can represent a not-join, we can
add the rules we want selectively, only when descriptors are not being
dropped.

Fixes cockroachdb#86691
Fixes cockroachdb#86626

Release justification: fixes a bug

Release note: None
craig bot pushed a commit that referenced this issue Sep 1, 2022
86639: sql/schemachanger: add back TXN_DROPPED, stop using OFFLINE r=postamar a=ajwerner

The first two commits enable synthetic descriptors to be used during transaction
execution to influence the virtual tables.

We added the `OFFLINE` and performed write operations during drops to move the
descriptor into that state in order to deal with the fact that synthetically
dropped descriptors would not appear so in virtual tables. Fortunately, this
shortcoming has been rectified. We now revive the TXN_DROPPED state. This
proves to be important because the `OFFLINE` state is not backwards compatible,
and the `TXN_DROPPED` state is. Ideally we'd find a way to move the descriptors
straight to `DROPPED` in the pre-commit case for all the cases we today support,
but doing that would require an overhaul of the dependency rules which, at this
point in the cycle, feels risky.

Fixes #86626

Release justification: Fixes a release-blocking backwards incompatibility.

Release note: None

87151: sql: plumb isCopy down to event log r=rafiss a=otan

Previously, we relied on the `txn` being filled to log `COPY`
statements. This is however inaccurate - `txn` may be nil if `COPY` is
the first statement encountered. This meant that the first COPY
encountered would not be logged.

Instead, plumb down `isCopy` and use `timeutil.Now()` if it is a COPY
related statement.

Release justification: logging related critical fix

Release note: None

87175: sql: fix COPY internal error in optimizer r=cucaroach a=cucaroach

Statistics builder code to evaluate distinct count had a typo and would
crash if there were more rows than columns.  Fix bug and rewrite to be a
little clearer.

Fixes: #87011

Release justification: low-risk high priority fix to new funcationality
Release note: None


Co-authored-by: Andrew Werner <[email protected]>
Co-authored-by: Oliver Tan <[email protected]>
Co-authored-by: Tommy Reilly <[email protected]>
@craig craig bot closed this as completed in c302570 Sep 1, 2022
@exalate-issue-sync exalate-issue-sync bot added T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) and removed T-sql-schema-deprecated Use T-sql-foundations instead labels May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-release-22.2 Used to mark GA and release blockers, technical advisories, and bugs for 22.2 C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant