storage icon indicating copy to clipboard operation
storage copied to clipboard

Deleting an analytics bucket never purges its remote Iceberg tables

Open hsusul opened this issue 1 month ago • 1 comments

Bug

Deleting an analytics bucket leaves its Iceberg tables and namespaces in the remote catalog. The DeleteIcebergResources job still reports success.

Remote namespaces are created and addressed by a tenant-scoped name, ${tenantId}_${namespaceId} with - replaced by _ (TenantCatalog.getTenantNamespaceName). In src/storage/events/iceberg/delete-iceberg-resources.ts, restCatalog.listTables uses that scoped name. restCatalog.dropTable and restCatalog.dropNamespace pass the user-facing ns.name instead.

What happens

  1. dropTable({ namespace: ns.name, purgeRequested: true }) targets a namespace that doesn't exist remotely and gets a 404.
  2. The job swallows that 404 as "table not found", deletes the table metadata and frees the shard slot.
  3. listTables on the scoped name still finds the table, so dropNamespace is skipped.
  4. The catalog is deleted and the job succeeds.

Expected

The remote tables are purged and the remote namespace is dropped before the metadata is removed.

Actual

The remote table data and namespace stay in the warehouse. The freed shard slot no longer matches what is stored remotely, and the reconciler later finds the leftover tables as orphans.

hsusul avatar Oct 16 '26 20:10 hsusul

Duplicate of #1528, which #1531 fixes.

hsusul avatar Oct 16 '26 20:10 hsusul