Repository navigation
Plan cleanup work instead of letting clients derive it - #484
Merged
Merged
Conversation
em3s
force-pushed
the
feat/control-cleanup-planner
branch
3 times, most recently
from
August 7, 2026 01:29
122507f to
f90aa1d
Compare
The teardown order and its preconditions are the part every operational client reimplements: replication off before disable or the standby stops tracking, unlink before drop or the metadata dangles, purge only for what is already gone. Getting one wrong breaks a cluster, so the rule belongs in one place. POST /control/jobs answers what an action would do. Three choices are worth naming. Targets are a list. A per-table endpoint is what makes each client build its own queue, and then makes the next client build it again. dryRun is a flag on the endpoint that will execute, not a separate preview endpoint. Two code paths computing the same plan is how a plan and its execution come to disagree - the plan an operator reviewed has to be the plan that runs. Until authorization lands, dryRun=false is refused. Refusals are typed. An operator facing a disabled action needs to know which precondition to satisfy, and a test needs to assert that the right one was named, so Precondition is an enum with the human detail beside it. These are predictions: the data plane enforces these invariants and stays the one that says no. Fanout is partial - a pair that has drifted apart is brought together rather than refused - and metadata actions stay on the active side, because metadata is not replicated. Part of #370 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
em3s
force-pushed
the
feat/control-cleanup-planner
branch
from
August 7, 2026 01:35
f90aa1d to
e17b8c4
Compare
Contributor
Author
|
Optimistic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The teardown order and its preconditions are the part every operational client reimplements: replication off before disable or the standby stops tracking, unlink before drop or the metadata dangles, delete the metadata only once the table is gone. Getting one wrong breaks a cluster, so the rule belongs in one place.
POST /control/jobsanswers what an action would do, over a batch of targets. Nothing takes effect:dryRun=falseis refused until authorization lands.Relates to #370
Three choices worth naming
Targets are a list. A per-table endpoint is what makes each client build its own execution queue, and then makes the next client build it again.
dryRunis a flag on the endpoint that will execute, not a separate preview endpoint. Two code paths computing the same plan is exactly how a plan and its execution come to disagree — and the plan an operator reviewed has to be the plan that runs.Refusals are typed. An operator facing a disabled action needs to know which precondition to satisfy, and a test needs to assert the right one was named, so
Preconditionis an enum with the human detail beside it:{ "target": {"tenant": "...", "table": "..."}, "action": "DROP_TABLE", "ok": false, "refusal": "NEEDS_LOCAL_REPLICATION", "detail": "STANDBY still replicates: turn replication off first", "steps": [] }These are predictions. The data plane enforces these invariants itself and stays the one that says no — #477 already refuses a teardown while a reference is live. Predicting them here is how a client learns before it asks, not a second source of truth.
Rules encoded
REPLICATION_OFF/REPLICATION_ONREPLICATION_ONon a disabled tableDISABLE_TABLE/ENABLE_TABLEDISABLE_TABLEwhile replication is onUNLINKDROP_TABLEDELETE_METADATAFanout is partial — only the sides not already at the target state get a step, so an active/standby pair that has drifted apart is brought together rather than refused. Metadata actions (
UNLINK,DELETE_METADATA) stay on the active side, because metadata is not replicated. A table living only on the standby is still droppable there.Naming
Action and step names follow the #470 decision:
tableis the physical HBase table,collectionthe logical v3 entity. That matters most for the two steps that used to beDROP_TABLEandDELETE_TABLE— a verb apart, but one loses the rows and the other only the definition. They are nowDROP_TABLEandDELETE_COLLECTION.CleanupAction.destructivemarks the same boundary in the type rather than in prose:DROP_TABLEandDELETE_METADATAcannot be undone, everything else is a staging step. That is the line a confirmation prompt belongs on.How to Test
Because the plan is dry, the grid can be walked exhaustively: every refusal test asserts the precondition it named, not just that it failed.
POST /control/jobsis the first operational write, so the endpoint classification gains aCONTROL_WRITE_ENDPOINTSset — refused by a read-only instance like any other write, but served by a control instance, which is why it cannot simply join the data-plane write list.Not touched
CleanupActionkeeps its name even thoughENABLE_TABLEandREPLICATION_ONundo rather than clean up. Renaming it reachesCleanupPlan,CleanupPlannerandCleanupJobService; better done alongside the executor.AI Assistance