You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ze...@apache.org on 2026/08/25 20:30:27 UTC
(iceberg-go) branch main updated: fix(table): preserve AllManifests read errors (#1730)
This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git
The following commit(s) were added to refs/heads/main by this push:
new 509fd1cf6 fix(table): preserve AllManifests read errors (#1730)
509fd1cf6 is described below
commit 509fd1cf67c56b8e77cffb3900e9041f98ca3ac6
Author: Minh Vu <vu...@gmail.com>
AuthorDate: Tue Aug 25 22:30:21 2026 +0200
fix(table): preserve AllManifests read errors (#1730)
fix(table): preserve manifest read errors
---
table/all_manifests_internal_test.go | 21 ++++++++++++++++
table/table.go | 49 +++++++++++++++++++++++-------------
2 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/table/all_manifests_internal_test.go b/table/all_manifests_internal_test.go
index e886513c8..5bda050ca 100644
--- a/table/all_manifests_internal_test.go
+++ b/table/all_manifests_internal_test.go
@@ -20,6 +20,7 @@ package table
import (
"bytes"
"context"
+ "errors"
"fmt"
"sync"
"testing"
@@ -27,9 +28,29 @@ import (
"github.com/apache/iceberg-go"
iceio "github.com/apache/iceberg-go/io"
+ tblutils "github.com/apache/iceberg-go/table/internal"
"github.com/stretchr/testify/require"
)
+func TestYieldAllManifestsReturnsErrorAfterResultsClose(t *testing.T) {
+ results := make(chan tblutils.Enumerated[[]iceberg.ManifestFile])
+ close(results)
+
+ manifestErr := errors.New("manifest list read failed")
+ errch := make(chan error, 1)
+ errch <- manifestErr
+ close(errch)
+
+ var got error
+ yieldAllManifests(results, errch, func(_ iceberg.ManifestFile, err error) bool {
+ got = err
+
+ return true
+ })
+
+ require.ErrorIs(t, got, manifestErr)
+}
+
func TestAllManifestsCompletesAfterErrorChannelCloses(t *testing.T) {
const snapshotCount = 8
diff --git a/table/table.go b/table/table.go
index 06b41bdda..9eb2be961 100644
--- a/table/table.go
+++ b/table/table.go
@@ -449,30 +449,43 @@ func (t Table) AllManifests(ctx context.Context) iter.Seq2[iceberg.ManifestFile,
}()
}()
- for {
- select {
- case err, ok := <-errch:
- if !ok {
- errch = nil
+ yieldAllManifests(results, errch, yield)
+ }
+}
- continue
- }
- if err != nil {
- yield(nil, err)
+func yieldAllManifests(
+ results <-chan tblutils.Enumerated[[]iceberg.ManifestFile],
+ errch <-chan error,
+ yield func(iceberg.ManifestFile, error) bool,
+) {
+ for results != nil || errch != nil {
+ select {
+ case err, ok := <-errch:
+ if !ok {
+ errch = nil
- return
- }
- case next, ok := <-results:
- for _, mf := range next.Value {
- if !yield(mf, nil) {
- return
- }
- }
+ continue
+ }
+ if err != nil {
+ yield(nil, err)
+
+ return
+ }
+ case next, ok := <-results:
+ if !ok {
+ results = nil
- if next.Last || !ok {
+ continue
+ }
+ for _, mf := range next.Value {
+ if !yield(mf, nil) {
return
}
}
+
+ if next.Last {
+ return
+ }
}
}
}