Skip to content

Add explicit enable/disable HBase table and replication action endpoints - #320

Merged
em3s merged 4 commits into
mainfrom
feat/hbase-table-action-endpoints
May 13, 2026
Merged

em3s merged 4 commits into
mainfrom
feat/hbase-table-action-endpoints

Conversation

@em3s

@em3s em3s commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add four explicit action endpoints on the HBase datastore controller for the safe table-cleanup runbook: flip replicationScope first (online, while the table still serves writes), then disable, then drop. Splitting these out of updateTable (PUT) lets the replication flip run without the storage-in-use guard, which the runbook requires.

Changes

  • POST .../tables/{name}/enable and .../disable — keep the storage-in-use guard, mirror updateTable
  • POST .../tables/{name}/replication/enable and .../disable — call AsyncAdmin.modifyColumnFamily on the existing CF; skip the in-use guard; idempotent when already at target scope
  • All four require the production-admin role; updateTable (PUT) is unchanged
  • Assumes a single column family (matches existing HBaseAdmin / HBaseTableSchema)

How to Test

  • ./gradlew :engine:test --tests "*.HBaseAdminTest" — 10/10 pass (3 new replication tests)
  • ./gradlew :server:build -x test and :server:spotlessCheck :engine:spotlessCheck — pass
  • Manual: run replication/disable against a real cluster while the table is enabled and serving writes; then full runbook (replication/disable → disable → delete on both clusters)

AI Assistance

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

Add four POST action endpoints on the v3 HBase datastore controller so
operators can run the safe table-cleanup runbook explicitly:
1. set replicationScope=0 on both clusters (alter while the table is
   still serving writes),
2. disable the table,
3. drop it.

Endpoints:
- POST /graph/v3/datastore/hbase/tables/{name}/enable
- POST /graph/v3/datastore/hbase/tables/{name}/disable
- POST /graph/v3/datastore/hbase/tables/{name}/replication/enable
- POST /graph/v3/datastore/hbase/tables/{name}/replication/disable

The replication toggles call AsyncAdmin.modifyColumnFamily on the
existing column family descriptor, which is an online alter and works
on actively-served tables — required because the scope flip must happen
before any disable/drop. They intentionally skip the storage-in-use
guard for the same reason. The enable/disable action endpoints keep the
guard, matching the existing updateTable behavior. All four require the
production-admin role, same as updateTable.

updateTable (PUT) is left untouched for backward compatibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels May 12, 2026
em3s and others added 2 commits May 12, 2026 21:57
setReplicationScope used to modify only the first column family via
modifyColumnFamily, so extras on a multi-CF table kept their old
scope — leaving the cleanup runbook in an inconsistent state.

Build a TableDescriptor with every stale CF updated and call
modifyTable instead, so all CFs flip in one online alter. Skip
the alter when every CF already matches the target scope.

Add a multi-CF integration test that adds a second column family
via addColumnFamily before flipping, verifying both end up at
REPLICATION_SCOPE_GLOBAL.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@em3s em3s added this to the v0.4.0 milestone May 12, 2026
The four new action endpoints (enable, disable, replication enable,
replication disable) shared the generic "update operations" rejection
message. An operator seeing the 403 could not tell which action was
blocked. Tailor each message to its action.
@em3s em3s changed the title Add explicit enable/disable table and replication action endpoints Add explicit enable/disable HBase table and replication action endpoints May 13, 2026
@em3s

em3s commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Merging

@em3s
em3s merged commit f8b0288 into main May 13, 2026
2 checks passed
@em3s
em3s deleted the feat/hbase-table-action-endpoints branch May 13, 2026 02:08
@em3s em3s self-assigned this May 14, 2026
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