S3 Tables: fix gRPC stream loop handling for list operations
- Correctly handle io.EOF to terminate loops gracefully. - Propagate other errors to prevent silent failures. - Ensure all list results are processed effectively.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -106,8 +107,11 @@ func (h *S3TablesHandler) handleListTableBuckets(w http.ResponseWriter, r *http.
|
|||||||
for {
|
for {
|
||||||
entry, respErr := resp.Recv()
|
entry, respErr := resp.Recv()
|
||||||
if respErr != nil {
|
if respErr != nil {
|
||||||
|
if respErr == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
return respErr
|
||||||
|
}
|
||||||
if entry.Entry == nil {
|
if entry.Entry == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -219,8 +223,11 @@ func (h *S3TablesHandler) handleDeleteTableBucket(w http.ResponseWriter, r *http
|
|||||||
for {
|
for {
|
||||||
entry, err := resp.Recv()
|
entry, err := resp.Recv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
if entry.Entry != nil && !strings.HasPrefix(entry.Entry.Name, ".") {
|
if entry.Entry != nil && !strings.HasPrefix(entry.Entry.Name, ".") {
|
||||||
hasChildren = true
|
hasChildren = true
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -338,8 +339,11 @@ func (h *S3TablesHandler) listTablesInNamespaceWithClient(ctx context.Context, c
|
|||||||
for {
|
for {
|
||||||
entry, respErr := resp.Recv()
|
entry, respErr := resp.Recv()
|
||||||
if respErr != nil {
|
if respErr != nil {
|
||||||
|
if respErr == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
return respErr
|
||||||
|
}
|
||||||
if entry.Entry == nil {
|
if entry.Entry == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -415,8 +419,11 @@ func (h *S3TablesHandler) listTablesInAllNamespaces(ctx context.Context, filerCl
|
|||||||
for {
|
for {
|
||||||
entry, respErr := resp.Recv()
|
entry, respErr := resp.Recv()
|
||||||
if respErr != nil {
|
if respErr != nil {
|
||||||
|
if respErr == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
return respErr
|
||||||
|
}
|
||||||
if entry.Entry == nil {
|
if entry.Entry == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user