-
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
importccl: fail imports on concurrent type changes less aggressively #69706
Comments
Do we need to store the set of type descriptors explicitly? The table descriptors know which type descriptors they reference.
What do you mean that the modification time does not change? Generally, I don't get this one. Don't we end up forbidding the type from being dropped because the importing descriptor references the type? |
For IMPORT INTO to support default + computed columns referencing UDTs we will be adding a custom type resolver that will be used during import execution. This type resolver will be backed by this set of cached type descriptors, and so I thought it necessary to store the descriptors instead of just the
Yes, we do, so the import job is unaffected. What I was trying to get at was that while |
It's not a bad idea. Otherwise you'd need to go read the historical descriptors. Makes sense.
Got it, so can we check off the first box?
This seems tricky. |
Adding @arulajmani's comment about why I think it's because the OFFLINE error that you're expecting comes from the async portion of the schema change. The user transaction moves the enum member from PUBLIC to READ ONLY which results in an update to the modification time. The error you're expecting happens when we validate the enum member usages -- we can't for this table because it is offline. Validation fails and the enum member is transitioned back to PUBLIC from READ ONLY, resulting in another update to the modification time. |
We have decided that this is very low priority. There is quite a bit of work to unify import and sql #67076. There's also quite a bit of work to fix up types. This is an edge case for import. |
In cockroachdb#69674 we enabled importing of tables which used UDTs. We added the caveat that these types must not change during the import. In cockroachdb#70987, @ajstorm uncovered that adding new usages of the type cause an illegal change. This is a particularly painful limitation as all regional by row tables will use the enum type of the database. That makes the limitation of import much more extreme than just precluding renames or modifications of enums or their members. To fix this limitation, we permit changes to the referencing set which occur during the import. We also permit changes to privileges as they won't impact the correctness of the import. Relates to cockroachdb#69706 Fixes cockroachdb#70987 Release note (enterprise change): Fixed a limitation of IMPORT for tables using user-defined types whereby any change to the set of tables or views which reference the type or any changes to privileges on the type during the IMPORT would lead to failure. Now new references to the type or GRANT or REVOKE operations performed while the IMPORT is ongoing will not cause failure.
In cockroachdb#69674 we enabled importing of tables which used UDTs. We added the caveat that these types must not change during the import. In cockroachdb#70987, @ajstorm uncovered that adding new usages of the type cause an illegal change. This is a particularly painful limitation as all regional by row tables will use the enum type of the database. That makes the limitation of import much more extreme than just precluding renames or modifications of enums or their members. To fix this limitation, we permit changes to the referencing set which occur during the import. We also permit changes to privileges as they won't impact the correctness of the import. Relates to cockroachdb#69706 Fixes cockroachdb#70987 Release note (enterprise change): Fixed a limitation of IMPORT for tables using user-defined types whereby any change to the set of tables or views which reference the type or any changes to privileges on the type during the IMPORT would lead to failure. Now new references to the type or GRANT or REVOKE operations performed while the IMPORT is ongoing will not cause failure.
In cockroachdb#69674 we enabled importing of tables which used UDTs. We added the caveat that these types must not change during the import. In cockroachdb#70987, @ajstorm uncovered that adding new usages of the type cause an illegal change. This is a particularly painful limitation as all regional by row tables will use the enum type of the database. That makes the limitation of import much more extreme than just precluding renames or modifications of enums or their members. To fix this limitation, we permit changes to the referencing set which occur during the import. We also permit changes to privileges as they won't impact the correctness of the import. Relates to cockroachdb#69706 Fixes cockroachdb#70987 Release note (enterprise change): Fixed a limitation of IMPORT for tables using user-defined types whereby any change to the set of tables or views which reference the type or any changes to privileges on the type during the IMPORT would lead to failure. Now new references to the type or GRANT or REVOKE operations performed while the IMPORT is ongoing will not cause failure.
In cockroachdb#69674 we enabled importing of tables which used UDTs. We added the caveat that these types must not change during the import. In cockroachdb#70987, @ajstorm uncovered that adding new usages of the type cause an illegal change. This is a particularly painful limitation as all regional by row tables will use the enum type of the database. That makes the limitation of import much more extreme than just precluding renames or modifications of enums or their members. To fix this limitation, we permit changes to the referencing set which occur during the import. We also permit changes to privileges as they won't impact the correctness of the import. Relates to cockroachdb#69706 Fixes cockroachdb#70987 Release note (enterprise change): Fixed a limitation of IMPORT for tables using user-defined types whereby any change to the set of tables or views which reference the type or any changes to privileges on the type during the IMPORT would lead to failure. Now new references to the type or GRANT or REVOKE operations performed while the IMPORT is ongoing will not cause failure.
71016: importccl: allow changes to referencing set or privileges on UDT r=ajwerner a=ajwerner In #69674 we enabled importing of tables which used UDTs. We added the caveat that these types must not change during the import. In #70987, @ajstorm uncovered that adding new usages of the type cause an illegal change. This is a particularly painful limitation as all regional by row tables will use the enum type of the database. That makes the limitation of import much more extreme than just precluding renames or modifications of enums or their members. To fix this limitation, we permit changes to the referencing set which occur during the import. We also permit changes to privileges as they won't impact the correctness of the import. Relates to #69706 Fixes #70987 Release note (enterprise change): Fixed a limitation of IMPORT for tables using user-defined types whereby any change to the set of tables or views which reference the type or any changes to privileges on the type during the IMPORT would lead to failure. Now new references to the type or GRANT or REVOKE operations performed while the IMPORT is ongoing will not cause failure. 71121: colexec: take advantage of partial ordering in the hash aggregator r=rharding6373 a=rharding6373 This change consists of two commits. The first adds test coverage for aggregation with partial ordering of group columns, including adding a new microbenchmark. The second adds support for partial ordering in the hash aggregator. Results from both the new benchmark, HashAggregatorPartialOrder, and existing hash aggregator benchmarks show improved performance for the partial order case for lower limit values, and no performance degradation for the unordered case: https://gist.github.com/rharding6373/09eface5ed49a00aac540a8ea8304662 This change is fairly large, so I will follow this PR with an update to the optimizer cost model to take advantage of partial ordering. 71420: roachtest/hibernate: fix failing test r=rafiss a=otan Resolves #71312 Release note: None Co-authored-by: Andrew Werner <[email protected]> Co-authored-by: rharding6373 <[email protected]> Co-authored-by: Oliver Tan <[email protected]>
In #69674 we enabled importing of tables which used UDTs. We added the caveat that these types must not change during the import. In #70987, @ajstorm uncovered that adding new usages of the type cause an illegal change. This is a particularly painful limitation as all regional by row tables will use the enum type of the database. That makes the limitation of import much more extreme than just precluding renames or modifications of enums or their members. To fix this limitation, we permit changes to the referencing set which occur during the import. We also permit changes to privileges as they won't impact the correctness of the import. Relates to #69706 Fixes #70987 Release note (enterprise change): Fixed a limitation of IMPORT for tables using user-defined types whereby any change to the set of tables or views which reference the type or any changes to privileges on the type during the IMPORT would lead to failure. Now new references to the type or GRANT or REVOKE operations performed while the IMPORT is ongoing will not cause failure.
Following #69674, an import into job will store the set of type descriptors referenced by the table being imported into during planning. On completion, the import job will check that the modification time on the saved type descriptors is equal to that on the type descriptors that are looked up. If there is a mismatch, it means that there was a concurrent type change during the import, and so we fail the import job. The method performing this check is called
checkForUDTModification
.This check is probably too aggressive and risks failing an import at the last stage unnecessarily. The semantics of which concurrent type changes are safe during an import is still to be ironed out. Once that is done, this method can be refined to only check for the occurrence of the unsafe type changes and fail the import job. Some of the discussions around classes of type changes are listed below:
DROP TYPE
: We forbid a type from being dropped if there is a table referencing it. This does not change the modification time on the descriptor and so the import job will succeed today.ALTER TYPE DROP VALUE
: We forbid an enum value from being dropped if a table referencing it is being imported into. The methodcanRemoveEnumValue
validates all tables referencing the type and fails withcould not validate enum value removal for "hi": relation "t" is offline: importing
. This type change however changes the modification time prior to hitting the above error, and thus fails the import job today.ALTER TYPE ADD VALUE
: Adding a value to an enum being imported into should probably be safe. Today it will fail the import job since the modification time changes.ALTER TYPE RENAME VALUE
: Semantics to be thought through.ALTER TYPE RENAME TO
: Semantics to be thought through.Jira issue: CRDB-9734
The text was updated successfully, but these errors were encountered: