You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "findinpath (via GitHub)" <gi...@apache.org> on 2026/03/23 10:21:49 UTC
[PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
findinpath opened a new pull request, #15734:
URL: https://github.com/apache/iceberg/pull/15734
Signal early to the TableOperations that there is no retry needed for files which do not exist.
## Additional context
Issue found while testing GCS credentials vending on `apache/iceberg-rest-fixture:1.10.1` on `trinodb/trino` https://github.com/trinodb/trino/pull/28423/
```
[qtp1357563986-31] WARN org.apache.iceberg.util.Tasks - Retrying task after failure: sleepTimeMs=403 Failed to read file: gs://trino-ci-test/gcs-vending-rest-test-w9a718ba0b/tpch/test_drop_table_with_missing_metadata_file_a422ditwmf-555e6d30e3834820993299f645ee11c1/metadata/00000-6a7be733-c273-463a-8700-0f02b17561b8.metadata.json
org.apache.iceberg.exceptions.RuntimeIOException: Failed to read file: gs://trino-ci-test/gcs-vending-rest-test-w9a718ba0b/tpch/test_drop_table_with_missing_metadata_file_a422ditwmf-555e6d30e3834820993299f645ee11c1/metadata/00000-6a7be733-c273-463a-8700-0f02b17561b8.metadata.json
at org.apache.iceberg.TableMetadataParser.read(TableMetadataParser.java:311)
at org.apache.iceberg.TableMetadataParser.read(TableMetadataParser.java:294)
at org.apache.iceberg.BaseMetastoreTableOperations.lambda$refreshFromMetadataLocation$0(BaseMetastoreTableOperations.java:180)
at org.apache.iceberg.BaseMetastoreTableOperations.lambda$refreshFromMetadataLocation$1(BaseMetastoreTableOperations.java:199)
at org.apache.iceberg.util.Tasks$Builder.runTaskWithRetry(Tasks.java:413)
at org.apache.iceberg.util.Tasks$Builder.runSingleThreaded(Tasks.java:219)
at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:203)
at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:196)
at org.apache.iceberg.BaseMetastoreTableOperations.refreshFromMetadataLocation(BaseMetastoreTableOperations.java:199)
at org.apache.iceberg.BaseMetastoreTableOperations.refreshFromMetadataLocation(BaseMetastoreTableOperations.java:176)
at org.apache.iceberg.BaseMetastoreTableOperations.refreshFromMetadataLocation(BaseMetastoreTableOperations.java:167)
at org.apache.iceberg.jdbc.JdbcTableOperations.doRefresh(JdbcTableOperations.java:100)
at org.apache.iceberg.BaseMetastoreTableOperations.refresh(BaseMetastoreTableOperations.java:88)
at org.apache.iceberg.BaseMetastoreTableOperations.current(BaseMetastoreTableOperations.java:71)
at org.apache.iceberg.BaseMetastoreCatalog.loadTable(BaseMetastoreCatalog.java:49)
at org.apache.iceberg.rest.CatalogHandlers.loadTable(CatalogHandlers.java:329)
at org.apache.iceberg.rest.RESTCatalogAdapter.handleRequest(RESTCatalogAdapter.java:420)
at org.apache.iceberg.rest.RESTServerCatalogAdapter.handleRequest(RESTServerCatalogAdapter.java:42)
at org.apache.iceberg.rest.RESTCatalogAdapter.execute(RESTCatalogAdapter.java:628)
at org.apache.iceberg.rest.RESTCatalogAdapter.execute(RESTCatalogAdapter.java:609)
at org.apache.iceberg.rest.RESTCatalogServlet.execute(RESTCatalogServlet.java:108)
at org.apache.iceberg.rest.RESTCatalogServlet.doGet(RESTCatalogServlet.java:66)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:500)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:529)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:822)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
at org.eclipse.jetty.server.Server.handle(Server.java:563)
at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.io.IOException: com.google.cloud.storage.StorageException: 404 Not Found
GET https://storage.googleapis.com/download/storage/v1/b/trino-ci-test/o/gcs-vending-rest-test-w9a718ba0b%2Ftpch%2Ftest_drop_table_with_missing_metadata_file_a422ditwmf-555e6d30e3834820993299f645ee11c1%2Fmetadata%2F00000-6a7be733-c273-463a-8700-0f02b17561b8.metadata.json?alt=media
No such object: trino-ci-test/gcs-vending-rest-test-w9a718ba0b/tpch/test_drop_table_with_missing_metadata_file_a422ditwmf-555e6d30e3834820993299f645ee11c1/metadata/00000-6a7be733-c273-463a-8700-0f02b17561b8.metadata.json
at com.google.cloud.storage.BaseStorageReadChannel.read(BaseStorageReadChannel.java:143)
at org.apache.iceberg.gcp.gcs.GCSInputStream.read(GCSInputStream.java:177)
at org.apache.iceberg.gcp.gcs.GCSInputStream.read(GCSInputStream.java:141)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.ensureLoaded(ByteSourceJsonBootstrapper.java:547)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.detectEncoding(ByteSourceJsonBootstrapper.java:137)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.constructParser(ByteSourceJsonBootstrapper.java:266)
at com.fasterxml.jackson.core.JsonFactory._createParser(JsonFactory.java:1874)
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:1273)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3924)
at org.apache.iceberg.TableMetadataParser.read(TableMetadataParser.java:309)
... 54 more
Caused by: com.google.cloud.storage.StorageException: 404 Not Found
GET https://storage.googleapis.com/download/storage/v1/b/trino-ci-test/o/gcs-vending-rest-test-w9a718ba0b%2Ftpch%2Ftest_drop_table_with_missing_metadata_file_a422ditwmf-555e6d30e3834820993299f645ee11c1%2Fmetadata%2F00000-6a7be733-c273-463a-8700-0f02b17561b8.metadata.json?alt=media
```
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks merged PR #15734:
URL: https://github.com/apache/iceberg/pull/15734
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
Posted by "findinpath (via GitHub)" <gi...@apache.org>.
findinpath commented on code in PR #15734:
URL: https://github.com/apache/iceberg/pull/15734#discussion_r3014808801
##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSInputStream.java:
##########
@@ -127,7 +127,12 @@ public int read() throws IOException {
singleByteBuffer.position(0);
pos += 1;
- channel.read(singleByteBuffer);
+ try {
+ channel.read(singleByteBuffer);
Review Comment:
Added assertions in `org.apache.iceberg.gcp.gcs.TestGcsFileIO#readMissingLocation` to showcase that these are local operations
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
Posted by "findinpath (via GitHub)" <gi...@apache.org>.
findinpath commented on code in PR #15734:
URL: https://github.com/apache/iceberg/pull/15734#discussion_r2979115572
##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSInputFile.java:
##########
@@ -93,6 +94,9 @@ public SeekableInputStream newStream() {
private SeekableInputStream newGoogleCloudStorageInputStream() throws IOException {
if (null == blobSize) {
+ if (storage().get(blobId()) == null) {
Review Comment:
> doesn't this add an additional request for every input stream?
Indeed it does.
The alternative would be to catch a lower-level `404` storage exception while reading.
I'll reshape the code to contain this handling.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks commented on code in PR #15734:
URL: https://github.com/apache/iceberg/pull/15734#discussion_r3012331291
##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSInputStream.java:
##########
@@ -127,7 +127,12 @@ public int read() throws IOException {
singleByteBuffer.position(0);
pos += 1;
- channel.read(singleByteBuffer);
+ try {
+ channel.read(singleByteBuffer);
Review Comment:
Is there any chance that `openChannel` or `seek` could throw as well?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks commented on code in PR #15734:
URL: https://github.com/apache/iceberg/pull/15734#discussion_r2975717445
##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSInputStream.java:
##########
@@ -96,6 +97,9 @@ private ReadChannel openChannel() {
.userProject()
.ifPresent(userProject -> sourceOptions.add(BlobSourceOption.userProject(userProject)));
+ if (storage.get(blobId) == null) {
Review Comment:
I believe this would be the same problem as above.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks commented on code in PR #15734:
URL: https://github.com/apache/iceberg/pull/15734#discussion_r3012303255
##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSExceptionUtil.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.gcp.gcs;
+
+import com.google.cloud.storage.BlobId;
+import com.google.cloud.storage.StorageException;
+import java.io.IOException;
+import org.apache.iceberg.exceptions.NotFoundException;
+
+final class GCSExceptionUtil {
+ private GCSExceptionUtil() {}
+
+ static void throwNotFoundIfPresent(IOException ioException, BlobId blobId) {
Review Comment:
I keep reading this method name and either I'm not understanding or it feels very awkward. Shouldn't it say `throwNotFoundIfNotPresent`?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks commented on code in PR #15734:
URL: https://github.com/apache/iceberg/pull/15734#discussion_r2975712887
##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/GCSInputFile.java:
##########
@@ -93,6 +94,9 @@ public SeekableInputStream newStream() {
private SeekableInputStream newGoogleCloudStorageInputStream() throws IOException {
if (null == blobSize) {
+ if (storage().get(blobId()) == null) {
Review Comment:
It's been a while since I've looked at this, but doesn't this add an additional request for every input stream?
I think we want to avoid that since it will almost always be a wasted call.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] GCS: Throw NotFoundException for inexistent input GCS file [iceberg]
Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks commented on PR #15734:
URL: https://github.com/apache/iceberg/pull/15734#issuecomment-4170535910
Thanks @findinpath !
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org