[#11040] fix(core): make Iceberg import idempotent under concurrent load#11041
Open
yuqi1129 wants to merge 3 commits into
Open
[#11040] fix(core): make Iceberg import idempotent under concurrent load#11041yuqi1129 wants to merge 3 commits into
yuqi1129 wants to merge 3 commits into
Conversation
Code Coverage Report
Files
|
21649a4 to
1e99961
Compare
…x sites Reviewers had no inline context for what the new catch block / reconcile call is solving. Add short comments at each modified spot pointing at the multi-node race the change is addressing: - SchemaOperationDispatcher / TableOperationDispatcher: explain the HA import race that turns EntityAlreadyExistsException into a no-op instead of a "managed by multiple catalogs" failure. - IcebergTableHookDispatcher / IcebergViewHookDispatcher: explain why drop and rename reconcile against the Iceberg backend now that TreeLock is only process-local. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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?
Make Iceberg schema and table import idempotent when multiple Gravitino nodes try to import the same object concurrently. If
EntityStore.put(..., true)reports that the entity already exists, the dispatcher now reuses the existing Gravitino entity instead of failing the request.Also reconcile Gravitino
EntityStoremetadata after Iceberg REST Catalog table/viewdropandrenameoperations. After the Iceberg backend operation succeeds, the hook checks the current backend state and then either imports the table/view again or removes the stale Gravitino entity.Why are the changes needed?
In HA deployments, another node can finish the same import first. The current code treats that race as an error, even though the entity is already present in Gravitino. That makes already-existing schema/table imports fail spuriously.
Iceberg REST requests can also be served by different Gravitino nodes. Because the current TreeLock is process-local, another node may drop or recreate the same Iceberg table/view between the backend operation and the hook's direct
EntityStoreupdate/delete. Without reconciliation, Gravitino may keep stale/orphan table or view metadata that no longer matches the Iceberg backend. This PR does not introduce a distributed TreeLock; it adds a lightweight backend-state reconciliation step for the high-risk IRC rename/drop paths.Fix: #11040
Does this PR introduce any user-facing change?
Yes. Concurrent import/load requests become idempotent instead of failing with
EntityAlreadyExistsExceptionin the import path. IRC table/view rename and drop operations also reduce stale/orphan Gravitino metadata in multi-node deployments by reconciling against the Iceberg backend state.How was this patch tested?
./gradlew :core:test --tests org.apache.gravitino.catalog.TestTableOperationDispatcher --tests org.apache.gravitino.catalog.TestSchemaOperationDispatcher -PskipITs./gradlew :iceberg:iceberg-rest-server:test --tests org.apache.gravitino.iceberg.service.dispatcher.TestIcebergTableHookDispatcher --tests org.apache.gravitino.iceberg.service.dispatcher.TestIcebergViewHookDispatcher -PskipITs