From 7bb702d7c4b0948ee1e234b037e950664fd8bb45 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 5 Dec 2026 01:28:19 -0800 Subject: [PATCH] s3tables: table policy and maintenance reads refuse views and unfinished records readTableMetadataAttr only checked that the table-metadata attribute was present, so the table policy and maintenance operations accepted a view or a record a create or rename had not finished writing. Route it through tableMetadata, the check GetTable and the other table operations use. Co-Authored-By: Claude Opus 5.5 --- weed/s3api/s3tables/filer_ops.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/weed/s3api/s3tables/filer_ops.go b/weed/s3api/s3tables/filer_ops.go index 150bf9171d..41d404108c 100644 --- a/weed/s3api/s3tables/filer_ops.go +++ b/weed/s3api/s3tables/filer_ops.go @@ -479,14 +479,15 @@ func (h *S3TablesHandler) loadNamespaceMetadata(ctx context.Context, filerClient return &metadata, nil } -// readTableMetadataAttr returns the table-metadata xattr at tablePath. A -// directory without it is not a table, so its absence reads as a missing entry. +// readTableMetadataAttr returns the table-metadata xattr at tablePath. A view, +// an unfinished record, or a directory without it is not a table, so each reads +// as a missing entry. func (h *S3TablesHandler) readTableMetadataAttr(ctx context.Context, client filer_pb.SeaweedFilerClient, tablePath string) ([]byte, error) { - data, err := h.getExtendedAttribute(ctx, client, tablePath, ExtendedKeyMetadata) - if errors.Is(err, ErrAttributeNotFound) { - return nil, fmt.Errorf("%w: %s", filer_pb.ErrNotFound, tablePath) + entry, err := h.lookupEntry(ctx, client, tablePath) + if err != nil { + return nil, err } - return data, err + return tableMetadata(entry) } // lookupEntry returns the filer entry at the given path.