filer: keep empty folders that are s3tables catalog entries (#11102)

* s3tables: build the catalog attribute keys from one shared prefix

Every attribute the catalog stores on a bucket, namespace, table or view
entry is spelled out with the same literal prefix. Name it once in
s3_constants so code outside the package can recognize a catalog entry
without repeating the string.

Claude-Session: https://claude.ai/code/session_01GfZsc4cyNB2yr6KYLRv9q1

* filer: keep empty folders that are s3tables catalog entries

A namespace, table or view is a directory whose extended attributes are
the catalog record. Its files can live elsewhere - a rename moves only
the catalog pointer and leaves the data at the old path, and a view has
no files at all - so an empty one is still a live entry.

Drop a table, then rename another table onto that name: the drop queues
the old table's folders, the rename recreates the name path, and two
minutes later the cleaner deletes it and cascades into the namespace,
losing a table the catalog still lists.

Claude-Session: https://claude.ai/code/session_01GfZsc4cyNB2yr6KYLRv9q1

* filer: drop a queued cleanup when the folder is created again

A cleanup is queued against the folder that was found empty. If that
folder is deleted and a new one takes its name, the queue entry outlives
the folder it was about and the next pass deletes the replacement. A
drop followed by a rename onto the dropped name does exactly this: the
name path comes back as a live catalog entry two minutes before the
queue is read.

Claude-Session: https://claude.ai/code/session_01GfZsc4cyNB2yr6KYLRv9q1
This commit is contained in:
Chris Lu
2026-09-02 11:49:08 -07:00
committed by GitHub
parent 23a6b8feb5
commit 86761cc7d5
4 changed files with 122 additions and 8 deletions
+4
View File
@@ -49,6 +49,10 @@ const (
// Bucket Policy
ExtBucketPolicyKey = "Seaweed-X-Amz-Bucket-Policy"
// Every attribute the s3tables catalog stores on a table bucket, namespace,
// table or view directory entry starts with this.
ExtS3TablesPrefix = "s3tables."
// Object Retention and Legal Hold
ExtObjectLockModeKey = "Seaweed-X-Amz-Object-Lock-Mode"
ExtRetentionUntilDateKey = "Seaweed-X-Amz-Retention-Until-Date"
+8 -8
View File
@@ -21,17 +21,17 @@ const (
DefaultRegion = "us-east-1"
// Extended entry attributes for metadata storage
ExtendedKeyTableBucket = "s3tables.tableBucket"
ExtendedKeyMetadata = "s3tables.metadata"
ExtendedKeyMetadataVersion = "s3tables.metadataVersion"
ExtendedKeyPolicy = "s3tables.policy"
ExtendedKeyTags = "s3tables.tags"
ExtendedKeyMaintenance = "s3tables.maintenance"
ExtendedKeyTableBucket = s3_constants.ExtS3TablesPrefix + "tableBucket"
ExtendedKeyMetadata = s3_constants.ExtS3TablesPrefix + "metadata"
ExtendedKeyMetadataVersion = s3_constants.ExtS3TablesPrefix + "metadataVersion"
ExtendedKeyPolicy = s3_constants.ExtS3TablesPrefix + "policy"
ExtendedKeyTags = s3_constants.ExtS3TablesPrefix + "tags"
ExtendedKeyMaintenance = s3_constants.ExtS3TablesPrefix + "maintenance"
// Written by the maintenance worker, read by GetTableMaintenanceJobStatus.
// Separate from ExtendedKeyMaintenance so worker and operator writes do not
// contend on the same attribute.
ExtendedKeyMaintenanceStatus = "s3tables.maintenanceStatus"
ExtendedKeyEntryType = "s3tables.entryType"
ExtendedKeyMaintenanceStatus = s3_constants.ExtS3TablesPrefix + "maintenanceStatus"
ExtendedKeyEntryType = s3_constants.ExtS3TablesPrefix + "entryType"
// Entry-type marker values for ExtendedKeyEntryType. Absent or "table" means
// a table; views are stored like tables but tagged "view".