yuqi1129 opened a new issue, #12652:
URL: https://github.com/apache/gravitino/issues/12652
### Describe the subtask
Complete database optimistic concurrency control (OCC) and atomic writes for
managed functions, following the transaction ordering and conflict
classification established for tables in #12345 / #12551.
- Use `function_meta.function_current_version` as the OCC token and keep
`function_latest_version` monotonic.
- Replace the full-row update comparison with `function_id + expected
function_current_version + deleted_at = 0`.
- Execute the function-meta CAS before inserting an unguarded
`function_version_info` row. Keep the metadata row and version row in the same
transaction.
- Make direct function deletion version checked. Delete the root row before
function versions, ownership, securable objects, tags, and other dependent rows.
- Use a locking read by stable function ID to classify a zero-row CAS:
- the same function still exists with a newer version ->
`OptimisticLockException`;
- the function was deleted, renamed, or moved -> `NoSuchEntityException`.
- Retain the parent-schema fence for function creation and ensure it is in
the same transaction as the metadata and initial-version inserts.
- Preserve monotonic versions on `put(overwrite=true)` instead of resetting
an existing function to its initial version.
- No database migration is required because the function version columns
already exist.
Acceptance criteria:
- Concurrent function alters cannot insert competing rows for the same next
version.
- A failed CAS rolls back the new function-version row and every dependent
change.
- A stale delete cannot remove versions or relationships belonging to a
newer function.
- 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]