Skip to content

Expose what references a datastore table - #478

Merged
em3s merged 1 commit into
mainfrom
feat/datastore-table-references-api
Aug 6, 2026
Merged

em3s merged 1 commit into
mainfrom
feat/datastore-table-references-api

Conversation

@em3s

@em3s em3s commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Deciding whether an HBase table is safe to tear down means reconstructing the alias -> label -> storage -> table chain client-side. The server already resolves that chain to guard its own disable and drop, so let clients ask instead.

Stacked on #477. Relates to #370

Changes

  • GET .../tables/{tableName}/references for one table
  • GET /graph/v3/datastore/hbase/references for the whole cluster from a single scan, keyed by namespace:tableName

Per-table resolution costs a metadata scan per database, so anything walking a cluster should use the bulk form. It sits outside tables/ to avoid colliding with tables/{tableName}. Inactive bindings are included so an operator can tell a teardown in progress from a table nothing ever pointed at.

How to Test

./gradlew :engine:test :server:test

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Code (Opus 5)

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels Aug 6, 2026
@em3s em3s mentioned this pull request Aug 6, 2026
1 task done
@em3s
em3s force-pushed the fix/guard-datastore-table-references branch from d596e55 to 4897a7c Compare August 6, 2026 08:43
@em3s
em3s force-pushed the feat/datastore-table-references-api branch from 2eb61fd to a3b339f Compare August 6, 2026 08:45
@em3s
em3s force-pushed the fix/guard-datastore-table-references branch 2 times, most recently from d264d3b to 0fbae0f Compare August 6, 2026 08:56
@em3s
em3s force-pushed the feat/datastore-table-references-api branch from a3b339f to 0cf9251 Compare August 6, 2026 08:58
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Aug 6, 2026
@em3s
em3s force-pushed the fix/guard-datastore-table-references branch from 0fbae0f to 4fae82e Compare August 6, 2026 09:05
@em3s
em3s force-pushed the feat/datastore-table-references-api branch from 0cf9251 to 7ec9edb Compare August 6, 2026 09:05
Base automatically changed from fix/guard-datastore-table-references to main August 6, 2026 09:09
@em3s
em3s force-pushed the feat/datastore-table-references-api branch 2 times, most recently from 61ad0f7 to 3f74539 Compare August 6, 2026 09:16
Deciding whether an HBase table is safe to tear down means reconstructing the
`alias -> label -> storage -> table` chain client-side, from the metadata listings, across every
tenant. The server already resolves that chain to guard its own disable and drop, so let clients
ask instead of rebuild.

`GET .../tables/{tableName}/references` answers for one table. That costs the same metadata scan as
the whole cluster does, so `GET /graph/v3/datastore/hbase/references` returns every binding from a
single scan, keyed by `namespace:tableName`, narrowed by an optional `namespace` parameter. It sits
outside `tables/` to avoid colliding with `tables/{tableName}`.

Inactive bindings are included so an operator can tell a teardown in progress from a table nothing
ever pointed at.
@em3s
em3s force-pushed the feat/datastore-table-references-api branch from 3f74539 to 4991539 Compare August 6, 2026 09:17
@em3s

em3s commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Optimistic

@em3s
em3s merged commit e56454e into main Aug 6, 2026
2 checks passed
@em3s
em3s deleted the feat/datastore-table-references-api branch August 6, 2026 09:23
@em3s em3s self-assigned this Aug 6, 2026
em3s added a commit that referenced this pull request Aug 6, 2026
A cleanup client has to know, per table, what each side holds and what
still binds to it. Every client derives that itself today, and two of the
facts are ones no single cluster can supply.

Sides are symmetric here: a table's state is one entry per side, so a
table that survives only on the standby is an absent active side rather
than a second kind of row. Clients model that as a separate list because
they see one cluster at a time; the control plane does not have to.

The chain comes from the references endpoint added in #478 rather than
being reconstructed, and each reference carries the side it was found on -
a label still active on the standby is exactly the thing that blocks a
teardown halfway through.

Two tenants configured against the same cluster resolve to the same
cluster key, which is how a table held by another tenant is noticed
without anyone declaring it. That answer names the tenant, because
"blocked" without "by whom" leaves the operator where they started.

A side that failed is reported as failed. An empty table list from a
cluster that never answered would read as nothing left to clean up, which
is the one wrong answer this endpoint must never give.

Part of #370

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
em3s added a commit that referenced this pull request Aug 7, 2026
A cleanup client has to know, per table, what each side holds and what
still binds to it. Every client derives that itself today, and two of the
facts are ones no single cluster can supply.

Sides are symmetric here: a table's state is one entry per side, so a
table that survives only on the standby is an absent active side rather
than a second kind of row. Clients model that as a separate list because
they see one cluster at a time; the control plane does not have to.

The chain comes from the references endpoint added in #478 rather than
being reconstructed, and each reference carries the side it was found on -
a label still active on the standby is exactly the thing that blocks a
teardown halfway through.

Two tenants configured against the same cluster resolve to the same
cluster key, which is how a table held by another tenant is noticed
without anyone declaring it. That answer names the tenant, because
"blocked" without "by whom" leaves the operator where they started.

A side that failed is reported as failed. An empty table list from a
cluster that never answered would read as nothing left to clean up, which
is the one wrong answer this endpoint must never give.

Part of #370

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
em3s added a commit that referenced this pull request Aug 7, 2026
A cleanup client has to know, per table, what each side holds and what
still binds to it. Every client derives that itself today, and two of the
facts are ones no single cluster can supply.

Sides are symmetric here: a table's state is one entry per side, so a
table that survives only on the standby is an absent active side rather
than a second kind of row. Clients model that as a separate list because
they see one cluster at a time; the control plane does not have to.

The chain comes from the references endpoint added in #478 rather than
being reconstructed, and each reference carries the side it was found on -
a label still active on the standby is exactly the thing that blocks a
teardown halfway through.

Two tenants configured against the same cluster resolve to the same
cluster key, which is how a table held by another tenant is noticed
without anyone declaring it. That answer names the tenant, because
"blocked" without "by whom" leaves the operator where they started.

A side that failed is reported as failed. An empty table list from a
cluster that never answered would read as nothing left to clean up, which
is the one wrong answer this endpoint must never give.

Part of #370

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant