Skip to content

[#12901] fix(authz): Keep preloadOwner best-effort when GravitinoEnv is uninitialized - #12869

Open
laserninja wants to merge 1 commit into
apache:mainfrom
laserninja:fix/authz-preload-owner-best-effort
Open

[#12901] fix(authz): Keep preloadOwner best-effort when GravitinoEnv is uninitialized#12869
laserninja wants to merge 1 commit into
apache:mainfrom
laserninja:fix/authz-preload-owner-best-effort

Conversation

@laserninja

@laserninja laserninja commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

What changes were proposed in this pull request?

Move the entity-store lookup in MetadataAuthzHelper.preloadOwner inside its existing try block.

Why are the changes needed?

preloadOwner is a best-effort cache warm-up - its catch (Exception e) logs and ignores any failure. But GravitinoEnv.getInstance().entityStore() was called outside the try, and that method throws IllegalArgumentException("GravitinoEnv is not initialized."). The exception therefore escaped the warm-up, propagated out of filterByExpression, and failed the entire list request with a 400.

This already breaks three tests in server, which return 400 instead of 200:

Failed to operate tag(s) operation [LIST] under object [...], reason [GravitinoEnv is not initialized.]
  at org.apache.gravitino.GravitinoEnv.entityStore(GravitinoEnv.java:261)
  at org.apache.gravitino.server.authorization.MetadataAuthzHelper.preloadOwner(MetadataAuthzHelper.java:552)
  at org.apache.gravitino.server.authorization.MetadataAuthzHelper.filterByExpression(MetadataAuthzHelper.java:364)

Fix: #12901

Does this PR introduce any user-facing change?

No.

How was this patch tested?

./gradlew :server:test :server-common:test -PskipITs

:server:test goes from 3 failures to 0 (323 tests). TestMetadataObjectTagOperations#testListTagsForObject, #testListTagsForObjectUnderHierarchicalSchema, and #testListTagsDeduplicatesDifferentAssignmentValues pass again.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Code Coverage Report

Overall Project 69.28% +0.08% 🟢
Files changed 79.29% 🟢

Module Coverage
aliyun 19.74% 🔴
api 51.57% 🟢
authorization-common 85.96% 🟢
authorization-ranger 4.38% 🔴
aws 53.54% 🟢
azure 32.1% 🔴
catalog-common 20.87% 🔴
catalog-fileset 82.17% 🟢
catalog-glue 69.24% 🟢
catalog-hive 82.96% 🟢
catalog-jdbc-common 45.69% 🟢
catalog-jdbc-doris 82.69% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-postgresql 83.39% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 76.99% 🟢
catalog-lakehouse-generic 60.55% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.86% 🟢
catalog-lakehouse-paimon 84.29% 🟢
catalog-model 77.99% 🟢
cli 44.51% 🟢
client-java 77.5% 🟢
common 56.34% 🟢
core 83.91% 🟢
filesystem-hadoop3 76.48% 🟢
flink 0.0% 🔴
flink-common 52.1% 🟢
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 17.84% 🔴
hive-metastore-common 53.4% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 64.76% 🟢
iceberg-rest-server 75.96% +1.32% 🟢
idp-basic 86.42% 🟢
integration-test-common 0.0% 🔴
jobs 62.92% 🟢
lance-common 32.52% 🔴
lance-rest-server 68.15% 🟢
lineage 53.02% 🟢
optimizer 83.17% 🟢
optimizer-api 21.95% 🔴
server 89.77% 🟢
server-common 80.67% -1.1% 🟢
spark 28.57% 🔴
spark-common 52.04% 🟢
tencent 81.78% 🟢
trino-connector 57.5% 🟢
Files
Module File Coverage
iceberg-rest-server IcebergConfigOperations.java 96.43% 🟢
FederatedCatalogWrapper.java 87.01% 🟢
CatalogWrapperForREST.java 78.74% 🟢
server-common MetadataAuthzHelper.java 65.33% 🟢

…noEnv is uninitialized

MetadataAuthzHelper.preloadOwner resolved the entity store outside its
try block. GravitinoEnv.entityStore() throws IllegalArgumentException
when the environment is not initialized, so that exception escaped a
warm-up whose failure is meant to be ignored, and it failed the whole
list request.
@laserninja
laserninja force-pushed the fix/authz-preload-owner-best-effort branch from b30c958 to d716586 Compare September 3, 2026 16:37
@laserninja laserninja changed the title [MINOR] fix(authz): Keep preloadOwner best-effort when GravitinoEnv is uninitialized [#12901] fix(authz): Keep preloadOwner best-effort when GravitinoEnv is uninitialized Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug report] preloadOwner is not best-effort: an uninitialized GravitinoEnv fails the whole list request

1 participant