You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "ShivanshhhG (via GitHub)" <gi...@apache.org> on 2026/10/13 03:25:39 UTC
[PR] test: add integration test for registering table into new catalog after retiring original (#5755) [polaris]
ShivanshhhG opened a new pull request, #5772:
URL: https://github.com/apache/polaris/pull/5772
Adds `testRegisterTableHandoffToNewCatalog` to `PolarisRestCatalogIntegrationBase` to cover registering a table with commit history into a new catalog after the original catalog is retired:
- Creates a table in the original catalog and commits two snapshots (`FILE_A`, `FILE_B`).
- Verifies that creating an overlapping catalog while the original catalog is still active returns `400 Bad Request` when `ALLOW_OVERLAPPING_CATALOG_URLS` is `false`.
- Performs a sequential handoff: drops the table without purge, drops the namespace and the original catalog, creates a new catalog with the same storage configuration and base location, and registers the table from its latest metadata file.
- Asserts that `uuid()`, `currentSnapshot()`, `snapshots()`, `history()`, and `schemas()` match the source table, and that a new commit (`FILE_C`) through the new catalog succeeds with the source table's last snapshot as its parent.
## Checklist
- [x] ๐ก๏ธ Don't disclose security issues! (contact security@apache.org)
- [x] ๐ Clearly explained why the changes are needed, or linked related issues: Fixes #5755
- [x] ๐งช Added/updated tests with good coverage, or manually tested (and explained how)
- [x] ๐ก Added comments for complex logic
- [ ] ๐งพ Updated `CHANGELOG.md` (if needed)
- [ ] ๐ Updated documentation in `site/content/in-dev/unreleased` (if needed)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test: add integration test for registering table into new catalog after retiring original (#5755) [polaris]
Posted by "ShivanshhhG (via GitHub)" <gi...@apache.org>.
ShivanshhhG commented on code in PR #5772:
URL: https://github.com/apache/polaris/pull/5772#discussion_r4310370178
##########
integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogIntegrationBase.java:
##########
@@ -1053,6 +1054,73 @@ public void testRegisterTableOverwriteRejectedForExternalCatalog() {
}
}
+ /**
+ * Verify that a table with commit history can be handed off from a retired catalog to a new
+ * catalog sharing the same storage configuration and base location, preserving table UUID,
+ * snapshots, history, and schemas, and allowing subsequent commits whose parent is the source
+ * table's last snapshot.
+ */
+ @Test
+ public void testRegisterTableHandoffToNewCatalog() throws IOException {
+ Namespace ns = Namespace.of("ns_handoff");
+ restCatalog.createNamespace(ns);
+
+ TableIdentifier ident = TableIdentifier.of(ns, "handoff_table");
+ Table source = restCatalog.createTable(ident, SCHEMA);
+ source.newFastAppend().appendFile(FILE_A).commit();
+ source.newFastAppend().appendFile(FILE_B).commit();
+
+ String metadataFileLocation =
+ ((BaseTable) source).operations().current().metadataFileLocation();
+ UUID sourceUuid = source.uuid();
+ var sourceCurrentSnapshot = source.currentSnapshot();
+ var sourceSnapshots = source.snapshots();
+ var sourceHistory = source.history();
+ var sourceSchemas = source.schemas();
+
+ Catalog sourceCatalog = managementApi.getCatalog(currentCatalogName);
+ String newCatalogName = client.newEntityName("handoff_target");
+ Catalog targetCatalog =
+ PolarisCatalog.builder()
+ .setType(sourceCatalog.getType())
+ .setName(newCatalogName)
+ .setProperties(sourceCatalog.getProperties())
+ .setStorageConfigInfo(sourceCatalog.getStorageConfigInfo())
+ .build();
+
+ // While the source catalog is still live, creating an overlapping catalog is rejected (400)
+ try (Response overlapResponse =
+ managementApi.request("v1/catalogs").post(Entity.json(targetCatalog))) {
+ assertThat(overlapResponse.getStatus())
+ .isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
Review Comment:
Good point! Dropped the overlap check in the latest commit so the test focuses directly on the catalog handoff after the source catalog is retired.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test: add integration test for registering table into new catalog after retiring original (#5755) [polaris]
Posted by "vigneshio (via GitHub)" <gi...@apache.org>.
vigneshio commented on code in PR #5772:
URL: https://github.com/apache/polaris/pull/5772#discussion_r4257316134
##########
integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogIntegrationBase.java:
##########
@@ -1053,6 +1054,73 @@ public void testRegisterTableOverwriteRejectedForExternalCatalog() {
}
}
+ /**
+ * Verify that a table with commit history can be handed off from a retired catalog to a new
+ * catalog sharing the same storage configuration and base location, preserving table UUID,
+ * snapshots, history, and schemas, and allowing subsequent commits whose parent is the source
+ * table's last snapshot.
+ */
+ @Test
+ public void testRegisterTableHandoffToNewCatalog() throws IOException {
+ Namespace ns = Namespace.of("ns_handoff");
+ restCatalog.createNamespace(ns);
+
+ TableIdentifier ident = TableIdentifier.of(ns, "handoff_table");
+ Table source = restCatalog.createTable(ident, SCHEMA);
+ source.newFastAppend().appendFile(FILE_A).commit();
+ source.newFastAppend().appendFile(FILE_B).commit();
+
+ String metadataFileLocation =
+ ((BaseTable) source).operations().current().metadataFileLocation();
+ UUID sourceUuid = source.uuid();
+ var sourceCurrentSnapshot = source.currentSnapshot();
+ var sourceSnapshots = source.snapshots();
+ var sourceHistory = source.history();
+ var sourceSchemas = source.schemas();
+
+ Catalog sourceCatalog = managementApi.getCatalog(currentCatalogName);
+ String newCatalogName = client.newEntityName("handoff_target");
+ Catalog targetCatalog =
+ PolarisCatalog.builder()
+ .setType(sourceCatalog.getType())
+ .setName(newCatalogName)
+ .setProperties(sourceCatalog.getProperties())
+ .setStorageConfigInfo(sourceCatalog.getStorageConfigInfo())
+ .build();
+
+ // While the source catalog is still live, creating an overlapping catalog is rejected (400)
+ try (Response overlapResponse =
+ managementApi.request("v1/catalogs").post(Entity.json(targetCatalog))) {
+ assertThat(overlapResponse.getStatus())
+ .isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
Review Comment:
Can we drop this overlap check? ITs already run with `ALLOW_OVERLAPPING_CATALOG_URLS` on, so this create returns 201 not 400. the part we actually need is the handoff after the source catalog is gone.. WDYT ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org