yuqi1129 opened a new issue, #12650:
URL: https://github.com/apache/gravitino/issues/12650
### Describe the subtask
Implement database optimistic concurrency control (OCC) and atomic writes
for managed filesets, following the transaction ordering and conflict
classification established for tables in #12345 / #12551.
- Use `fileset_meta.current_version` as the OCC token and advance it on
every successful alter.
- Write a complete `fileset_version_info` snapshot for every alter,
including metadata-only changes, so the row referenced by `current_version`
always exists. Keep `last_version` monotonic.
- Replace the full-row update comparison with `fileset_id + expected
current_version + deleted_at = 0`.
- Execute the fileset-meta CAS before inserting version rows or changing
dependent data. Keep all writes from one service call in the same transaction.
- Make direct fileset deletion version checked. Delete the root row before
versions, ownership, securable objects, tags, statistics, and policies.
- Use a locking read by stable fileset ID to classify a zero-row CAS:
- the same fileset still exists with a newer version ->
`OptimisticLockException`;
- the fileset was deleted, renamed, or moved -> `NoSuchEntityException`.
- Fence the active parent schema during creation so a concurrent schema drop
cannot leave an active fileset behind.
- Preserve monotonic versions on `put(overwrite=true)` instead of resetting
an existing fileset to its initial version.
- No database migration is required because the OCC columns already exist.
Acceptance criteria:
- Concurrent alter/alter and alter/delete operations have exactly one winner.
- A stale write leaves no partial fileset-version or relationship rows.
- Metadata-only changes also advance the OCC token.
- 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]