yuqi1129 opened a new issue, #12651:
URL: https://github.com/apache/gravitino/issues/12651
### Describe the subtask
Implement database optimistic concurrency control (OCC) and atomic writes
for managed topics, following the behavior established for tables in #12345 /
#12551.
- Use `topic_meta.current_version` as the OCC token and increment it on
every successful alter. Keep `last_version` monotonic.
- Replace the full-row update comparison with `topic_id + expected
current_version + deleted_at = 0`.
- Make direct topic deletion version checked and execute the root CAS before
deleting ownership, securable objects, tags, statistics, and policies.
- Keep every database operation performed by one service API call in one
transaction. A failed CAS must leave no partial dependent changes.
- Use a locking read by stable topic ID to classify a zero-row CAS:
- the same topic still exists with a newer version ->
`OptimisticLockException`;
- the topic was deleted, renamed, or moved -> `NoSuchEntityException`.
- Fence the active parent schema during creation so a concurrent schema drop
cannot leave an active topic behind.
- Preserve monotonic versions on `put(overwrite=true)` instead of resetting
an existing topic to its initial version.
- No database migration is required because `current_version` and
`last_version` already exist.
Acceptance criteria:
- Concurrent alter/alter and alter/delete operations have exactly one winner.
- Change-then-change-back is detected through the version rather than
full-row equality.
- Stale deletes cannot remove relationships belonging to a newer topic.
- Rename/delete races are classified as not found; same-identity version
races are classified as OCC conflicts.
- SQL-provider and service tests cover H2, MySQL, and PostgreSQL behavior.
Depends on #12341.
References: #12345, #12551, #12597.
### Parent issue
https://github.com/apache/gravitino/issues/12166
--
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]