Conversation
…ongs to another live entity
Code Coverage Report
Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Two layers, because the store alone cannot tell an external rename from a copied id:
OccWriteSupport.checkOverwriteIdNotOwnedByOtherParent, used byTableMetaService,SchemaMetaServiceandTopicMetaServicewhenoverwrite = true: lock the row that owns the incoming id (FOR UPDATE) and throwEntityAlreadyExistsExceptionif it lives under another parent. This is the guardView/Function/Tagalready had. A same-parent match is still allowed — that is how an external rename is re-registered.TableOperationDispatcher/SchemaOperationDispatcher.checkImportedIdNotCopied: when an import finds an id that is already registered under another name in the same parent, ask the external catalog whether that owner still exists. If it does, the id was copied (CREATE TABLE t2 LIKE t1carriesTBLPROPERTIES): fail with aGravitinoRuntimeExceptionthat names both tables and the property to remove. If it does not, it was a rename: re-bind as before.Why are the changes needed?
importTabletrusts theStringIdentifierin the external properties and upserts by primary key, so a copied id renamed the existing row and moved its owner, tags, policies, role grants and statistics to the copy; the next load of the original moved them back. Cross-parent copies are now rejected in the store; same-parent copies are rejected in the dispatcher.Fix: #13173
Does this PR introduce any user-facing change?
Loading a table/schema whose properties carry another live table's
gravitino.identifiernow fails with an explanatory error instead of silently moving the original's metadata.How was this patch tested?
New tests:
testOverwriteRejectsIdOwnedBy*InAnother*andtestOverwriteRebindsIdWithinTheSameSchemain the table/schema/topic meta-service tests (H2, MySQL, PostgreSQL);testLoad*RejectsCopiedIdentifierWhileSourceStillExistsandtestLoad*RebindsIdentifierAfterExternalRenamein the table/schema dispatcher tests.