fix(s3tables): return the bucket and namespace ids and the namespace owner (#9917)

GetTableBucket, ListTableBuckets, GetNamespace, ListNamespaces, GetTable
and ListTables now return tableBucketId and namespaceId where the S3
Tables model defines them, and GetNamespace and ListNamespaces return
the required createdBy and ownerAccountId. New buckets and namespaces
get a random id their children repeat; a bucket or namespace stored by
an earlier Floci gets one derived from its bucket's ARN and its name, so
every read returns the same id.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-12-01 15:21:49 -04:00
1 parent a7bb0b7ff8
commit fcbab03dcd
10 files changed
+362 -11

No files matched your search

@@ -73,6 +73,7 @@ class S3TablesTest {
GetTableBucketRequest.builder().tableBucketARN(bucketArn).build());
assertThat(fetched.name()).isEqualTo(bucketName);
assertThat(fetched.arn()).isEqualTo(bucketArn);
assertThat(fetched.tableBucketId()).isNotBlank();
}
@Test
@@ -109,15 +110,33 @@ class S3TablesTest {
@Test
@Order(3)
void getsAndListsResourcesWithPrefixes() {
GetTableBucketResponse bucket = client.getTableBucket(
GetTableBucketRequest.builder().tableBucketARN(bucketArn).build());
String bucketId = bucket.tableBucketId();
assertThat(client.listTableBuckets(ListTableBucketsRequest.builder().prefix("table-bucket").build()).tableBuckets())
.anyMatch(bucket -> bucketName.equals(bucket.name()));
assertThat(client.getNamespace(GetNamespaceRequest.builder().tableBucketARN(bucketArn).namespace(NAMESPACE).build())
.namespace()).containsExactly(NAMESPACE);
.anyMatch(summary -> bucketName.equals(summary.name()) && bucketId.equals(summary.tableBucketId()));
GetNamespaceResponse namespace = client.getNamespace(
GetNamespaceRequest.builder().tableBucketARN(bucketArn).namespace(NAMESPACE).build());
assertThat(namespace.namespace()).containsExactly(NAMESPACE);
assertThat(namespace.namespaceId()).isNotBlank();
assertThat(namespace.tableBucketId()).isEqualTo(bucketId);
assertThat(namespace.ownerAccountId()).isEqualTo(bucket.ownerAccountId());
assertThat(namespace.createdBy()).isEqualTo(bucket.ownerAccountId());
assertThat(client.listNamespaces(ListNamespacesRequest.builder().tableBucketARN(bucketArn).prefix("anal").build())
.namespaces()).anyMatch(namespace -> namespace.namespace().contains(NAMESPACE));
.namespaces()).anyMatch(summary -> summary.namespace().contains(NAMESPACE)
&& namespace.namespaceId().equals(summary.namespaceId())
&& bucket.ownerAccountId().equals(summary.ownerAccountId())
&& bucket.ownerAccountId().equals(summary.createdBy()));
assertThat(client.getTable(GetTableRequest.builder()
.tableBucketARN(bucketArn).namespace(NAMESPACE).name(tableName).build()))
.satisfies(table -> {
assertThat(table.namespaceId()).isEqualTo(namespace.namespaceId());
assertThat(table.tableBucketId()).isEqualTo(bucketId);
});
assertThat(client.listTables(ListTablesRequest.builder().tableBucketARN(bucketArn).namespace(NAMESPACE)
.prefix("events").build()).tables())
.anyMatch(table -> tableName.equals(table.name()));
.anyMatch(table -> tableName.equals(table.name()) && namespace.namespaceId().equals(table.namespaceId())
&& bucketId.equals(table.tableBucketId()));
}
@Test