Repository navigation
[Server] Implement the Iceberg registerTable endpoint - #1851
moomindani wants to merge 1 commit into
Conversation
The register endpoint was not implemented, so a table whose Iceberg metadata already exists could not be brought into this catalog through the REST API: the request was answered by Armeria with a 404 for a path it does not serve. That is the path an engine takes to adopt a table written elsewhere, and the one a migration onto Unity Catalog goes through. Serve it, and advertise V1_REGISTER_TABLE with the other write endpoints. The metadata file is read and never written: the table's columns, properties and location come from the document the request names, and because nothing was written there is nothing to clean up if the row cannot be created. The file has to sit inside the table location it declares, so a metadata file cannot register a table rooted somewhere it does not live -- MetadataService gained a read for a table Unity Catalog does not have yet, since the location cannot come from a persisted row that is not there. A name that is already taken is the spec's 409, unless the request asks to overwrite: then the given file is committed over whatever the table points at now, through the same compare-and-swap a commit uses, so a commit that lands in between is reported as a conflict rather than silently overwritten. Overwriting a table that is not a native Iceberg table is refused by that commit path, as it is for any other commit. Signed-off-by: Noritaka Sekiyama <[email protected]>
|
Thanks for putting this together. Before we get into the code, I want to step back on whether Our UC Iceberg table model is: a table has one location, and governed by UC, and everything (data + metadata) lives under it. For managed tables it is assigned by UC, and for external tables it is chosen by client. Either way the location is governed by UC once the table is created. So I don't think we are ready to implement this endpoint in UC yet. |
|
Fair enough -- feel free to close it. The intent across these PRs was spec coverage, filling in the Iceberg REST endpoints UC does not serve yet, and register turns out not to fit UC's model the way the others do; that is not something to settle quickly, so I would rather park it than force it. One note for whenever it comes up again: besides the request carrying no location for UC to approve, the overwrite path is unsound on its own terms -- it commits the given metadata file over an existing table's pointer without checking the file is under the location UC governs for that table ( |
PR Checklist
docsis updatedDescription of changes
Fixes #1850.
The register endpoint was not served, so a table whose Iceberg metadata already exists could not be
brought into this catalog through the REST API: the request was answered with a 404 for a path this
server does not have. That is the path an engine takes to adopt a table written elsewhere, and the one a
migration onto Unity Catalog goes through.
This serves it and advertises
V1_REGISTER_TABLEwith the other write endpoints, so it is gated thesame way the other Iceberg writes are.
the document the request names, and because nothing is written there is nothing to clean up if the
row cannot be created -- unlike
createTable, which has to delete the metadata it wrote.rooted somewhere it does not live.
MetadataServicegained a read for a table Unity Catalog does nothave yet, because the location it validates against cannot come from a persisted row that is not
there.
committed over whatever the table points at now, through the same compare-and-swap a commit uses: a
commit that lands in between is reported as a conflict rather than silently overwritten. Overwriting a
table that is not a native Iceberg table is refused by that commit path, as it is for any other
commit. Iceberg's client does send
overwrite, which is why it is implemented rather than rejected.For users: an existing Iceberg table can be adopted into Unity Catalog by naming its metadata file, and
the table is a full member of the catalog afterwards -- listed, loadable, and committable.
testRegisterTablepins the response's metadata pointer, that the table is then listed and loadable andcarries its columns in Unity Catalog, the 409 for a taken name, the 200 when overwrite is asked for, the
404 for a namespace that does not exist, and the rejection of a metadata file outside the location it
declares. It fails on an unfixed tree and passes with the fix; the full
server/testsuite shows nofailure attributable to this change (the one failure here is the GCP credential test, which needs
credentials this machine does not have).