You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "paultanay (via GitHub)" <gi...@apache.org> on 2026/08/27 07:11:45 UTC

[PR] [#12639] refactor(core): Extract shared OCC helpers into OccWriteSupport [gravitino]

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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12639] refactor(core): Extract shared OCC helpers into OccWriteSupport [gravitino]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12666:
URL: https://github.com/apache/gravitino/pull/12666#issuecomment-5436622032

   <!-- coverage-report -->
   ### Code Coverage Report
   |Overall Project|68.55% **`+0.16%`**|:green_circle:|
   |:-|:-|:-:|
   |Files changed|86.61%|:green_circle:|
   <br>
   
   |Module|Coverage||
   |:-|:-|:-:|
   |aliyun|19.74%|:red_circle:|
   |api|52.87%|:green_circle:|
   |authorization-common|85.96%|:green_circle:|
   |authorization-ranger|4.38%|:red_circle:|
   |aws|53.54%|:green_circle:|
   |azure|32.1%|:red_circle:|
   |catalog-common|9.9%|:red_circle:|
   |catalog-fileset|80.17%|:green_circle:|
   |catalog-glue|69.24%|:green_circle:|
   |catalog-hive|82.96%|:green_circle:|
   |catalog-jdbc-common|45.69%|:green_circle:|
   |catalog-jdbc-doris|82.44%|:green_circle:|
   |catalog-jdbc-mysql|79.33%|:green_circle:|
   |catalog-jdbc-postgresql|83.39%|:green_circle:|
   |catalog-jdbc-starrocks|79.16%|:green_circle:|
   |catalog-kafka|76.99%|:green_circle:|
   |catalog-lakehouse-generic|60.55%|:green_circle:|
   |catalog-lakehouse-hudi|79.1%|:green_circle:|
   |catalog-lakehouse-iceberg|85.86%|:green_circle:|
   |catalog-lakehouse-paimon|84.26%|:green_circle:|
   |catalog-model|77.99%|:green_circle:|
   |cli|44.48%|:green_circle:|
   |client-java|78.16%|:green_circle:|
   |common|55.79%|:green_circle:|
   |core|83.83% **`+0.08%`**|:green_circle:|
   |filesystem-hadoop3|76.45%|:green_circle:|
   |flink|0.0%|:red_circle:|
   |flink-common|50.29%|:green_circle:|
   |flink-runtime|0.0%|:red_circle:|
   |gcp|32.2%|:red_circle:|
   |hadoop-auth|68.0%|:green_circle:|
   |hadoop-common|17.84%|:red_circle:|
   |hive-metastore-common|53.4%|:green_circle:|
   |iceberg-aliyun-bundle|0.0%|:red_circle:|
   |iceberg-common|64.75%|:green_circle:|
   |iceberg-rest-server|75.61%|:green_circle:|
   |idp-basic|85.98%|:green_circle:|
   |integration-test-common|0.0%|:red_circle:|
   |jobs|62.92%|:green_circle:|
   |lance-common|32.72%|:red_circle:|
   |lance-rest-server|64.78%|:green_circle:|
   |lineage|53.02%|:green_circle:|
   |optimizer|83.17%|:green_circle:|
   |optimizer-api|21.95%|:red_circle:|
   |server|88.04%|:green_circle:|
   |server-common|80.35%|:green_circle:|
   |spark|28.57%|:red_circle:|
   |spark-common|48.92%|:green_circle:|
   |tencent|69.84%|:green_circle:|
   |trino-connector|47.44%|:green_circle:|
   
   <details>
   <summary>Files</summary>
   
   |Module|File|Coverage||
   |:-|:-|:-|:-:|
   |core|[MetalakeMetaService.java](https://github.com/paultanay/gravitino/blob/8a0484af11120a8c60eff50a641eec42187e06b6/core/src/main/java/org/apache/gravitino/storage/relational/service/MetalakeMetaService.java)|100.0%|:green_circle:|
   ||[OccWriteSupport.java](https://github.com/paultanay/gravitino/blob/8a0484af11120a8c60eff50a641eec42187e06b6/core/src/main/java/org/apache/gravitino/storage/relational/service/OccWriteSupport.java)|100.0%|:green_circle:|
   ||[SchemaMetaService.java](https://github.com/paultanay/gravitino/blob/8a0484af11120a8c60eff50a641eec42187e06b6/core/src/main/java/org/apache/gravitino/storage/relational/service/SchemaMetaService.java)|99.56%|:green_circle:|
   ||[CatalogMetaService.java](https://github.com/paultanay/gravitino/blob/8a0484af11120a8c60eff50a641eec42187e06b6/core/src/main/java/org/apache/gravitino/storage/relational/service/CatalogMetaService.java)|98.18%|:green_circle:|
   ||[AuthorizationUtils.java](https://github.com/paultanay/gravitino/blob/8a0484af11120a8c60eff50a641eec42187e06b6/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java)|66.56%|:green_circle:|
   
   </details>


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12639] refactor(core): Extract shared OCC helpers into OccWriteSupport [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 merged PR #12666:
URL: https://github.com/apache/gravitino/pull/12666


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12639] refactor(core): Extract shared OCC helpers into OccWriteSupport [gravitino]

Posted by "paultanay (via GitHub)" <gi...@apache.org>.
paultanay commented on PR #12666:
URL: https://github.com/apache/gravitino/pull/12666#issuecomment-5478398450

   Thanks for the review @yuqi1129 ! I have migrated `TableMetaService. deleteTableWithVersion` and `TableMetaService.tableWriteFailure` to use `OccWriteSupport.deleteWithVersion` and `OccWriteSupport.writeFailure`. All relational service tests and spotless checks have passed cleanly.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12639] refactor(core): Extract shared OCC helpers into OccWriteSupport [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on PR #12666:
URL: https://github.com/apache/gravitino/pull/12666#issuecomment-5473147446

   Can you take time to resolve the comments? As other types are pushing to the main, I'm afraid more needs to be changed when those PRs are merged. 


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org