-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: concurrent ADD REGION, DROP REGION, (CREATE|ALTER) REGIONAL BY ROW combinations do not mix #63462
Comments
cc @arulajmani happy to do |
I think all but the last concern can be accounted for by re-partitioning all Regional By Row Tables even if the Type Schema Change job is rolled back. Concretely, consider the scenario:
Let's assume these operations are run concurrently. If Op2 is serialized before Op1, then Region A should still be PUBLIC. As such, we should be fine. You can extend this I'm still munching on the last point that pertains to validation. |
Partitioning validation -- I think we're being too strict here, trying to map out all possible scenarios when enum values are transitioning ( |
When altering to a regional by row table we only add partitions for PUBLIC enum values (regions). The type schema change job that negotiates promotion/demotion is responsible for re-partitioning regional by row tables. Previously, this re-partitioning only happened if the type schema change job succeeded. This behavior missed an edge case, which looks like: - Client 1 drops region A from the database. The user txn commits. - Client 2 alters table t to a RBR. - The drop region fails, and therefore rolls back. - table t is now missing a partition for region A. This patch fixes this problem by trigerring a re-partition even when the type schema change job is rolling back. Informs cockroachdb#63462 Release note (bug fix): Previously if a user altered a table to REGIONAL BY ROW when a region was being dropped, and the drop failed and had to be rolled back, it could have resulted in the Regional By Row table missing a partition for this region. This is now fixed and region drop failure rollbacks are sane.
When altering to a regional by row table we only add partitions for PUBLIC enum values (regions). The type schema change job that negotiates promotion/demotion is responsible for re-partitioning regional by row tables. Previously, this re-partitioning only happened if the type schema change job succeeded. This behavior missed an edge case, which looks like: - Client 1 drops region A from the database. The user txn commits. - Client 2 alters table t to a RBR. - The drop region fails, and therefore rolls back. - table t is now missing a partition for region A. This patch fixes this problem by trigerring a re-partition even when the type schema change job is rolling back. Informs cockroachdb#63462 Release note (bug fix): Previously if a user altered a table to REGIONAL BY ROW when a region was being dropped, and the drop failed and had to be rolled back, it could have resulted in the Regional By Row table missing a partition for this region. This is now fixed and region drop failure rollbacks are sane.
62683: optgen: add multi-variable bind expression r=mgartner a=mgartner This commit adds a new optgen expression syntax for binding multiple variables to the return values of a custom function. See the updated documentation in this commit for more details. Release note: None 63502: sql: remove transitioning regions from zone config validation r=arulajmani,ajstorm a=otan See individual commits for details. Refs: #63462 63544: sqlsmith: fix tests under bazel r=RaduBerinde a=otan It was missing the GEOS data dependency. Release note: None 63566: Added COPY FROM diagram to docgen r=ericharmeling a=ericharmeling Release justification: non-production code changes Release note: None Co-authored-by: Marcus Gartner <[email protected]> Co-authored-by: Oliver Tan <[email protected]> Co-authored-by: Eric Harmeling <[email protected]>
When altering to a regional by row table we only add partitions for PUBLIC enum values (regions). The type schema change job that negotiates promotion/demotion is responsible for re-partitioning regional by row tables. Previously, this re-partitioning only happened if the type schema change job succeeded. This behavior missed an edge case, which looks like: - Client 1 drops region A from the database. The user txn commits. - Client 2 alters table t to a RBR. - The drop region fails, and therefore rolls back. - table t is now missing a partition for region A. This patch fixes this problem by trigerring a re-partition even when the type schema change job is rolling back. Informs cockroachdb#63462 Release note (bug fix): Previously if a user altered a table to REGIONAL BY ROW when a region was being dropped, and the drop failed and had to be rolled back, it could have resulted in the Regional By Row table missing a partition for this region. This is now fixed and region drop failure rollbacks are sane.
When altering to a regional by row table we only add partitions for PUBLIC enum values (regions). The type schema change job that negotiates promotion/demotion is responsible for re-partitioning regional by row tables. Previously, this re-partitioning only happened if the type schema change job succeeded. This behavior missed an edge case, which looks like: - Client 1 drops region A from the database. The user txn commits. - Client 2 alters table t to a RBR. - The drop region fails, and therefore rolls back. - table t is now missing a partition for region A. This patch fixes this problem by trigerring a re-partition even when the type schema change job is rolling back. Informs cockroachdb#63462 Release note (bug fix): Previously if a user altered a table to REGIONAL BY ROW when a region was being dropped, and the drop failed and had to be rolled back, it could have resulted in the Regional By Row table missing a partition for this region. This is now fixed and region drop failure rollbacks are sane.
When altering to a regional by row table we only add partitions for PUBLIC enum values (regions). The type schema change job that negotiates promotion/demotion is responsible for re-partitioning regional by row tables. Previously, this re-partitioning only happened if the type schema change job succeeded. This behavior missed an edge case, which looks like: - Client 1 drops region A from the database. The user txn commits. - Client 2 alters table t to a RBR. - The drop region fails, and therefore rolls back. - table t is now missing a partition for region A. This patch fixes this problem by trigerring a re-partition even when the type schema change job is rolling back. Informs cockroachdb#63462 Release note (bug fix): Previously if a user altered a table to REGIONAL BY ROW when a region was being dropped, and the drop failed and had to be rolled back, it could have resulted in the Regional By Row table missing a partition for this region. This is now fixed and region drop failure rollbacks are sane.
Informs cockroachdb#63462 This patch adds TestRegionAddDropEnclosingRegionalByRowOps, which contains subtests with the following sketch: - Client 1 performs an ALTER ADD / DROP REGION. Let the user txn commit. - Block in the type schema changer. - Client 2 performs an operation on a REGIONAL BY ROW table, such as creating an index, unique constraint, altering the primary key etc. - Test both a rollback in the type schema changer and a successful execution. - Ensure the partitions on the REGIONAL BY ROW table are sane. Release note: None
Informs cockroachdb#63462 This patch adds TestRegionAddDropEnclosingRegionalByRowOps, which contains subtests with the following sketch: - Client 1 performs an ALTER ADD / DROP REGION. Let the user txn commit. - Block in the type schema changer. - Client 2 performs an operation on a REGIONAL BY ROW table, such as creating an index, unique constraint, altering the primary key etc. - Test both a rollback in the type schema changer and a successful execution. - Ensure the partitions on the REGIONAL BY ROW table are sane. Release note: None
When altering to a regional by row table we only add partitions for PUBLIC enum values (regions). The type schema change job that negotiates promotion/demotion is responsible for re-partitioning regional by row tables. Previously, this re-partitioning only happened if the type schema change job succeeded. This behavior missed an edge case, which looks like: - Client 1 drops region A from the database. The user txn commits. - Client 2 alters table t to a RBR. - The drop region fails, and therefore rolls back. - table t is now missing a partition for region A. This patch fixes this problem by trigerring a re-partition even when the type schema change job is rolling back. Informs cockroachdb#63462 Release note (bug fix): Previously if a user altered a table to REGIONAL BY ROW when a region was being dropped, and the drop failed and had to be rolled back, it could have resulted in the Regional By Row table missing a partition for this region. This is now fixed and region drop failure rollbacks are sane.
63804: sql: add more testing for concurrent region/rbr interactions r=otan a=arulajmani Informs #63462 This patch adds TestRegionAddDropEnclosingRegionalByRowOps, which contains subtests with the following sketch: - Client 1 performs an ALTER ADD / DROP REGION. Let the user txn commit. - Block in the type schema changer. - Client 2 performs an operation on a REGIONAL BY ROW table, such as creating an index, unique constraint, altering the primary key etc. - Test both a rollback in the type schema changer and a successful execution. - Ensure the partitions on the REGIONAL BY ROW table are sane. Release note: None 63843: jobs: skip flakey test that should be removed r=ajwerner a=ajwerner This tests seems to flake but exercises old code. It is scheduled for removal in #61417 which didn't make the 21.1 release. Touches #63842. Release note: None Co-authored-by: arulajmani <[email protected]> Co-authored-by: Andrew Werner <[email protected]>
Informs cockroachdb#63462 This patch adds TestRegionAddDropEnclosingRegionalByRowOps, which contains subtests with the following sketch: - Client 1 performs an ALTER ADD / DROP REGION. Let the user txn commit. - Block in the type schema changer. - Client 2 performs an operation on a REGIONAL BY ROW table, such as creating an index, unique constraint, altering the primary key etc. - Test both a rollback in the type schema changer and a successful execution. - Ensure the partitions on the REGIONAL BY ROW table are sane. Release note: None
Assume that a DROP REGION job fails. If we do not include regions that are being dropped in the SynthesizeRegionConfig during this state, a number of issues arise on REGIONAL BY ROW tables in their given callsites, such as:
I've tried taking the tack of including DROPPING regions for these operations here in the latter two commits, but unfortunately we hit the error that the enum is not PUBLIC on the repartition case.
We should probably block any REGIONAL BY ROW creating / altering behaviour if there is an ADD/DROP REGION underway (i.e. creating an index, unique constraint, create table ... regional by row, some already handled by #63368) and vice versa - this is the quickest and easiest way to unblock the release. Furthermore, it is probably worth prohibiting concurrent ADD/DROP regions as well - again to unblock the release.
The text was updated successfully, but these errors were encountered: