cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

rule: changed two dep rules

Open Xiang-Gu opened this issue 3 years ago • 1 comments
trafficstars

Commit 1: changed two existing dep rules slightly as to not cause any functional changes, but it's necessary for the next commit.

Commit 2: added a dep rule between the new primary index and the new secondary index in ADD COLUMN, which requires the new secondary index to become PUBLIC right before the new primary index becomes PUBLIC (i.e. the primary index swap).

Fixes #82953

Release note: None

Xiang-Gu avatar Sep 22 '22 18:09 Xiang-Gu

This change is Reviewable

cockroach-teamcity avatar Sep 22 '22 18:09 cockroach-teamcity

I didn't fully understand the fix in the previous iteration and came up with a dep rule that didn't actually solve the problem. That dep rule delays the primary index swap and column turning public to happen in the same stage as the new unique secondary index turning public. This is not right because we would never be able to backfill the new unique secondary index to begin with, because that new column is not present in the (old) primary index. The reason we had such a requirement is definitely not obvious: it's related to an assumption that the optimizer holds deeply in the code and it's not easy to change any time soon. See this slack discussion for more details with an example included there.

The alternative @ajwerner suggested is to mark the transition of the column element into public non-revertible. What this entails is that we would respect the requirement by swapping the primary index first while keeping the column in WRITE_ONLY. We then backfill the new unique secondary index. Finally, in the non-revertible phase, we transition the column and the new unique secondary index into public in the same stage.

Xiang-Gu avatar Oct 03 '22 16:10 Xiang-Gu

Whatever it takes. Regardless of this particular issue, I believe that making the column public a non-revertible op makes sense anyway. Go for it!

postamar avatar Oct 03 '22 17:10 postamar

The only failed test in CI is marked by TeamCity as "flaky", so I think it's RFAL!

Xiang-Gu avatar Oct 03 '22 17:10 Xiang-Gu

TFTR!

bors r+

Xiang-Gu avatar Oct 04 '22 21:10 Xiang-Gu

Build succeeded:

craig[bot] avatar Oct 04 '22 22:10 craig[bot]

blathers backport 22.2 22.2.0

Xiang-Gu avatar Oct 05 '22 17:10 Xiang-Gu

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 32b766a4bab1da2d5e9dd56db540797d8cee934d to blathers/backport-release-22.2-88489: 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 22.2 failed. See errors above.


error creating merge commit from 32b766a4bab1da2d5e9dd56db540797d8cee934d to blathers/backport-release-22.2.0-88489: 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 22.2.0 failed. See errors above.


:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

blathers-crl[bot] avatar Oct 05 '22 17:10 blathers-crl[bot]