paultanay opened a new pull request, #12666: URL: https://github.com/apache/gravitino/pull/12666
### What changes were proposed in this pull request? Introduce `OccWriteSupport`, a utility class with four static generic helpers that cover the OCC patterns duplicated across relational meta services: - `writeFailure` - locking reread by id, compare natural-key fields, return `NoSuchEntityException` or `OptimisticLockException` - `deleteWithVersion` - single-row CAS soft delete guarded by version - `deleteChildrenWithVersions` - batch CAS soft delete of children, fail-fast on count mismatch - `lockParentForChildWrite` - shared/exclusive parent row lock before a child write or delete Migrate `MetalakeMetaService`, `CatalogMetaService`, and `SchemaMetaService` to the shared helpers. No behavior change. ### Why are the changes needed? Each OCC PR copied the previous service's helpers. A future change to classification rules (extra field, different lock semantics) or a new entity type would need the same edit in four places. Fix: #12639 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Added `TestOccWriteSupport` (11 tests covering all helpers and edge cases). Ran the full relational service test suite: `./gradlew :core:test --tests "org.apache.gravitino.storage.relational.service.*" -PskipDockerTests=true` - 266 tests, 0 failures. -- 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]
