You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "alexjo2144 (via GitHub)" <gi...@apache.org> on 2025/05/23 22:17:32 UTC
[I] Manifest list written by go-iceberg contains incorrect file lengths [iceberg-go]
alexjo2144 opened a new issue, #438:
URL: https://github.com/apache/iceberg-go/issues/438
### Apache Iceberg version
None
### Please describe the bug 🐞
Hey iceberg-go team, @alexandre-normand and I have been trying out writes to an Iceberg table from Go and have hit a snag.
When Trino is reading the table's manifest files produced by iceberg-go I get the following error:
```
java.io.IOException: Incorrect file size (32417) for file (end of stream not reached): s3://<path>
```
Checking the contents of the manifest list, each of the manifests suspiciously has the exact same length:
```
trino> select length from iceberg.default."test_table$manifests";
length
--------
32417
32417
32417
```
Especially because the files are not all the same size:
```
> aws s3 ls s3://<path>/metadata/ | grep "m1.avro"
2025-05-23 15:54:19 35557 01f978e5-4086-452f-90f9-c9db46cda10d-m1.avro
2025-05-23 15:39:21 35649. 11931ea9-5fc5-4463-a8f3-9151c1305d89-m1.avro
2025-05-23 16:04:24 35762. 2460f4cd-aa95-4d98-b04d-4716799ca04a-m1.avro
2025-05-23 15:44:22 35679. 41254a5b-79d6-4a1d-a7ad-84a5c7302e01-m1.avro
2025-05-23 16:09:23 35604. 648ed2ee-adc4-4ee0-a88b-90bfb4c4967f-m1.avro
2025-05-23 15:49:22 35709. 8099f4d0-76f0-47d0-ab89-2037c7cd9aa4-m1.avro
2025-05-23 15:59:22 35671 b2032af6-6cdf-42f5-8c65-48b723b49e13-m1.avro
2025-05-23 15:34:22 34984. ed847256-3e89-4a8e-aaa6-99389bc984c0-m1.avro
```
I haven't had a chance to dive too deep into the Go implementation yet but my hunch is the manifest list is not fetching the actual size of the produced Avro file after the write is flushed to object storage, and is instead using an estimated count.
--
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.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: [I] Manifest list written by go-iceberg contains incorrect file lengths [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on issue #438:
URL: https://github.com/apache/iceberg-go/issues/438#issuecomment-2907007693
*UPDATE:* Yup, I've confirmed this is the issue. We're passing the value of Count before the flush occurs so the value is incorrect when we write it. I'll put together a fix and put up a PR for it.
--
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: [I] Manifest list written by go-iceberg contains incorrect file lengths [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on issue #438:
URL: https://github.com/apache/iceberg-go/issues/438#issuecomment-2907015860
I put up the PR and tagged you guys! Go try it out and just confirm it fixes the issue for you guys please! :smile:
--
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: [I] Manifest list written by go-iceberg contains incorrect file lengths [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade closed issue #438: Manifest list written by go-iceberg contains incorrect file lengths
URL: https://github.com/apache/iceberg-go/issues/438
--
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: [I] Manifest list written by go-iceberg contains incorrect file lengths [iceberg-go]
Posted by "alexandre-normand (via GitHub)" <gi...@apache.org>.
alexandre-normand commented on issue #438:
URL: https://github.com/apache/iceberg-go/issues/438#issuecomment-2907008517
> *UPDATE:* Yup, I've confirmed this is the issue. We're passing the value of Count before the flush occurs so the value is incorrect when we write it. I'll put together a fix and put up a PR for it.
Awesome. Thanks for the quick investigation @zeroshade! Sounds like you've got a way to reproduce but let me know if you'd like me to run some tests once you have a fix committed.
--
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: [I] Manifest list written by go-iceberg contains incorrect file lengths [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on issue #438:
URL: https://github.com/apache/iceberg-go/issues/438#issuecomment-2906997287
So, looking at the code a bit. One thing that stands out to me as a potential cause of this is that we do `defer counter.W.(io.Closer).Close()` while passing `counter.Count` to the `ToManifestFile` call.
The reason why this could be the source is because, in this case, the underlying writer is an `*ocf.Encoder` which will call `Flush` during the call to `Close`. So if we're not fully flushed before calling `wr.ToManifestFile(path, counter.Count)`, then `counter.Count` won't account for the number of bytes that have yet to be flushed, resulting in the incorrect value being written to the manifest. This could also explain the similarity in the sizes that were written depending on how the writes used by hamba/avro/v2/ocf are buffered.
I'll try to replicate this situation and then see if forcibly flushing before the call to `ToManifestFile` fixes the issue. If so, then I'll see what a good ergonomic solution to this would be. The entire purpose of using the wrapping write counter is to avoid having to perform the extra request to the object storage to find the size of the written file, instead just tracking the number of bytes we actually write out.
--
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