mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
* s3tables, lance: an update cannot move a table's or view's root UpdateTable and UpdateView may move a record to another root (the move is reserved while it happens: moveCatalogRecord, ExtendedKeyMoving). The old root is then claimed by no record, although the table's older snapshots still name files under it: a table registered or created over it loads them and is vended credentials for them, and its drop purges them. Reproduced on master: table u moved from ns/udir to ns/u2, an alias created at ns/udir, the alias dropped: u's first snapshot's data file is gone. An update whose metadata location gives the record another root is now refused with 400 InvalidRequest (ErrLocationMove) before anything is written. No client path needs a move: a commit writes under the location the record has (a table created without a location commits at its assigned directory; a table renamed into another namespace keeps committing at its directory, #12515). Lance's Overwrite register at another dataset goes through UpdateTable and is refused the same way; an Overwrite at the table's own location still works. The move reservation stays (a reservation a crashed move left is still cleared by the next update). Tests: TestUpdateCannotMoveATablesRoot (the move refused, an alias over the old root refused, the old snapshot's file kept, an update under the table's own root works). Existing tests adapted to the rule, none deleted: the UpdateTable refusals of TestLocationOwnedByOneRecord, the moving subtests of TestLocationRaceBacksOut and TestMoveReservationLeftBehind expect 400 with nothing written; TestUpdateAfterRenameAcrossNamespacesRefusesAnotherTablesDirectory and TestUpdateAfterRenameAcrossNamespacesMayMoveIntoItsNamespace expect ErrLocationMove; vector_namespace_test.go's UpdateTable keeps the index's root so its write reaches the fence it tests; lance TestRegisterOverwriteKeepsTheOldDataset expects 400 for an Overwrite at another dataset, the location unchanged and the dataset kept. Each refusal is red with it replaced by the claim check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: a record without a stored location is not renamed A rename moves the catalog record and leaves the files where they are. A record with neither a metadata location nor a warehouse location (every Lance dataset, which lives at its name path; an Iceberg table created at its name path by an older build) takes the root of its record path, so after a rename it claims its new, empty name path and the files at the old one belong to no record: a table created under the old name sits on them. Reproduced on master: Lance table l renamed to l2, ns.l declared again, l2's _versions/1.manifest is under the new ns.l. A rename whose record would claim another root at its destination than at its source is now refused with 400 InvalidRequest, after the authorization checks (a caller without rights is answered as before). A record with a stored location keeps its root and renames as before, within its namespace or into another. In the vector namespace of a vector bucket the read-only answer its fence gives stays the answer. Tests: TestRenameRefusesARecordWithoutAStoredLocation: a Lance dataset renamed in its namespace and a location-less Iceberg table renamed into another are refused, both records and the dataset's files stay; a table with a stored location renames (positive control). Adapted: the rename subtest of TestLocationRaceBacksOut (its table has no stored location) expects 400 with nothing written. Red with the refusal removed, and TestVectorNamespaceIsReadOnlyOverLance/rename_out with the vector namespace's answer skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Javier de la Torre <jatorre@carto.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>