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 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-05 01:28:19 -08:00
1 parent fe2d016c41
commit 7bb702d7c4
1 file changed
+7 -6
+7 -6
View File
@@ -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.