yuqi1129 opened a new issue, #13172: URL: https://github.com/apache/gravitino/issues/13172
### Describe the subtask On external-backed paths the store write resolves its target **after** the external call, so a version CAS that is correct for the row it reads can still hit the wrong row. **Drop / purge (E1).** `TableOperationDispatcher.dropTable`/`purgeTable` (and the schema, topic, view and function dispatchers) call the external drop first and, on `true`, call `store.delete(ident, TABLE)`. The meta service then reads whatever row currently sits under that name and deletes it with a CAS: ``` A: external drop(t) succeeds (old incarnation) A: pauses before store.delete B: creates a new external t; its registration lands in the store A: store.delete(t) reads the row now under t -> CAS passes -> the live registration and its attachments are gone ``` **Update (E2).** `OperationDispatcher.operateOnEntity` runs `store.update` first and only afterwards compares the returned id with the id read from the external catalog. For `UPDATE` the transaction may already have committed against a re-created table under the same name before the mismatch is detected. TreeLock hides both on one server; under HA they are reachable today. Proposed change: - Read the registration `(id, version)` before the external call. - Add `EntityStore.delete(ident, type, expectedId, expectedVersion)` and `EntityStore.update(ident, type, expectedId, updater)` (or equivalent) that fail with `OptimisticLockException` inside the service transaction when the row is not the observed one, before version, columns and relations move. A mismatched delete leaves the row for reconcile. - Use them from the table, schema, topic, view and function dispatchers; keep the `operateOnEntity` post-check only as a log. - Two-server tests: external drop/recreate ABA (the new registration and its owner/tag/policy/role rows survive); wrong-id alter (no mutation commits). Design: `design-docs/concurrency-control-implementation-design.md`, Part 1 (F5, F6). Gate G1. ### Parent issue https://github.com/apache/gravitino/issues/10238 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
