fix: table location mappings to /etc/s3tables (#8457)

* fix: move table location mappings to /etc/s3tables to avoid bucket name validation

Fixes #8362 - table location mappings were stored under /buckets/.table-location-mappings
which fails bucket name validation because it starts with a dot. Moving them to
/etc/s3tables resolves the migration error for upgrades.

Changes:
- Table location mappings now stored under /etc/s3tables
- Ensure parent /etc directory exists before creating /etc/s3tables
- Normal writes go to new location only (no legacy compatibility)
- Removed bucket name validation exception for old location

* refactor: simplify lookupTableLocationMapping by removing redundant mappingPath parameter

The mappingPath function parameter was redundant as the path can be derived
from mappingDir and bucket using path.Join. This simplifies the code and
reduces the risk of path mismatches between parameters.
This commit is contained in:
Chris Lu
2026-02-26 15:35:13 -08:00
committed by GitHub
parent 3d81d5bef7
commit 641351da78
2 changed files with 19 additions and 15 deletions

View File

@@ -21,7 +21,7 @@ const (
)
const (
tableLocationMappingsDirName = ".table-location-mappings"
tableLocationMappingsDirPath = "/etc/s3tables"
tableObjectRootDirName = ".objects"
)
@@ -111,7 +111,7 @@ func GetTableObjectBucketPath(bucketName string) string {
// GetTableLocationMappingDir returns the root path for table location bucket mappings
func GetTableLocationMappingDir() string {
return path.Join(TablesPath, tableLocationMappingsDirName)
return tableLocationMappingsDirPath
}
// GetTableLocationMappingPath returns the filer path for a table location bucket mapping