Repository navigation
feat(cli): add kafscale-cli prune for deleted topic data - #271
Merged
PaxMachinaOne merged 4 commits intoOct 30, 2026
Merged
Conversation
Lists the S3 data kept for deleted topic incarnations and deletes it with --force. Filters by --topic and --older-than. Each prefix is rechecked against the live generation and topic snapshot before it is deleted, and the deleted-topics record is removed only after the S3 delete succeeds, so a rerun finishes a partial run. Refs KafScale#262
Prune deleted every key under a generation 0 prefix, including LFS objects that the proxy writes there for the live topic. It now counts and deletes only <partition>/segment-<offset>.kfs and .index keys. A list error on one incarnation no longer stops the run, and prune fails when the bucket does not exist instead of creating it. Refs KafScale#262
PaxMachinaOne
approved these changes
Oct 30, 2026
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
Adds
kafscale-cli prune, which lists the S3 data kept for deleted topics and deletes it with--force. This is the prune side of the "keep data" design from #262 and #269.Design
Kafka has no prune API, and KafScale has no extension pattern for its own admin operations over the Kafka protocol: request decoding goes through
kmsg.RequestForKeyand rejects unknown API keys. Prune therefore runs next tokafscale-cli restoreand talks to etcd and S3 directly through the same helpers. Access is controlled by the etcd and S3 credentials.KAFSCALE_ALLOW_ADMIN_APISand Kafka ACLs do not apply.Behavior
--forcedeletes.--topicand--older-than(for example7dor24h) filter the incarnations.deleted_at, then totals. A dry run says nothing was deleted.orders@1/never matchesorders@10/andorders/never matchesorders-x/. A record whose prefix does not match its topic and generation is rejected.x@1./kafscale/deleted-topicsrecord is removed only after that succeeds, so a rerun after a partial failure finishes the job.<prefix><partition>/segment-<offset>.kfsand.index) are counted and deleted. Other keys, including LFS objects under<prefix>lfs/that the proxy writes for every generation, are skipped.Tests
cmd/kafscale-cli/prune_test.gouses embedded etcd and the in-memory S3 client:orders@2,orders@10andorders-x--topicand--older-thanfilters, alone and togetherCheckBucketnever creates the bucketrun, including flag and connection errorsDocs
docs/operations.md(new "Pruning Deleted Topic Data" section),docs/ops-api.mdanddocs/releases/unreleased.md.Refs #262