yuqi1129 opened a new pull request, #14790: URL: https://github.com/apache/gravitino/pull/14790
### What changes were proposed in this pull request? On PostgreSQL, retiring an owner row now sets `deleted_at` to the larger of the current time and one more than the newest retired row of that object. This applies to `setOwner` and `setOwners`. No schema change. ### Why are the changes needed? PostgreSQL's `CURRENT_TIMESTAMP` is the transaction start time. Owner changes that start in the same millisecond can repeat a retired row, break the `owner_meta` unique key, and return HTTP 500. Owner writes on one object are already serialized by its row lock, so reading the newest retired row cannot race another owner change. Fixes #14753 ### Does this PR introduce _any_ user-facing change? Fast owner changes on one object no longer fail with a duplicate key error. Known limits: - Only the PostgreSQL owner change path changes. MySQL and H2 are not changed. - Other soft deletes that write the time into a unique key are not changed. ### How was this patch tested? - Added `testRetiredOwnerRowsAlwaysGetANewerDeletedAt`, which fails on PostgreSQL without the fix. - `TestOwnerAssignmentWrites` and `TestOwnerMetaService` pass on H2, MySQL and PostgreSQL. - Real server on PostgreSQL with 8 clients alternating the owner of one model. Before: 28 of 1600 requests returned 500. After: all 3200 returned 200. -- 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]
