mirror of
https://github.com/floci-io/floci.git
synced 2026-12-02 09:47:56 -05:00
GetTable and GetTableMetadataLocation never returned warehouseLocation, which the S3 Tables model marks required, so Spark's S3TablesCatalog had nowhere to write: CREATE TABLE failed with "Invalid S3 URI, cannot determine scheme: null/metadata/00000-...metadata.json". CreateTable now creates the table's warehouse, a bucket of its own named like AWS's (<uuid>--table-s3), and both responses report it; a table persisted before this gets one the first time it is read. An Iceberg client writes the table's files there and commits with UpdateTableMetadataLocation, which already existed. DeleteTable deletes the warehouse with its contents, as deleting an S3 Tables table deletes its data. GetTable also reports the required createdBy and modifiedBy.
67 lines
3.0 KiB
Markdown
67 lines
3.0 KiB
Markdown
# S3 Tables
|
|
|
|
**Protocol:** REST JSON
|
|
**Signing service:** `s3tables`
|
|
**Endpoint:** `http://localhost:4566`
|
|
|
|
Floci emulates the S3 Tables control plane for local development, Terraform
|
|
convergence, and SDK integration tests. It is a separate AWS service from S3:
|
|
S3 Tables requests are signed as `s3tables` and use REST JSON routes such as
|
|
`/buckets` and `/tables/{tableBucketARN}/{namespace}`.
|
|
|
|
## Scope
|
|
|
|
This service stores table-bucket, namespace, table, policy, maintenance
|
|
configuration, and metadata-location state, and gives every table a warehouse:
|
|
a bucket of its own, named like the ones AWS creates (`<id>--table-s3`), which
|
|
`GetTable` and `GetTableMetadataLocation` report as `warehouseLocation`. An
|
|
Iceberg client such as Spark's `S3TablesCatalog` writes the table's data and
|
|
metadata files there through Floci's S3 and commits each new metadata file
|
|
with `UpdateTableMetadataLocation`. Deleting the table deletes its warehouse
|
|
and everything in it, every object version included. A warehouse bucket is the
|
|
table's storage, not a general purpose bucket, so `ListBuckets` leaves it out. Floci does not run an Iceberg engine itself: compaction,
|
|
snapshot expiry, replication, encryption management, and metrics are outside
|
|
this implementation.
|
|
|
|
## Supported operations
|
|
|
|
| Area | Operations |
|
|
|---|---|
|
|
| Table buckets | CreateTableBucket, GetTableBucket, ListTableBuckets, DeleteTableBucket |
|
|
| Bucket policy | PutTableBucketPolicy, GetTableBucketPolicy, DeleteTableBucketPolicy |
|
|
| Bucket maintenance | PutTableBucketMaintenanceConfiguration, GetTableBucketMaintenanceConfiguration |
|
|
| Namespaces | CreateNamespace, GetNamespace, ListNamespaces, DeleteNamespace |
|
|
| Tables | CreateTable, GetTable, ListTables, DeleteTable, RenameTable |
|
|
| Metadata location | GetTableMetadataLocation, UpdateTableMetadataLocation |
|
|
| Table policy | PutTablePolicy, GetTablePolicy, DeleteTablePolicy |
|
|
| Table maintenance | PutTableMaintenanceConfiguration, GetTableMaintenanceConfiguration |
|
|
|
|
Tables must use `ICEBERG` format. `UpdateTableMetadataLocation` implements
|
|
optimistic concurrency: supply the table's current `versionToken`; a stale
|
|
token returns `ConflictException`.
|
|
|
|
## Example
|
|
|
|
```bash
|
|
export AWS_ENDPOINT_URL=http://localhost:4566
|
|
export AWS_DEFAULT_REGION=us-east-1
|
|
export AWS_ACCESS_KEY_ID=test
|
|
export AWS_SECRET_ACCESS_KEY=test
|
|
|
|
bucket_arn=$(aws s3tables create-table-bucket --name local-warehouse --query arn --output text)
|
|
aws s3tables create-namespace --table-bucket-arn "$bucket_arn" --namespace analytics
|
|
aws s3tables create-table \
|
|
--table-bucket-arn "$bucket_arn" \
|
|
--namespace analytics \
|
|
--name events \
|
|
--format ICEBERG
|
|
```
|
|
|
|
## Configuration
|
|
|
|
| Variable | Default | Description |
|
|
|---|---|---|
|
|
| `FLOCI_SERVICES_S3TABLES_ENABLED` | `true` | Enables the S3 Tables REST JSON service. |
|
|
| `FLOCI_STORAGE_SERVICES_S3TABLES_MODE` | Global storage mode | Optional per-service storage-mode override. |
|
|
| `FLOCI_STORAGE_SERVICES_S3TABLES_FLUSH_INTERVAL_MS` | `5000` | Persistence flush interval for hybrid storage. |
|