Skip to content

etcdserver: allow defrag on learner members#21862

Open
puneetdixit200 wants to merge 1 commit into
etcd-io:mainfrom
puneetdixit200:fix/21740-learner-defrag
Open

etcdserver: allow defrag on learner members#21862
puneetdixit200 wants to merge 1 commit into
etcd-io:mainfrom
puneetdixit200:fix/21740-learner-defrag

Conversation

@puneetdixit200
Copy link
Copy Markdown

Fixes #21740.

This allows learner members to serve Maintenance.Defragment requests. Learners already keep the same bbolt backend as voters, and defrag is a local backend maintenance operation, so the learner RPC gate should not reject it.

The PR also adds:

  • a unit test covering the learner RPC allowlist for DefragmentRequest
  • an integration test that creates a learner, connects a client only to that learner endpoint, and defragments it successfully

Tests:

  • go test ./server/etcdserver/api/v3rpc -run TestRPCSupportedForLearnerIncludesDefragment -count=1 (red first before the allowlist change)
  • go test ./server/etcdserver/api/v3rpc -count=1
  • go test ./tests/integration/clientv3 -run TestMaintenanceDefragmentLearner -count=1 -v
  • git diff --check

AI disclosure:
This PR was written in part with the assistance of generative AI. I reviewed the change and ran the tests above.

Prompt used: inspect etcd issue #21740, read the contribution guidance, add a minimal test-backed fix for learner defrag, verify it, and open a PR.

Rhyme:
etcd keeps the cluster steady and bright,
learners reclaim their storage tonight.

Signed-off-by: Puneet Dixit <puneetdixit200@users.noreply.github.com>
@k8s-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: puneetdixit200
Once this PR has been reviewed and has the lgtm label, please assign jmhbnz for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Copy Markdown

Hi @puneetdixit200. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

ETCD learner members cannot be defragmented, causing persistent storage bloat.

2 participants