Skip to content

[#13895] fix(iceberg): report missing views after native rename - #13896

Open
yuqi1129 wants to merge 1 commit into
apache:mainfrom
yuqi1129:fix/iceberg-view-rename-not-found
Open

yuqi1129 wants to merge 1 commit into
apache:mainfrom
yuqi1129:fix/iceberg-view-rename-not-found

Conversation

@yuqi1129

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Build Iceberg load-view responses from a checked metadata snapshot. If a native rename removes the old view between the existence check and metadata read, throw NoSuchViewException with the identifier instead of passing null metadata to the response builder.

Why are the changes needed?

Iceberg 1.11 creates a fresh operations instance after checking view existence. A native rename in between can therefore turn a missing view into NullPointerException: metadata rather than the normal not-found response.

Fix: #13895

Does this PR introduce any user-facing change?

A view that disappears during loading produces a normal not-found error instead of an internal metadata NPE. Successful responses keep the same metadata and location fields.

How was this patch tested?

  • A real JDBC/SQLite catalog deterministically renames a view between the two operations instances; the old name reports not-found and the new name remains readable.
  • All non-Docker tests passed on Apache Gravitino main (iceberg-common: 80, catalog-lakehouse-iceberg: 115, iceberg-rest-server: 466).
  • Spotless checks passed.
  • Reverting the fix reproduces the original metadata NPE in the regression; restoring it passes.
  • Command: ./gradlew :iceberg:iceberg-common:spotlessCheck :iceberg:iceberg-common:test :catalogs:catalog-lakehouse-iceberg:test :iceberg:iceberg-rest-server:test -PskipITs -PskipDockerTests=true with SKIP_DOCKER_TESTS=true.

Copilot AI balanced review requested due to automatic review settings October 16, 2026 08:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

View view = getViewCatalog().loadView(viewIdentifier);
Preconditions.checkState(
view instanceof BaseView, "Cannot wrap catalog that does not produce BaseView");
ViewMetadata metadata = ((BaseView) view).operations().current();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does table have the similar issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I checked it, and the table works well.

@github-actions

Copy link
Copy Markdown

Code Coverage Report

Overall Project 71.96% -0.01% 🟢
Files changed 68.79% 🟢

Module Coverage
aliyun 19.74% 🔴
api 55.09% 🟢
authorization-common 85.96% 🟢
authorization-ranger 14.44% 🔴
aws 53.54% 🟢
aws-bundle 0.0% 🔴
azure 32.1% 🔴
azure-bundle 0.0% 🔴
catalog-common 29.49% 🔴
catalog-fileset 82.37% 🟢
catalog-glue 73.24% 🟢
catalog-hive 83.63% 🟢
catalog-jdbc-common 57.98% 🟢
catalog-jdbc-doris 87.56% 🟢
catalog-jdbc-mysql 81.91% 🟢
catalog-jdbc-postgresql 84.02% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 75.21% 🟢
catalog-lakehouse-generic 84.58% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.93% 🟢
catalog-lakehouse-paimon 84.36% 🟢
catalog-model 77.99% 🟢
cli 44.62% 🟢
client-java 79.44% 🟢
client-java-runtime 0.0% 🔴
common 60.78% 🟢
core 87.47% +0.04% 🟢
filesystem-hadoop3 76.89% 🟢
flink 55.44% 🟢
flink-common 32.2% 🔴
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 17.84% 🔴
hive-metastore-common 62.3% 🟢
hive-metastore3-libs 58.8% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 67.06% -3.33% 🟢
iceberg-rest-server 77.08% 🟢
idp-basic 86.77% 🟢
integration-test-common 0.0% 🔴
jobs 71.35% 🟢
k8s-job-executor 97.76% 🟢
lance-common 39.9% 🔴
lance-rest-server 69.51% 🟢
lineage 59.39% 🟢
optimizer 84.27% 🟢
optimizer-api 46.58% 🟢
server 91.43% 🟢
server-common 83.85% 🟢
spark 61.79% 🟢
tencent 81.78% 🟢
tms 80.0% 🟢
trino-connector 63.31% 🟢
Files
Module File Coverage
core SemanticModelMetaService.java 98.47% 🟢
iceberg-common IcebergCatalogWrapper.java 47.54% 🔴

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] Loading an Iceberg view can fail with metadata NPE during native rename

3 participants