[Feature] Add annotation to trigger contiguous slot compaction on a Redkey cluster
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- go, kubernetes, redis
- Domain
- databases, devops, infrastructure
Research direction
Start at the Redkey CR annotation handling and the operator/Robin slot-assignment paths, comparing them with the initial cluster layout and existing scaling or upgrade coordination. Done means the compact-slots value triggers one resumable migration using CLUSTER SETSLOT, records observable progress and completion, handles canonical layouts and concurrency, and updates the operator guide and CR reference.
Written by the indexing model from the issue text.
Description
Feature description
Add annotation to trigger contiguous slot compaction on a Redkey cluster
Context
Redkey Robin now correctly recovers a Redkey cluster when pods are recreated
while scaling or upgrade operations are in progress. The cluster ends up
well-formed and balanced (each node owns a fair share of the 16384 hash slots).
However, after such a recovery the slot-to-node distribution is not
contiguous the way it is on a freshly created cluster. Slots owned by a node
may be scattered across several non-adjacent ranges instead of a single clean
range per node.
This is not a functional problem — Redis keeps working correctly regardless
of how slots are laid out. But it becomes a problem for RDB-based data copy
workflows: when copying RDB files from one cluster to another, both clusters
must share the same slot distribution. A fragmented layout breaks that
assumption and makes file-level RDB copies unusable.
Proposal
Introduce an annotation on the Redkey CR that instructs the
operator/Robin to perform a slot compaction: reassign hash slots so that
each node owns a single contiguous range, matching the layout a freshly created
cluster would have.
Proposed annotation: redkey.inditex.dev/compact-slots
- The operation is one-shot (an imperative trigger, not desired state).
- Suggested value: a timestamp or monotonic token (e.g. RFC3339). Applying the
annotation with a new value re-triggers compaction. - The operator records the last processed value (e.g. in
status) so an
unchanged annotation does not repeatedly trigger the operation.
Expected behavior
- User sets
redkey.inditex.dev/compact-slots: "<timestamp>"on the Redkey CR. - The operator/Robin plans a target layout of contiguous slot ranges,
deterministically distributed across the current master nodes (same rule
used at initial cluster creation). - Slots are migrated to reach that target layout using
CLUSTER SETSLOT/
slot migration, moving data as needed. - Once complete, the cluster has a homogeneous, contiguous slot distribution
identical to a freshly created cluster of the same topology. - The operator marks the annotation value as processed to avoid re-running.
Constraints & considerations
- Compaction migrates real data between nodes and can be I/O intensive; it
should run as a controlled, observable operation and be safe to interrupt
(idempotent / resumable). - Must be mutually exclusive with, or safely queued behind, in-flight scaling
and upgrade operations. - Should be a no-op if the cluster is already in the canonical contiguous
layout. - Behavior for clusters with replicas: only master slot ownership is affected;
replicas follow their masters. - Emit events / status conditions and metrics so operators can observe
progress and completion.
Out of scope
- Automatic/periodic compaction. This is an explicit, user-triggered action.
- Changing the initial slot-assignment algorithm.
Acceptance criteria
- Annotation
redkey.inditex.dev/compact-slotsis recognized on the Redkey CR. - Setting a new value triggers exactly one compaction.
- After completion, each master owns a single contiguous slot range matching
the freshly-created-cluster layout. - Operation is safe when concurrent scaling/upgrade is requested (queued or
rejected with a clear condition). - No-op when the layout is already canonical.
- Progress/outcome is observable via events, status conditions, and metrics.
- Documentation updated (operator guide + CR reference).
Use case or motivation
No response
Would you like to work on this?
Yes, I'd like to open a PR
- Dominant language
- Go
- Stars
- 29
- Forks
- 2
- Avg merge
- 13h 32m
- Merged PRs (30d)
- 16
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from InditexTech/redkey-operator
-
[Feature] Set RevisionHistoryLimit on the generated Robin Deployment to bound retained ReplicaSetsOpenenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
InditexTech/redkey-operator#87 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
InditexTech/redkey-operator#124 ·
Maintainers usually reply within 1 day
-
[Bug] Operator memory usage scales with cluster size instead of with the number of Redkeys (OOMKilled on startup)Possibly taken @albertompe claimed this 10 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
InditexTech/redkey-operator#122 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 22/100
InditexTech/redkey-operator#120 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 54/100
InditexTech/redkey-operator#111 · 1 comment ·
Maintainers usually reply within 1 day
All issues in InditexTech/redkey-operator
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
coder/openstorage#807 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
coder/coder-logstream-kube#255 · 1 comment ·
-
kind/features
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
TencentBlueKing/bk-nodemgr#3991 ·
Maintainers usually reply within 1 day