mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-11 22:38:53 +01:00
iceberg: support views (#10069)
* s3tables: tag table entries and exclude views from table listings * s3tables: add view CRUD operations * iceberg: support view create, load, exists, drop, and list * iceberg: support view update * iceberg: test view error classification and metadata round-trip * iceberg: pre-check existence and write view metadata only after create * iceberg: map view namespace-not-found to 404 * iceberg: test view create namespace-404 and duplicate no-clobber * s3tables: tag view metadata and entry type atomically CreateView wrote ExtendedKeyMetadata and ExtendedKeyEntryType in two UpdateEntry calls, so a partial failure could leave a view directory untagged. Add setExtendedAttributes to set both in one UpdateEntry. * iceberg: roll back view registration when metadata write fails The metadata file is written after the catalog registers the view. If that write fails, drop the just-created view so it doesn't linger pointing at a missing metadata.json. Reuse the DeleteView path via a shared dropView helper.
This commit is contained in:
1 parent
1ca628d3e9
commit
0403e47ef6
13 files changed
+1815
-3
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package s3tables
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestEntryType(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
extended map[string][]byte
|
||||
want string
|
||||
}{
|
||||
{"nil extended is table", nil, EntryTypeTable},
|
||||
{"absent marker is table", map[string][]byte{ExtendedKeyMetadata: []byte("{}")}, EntryTypeTable},
|
||||
{"empty marker is table", map[string][]byte{ExtendedKeyEntryType: {}}, EntryTypeTable},
|
||||
{"table marker", map[string][]byte{ExtendedKeyEntryType: []byte(EntryTypeTable)}, EntryTypeTable},
|
||||
{"view marker", map[string][]byte{ExtendedKeyEntryType: []byte(EntryTypeView)}, EntryTypeView},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
if got := entryType(c.extended); got != c.want {
|
||||
t.Fatalf("entryType() = %q, want %q", got, c.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateViewARN(t *testing.T) {
|
||||
h := NewS3TablesHandler()
|
||||
got := h.generateViewARN(DefaultAccountID, "warehouse", "ns/v")
|
||||
want := "arn:aws:s3tables:us-east-1:000000000000:bucket/warehouse/view/ns/v"
|
||||
if got != want {
|
||||
t.Fatalf("generateViewARN() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user