Skip to content

refactor(kvrocks): remove unused Client.GetOrCreateKey - #21298

Merged
JinHai-CN merged 1 commit into
infiniflow:mainfrom
Sanderhoff-alt:refactor/remove-unused-kvrocks-getorcreatekey
Nov 2, 2026
Merged

JinHai-CN merged 1 commit into
infiniflow:mainfrom
Sanderhoff-alt:refactor/remove-unused-kvrocks-getorcreatekey

Conversation

@Sanderhoff-alt

Copy link
Copy Markdown
Contributor

Summary

kvrocks.Client.GetOrCreateKey has no callers. The secret key path uses server.GetOrCreateKey through the VariableStore interface, so this method is a duplicate.

It is also wrong if someone revives it:

  • It logs "Redis Get error" when Get succeeds.
  • It treats every Get error, including network failures, as a missing key and falls through to SetNX.
  • It returns an empty value with a nil error when the client is nil.

This PR removes the method instead of keeping a misleading duplicate. No behavior change: nothing references it.

Verified with ./build.sh --go and ./build.sh --test on internal/engine/... and internal/server/....

Nothing calls it; the secret key path uses server.GetOrCreateKey through
the VariableStore interface. The method is also wrong if revived: it
logs a Redis Get error when Get succeeds, treats every Get error as a
missing key, and returns an empty value without an error when the client
is nil. Drop it rather than keep a duplicate that can mislead callers.
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 66945310-0d15-48f6-a31e-de90b5937023
📥 Commits

Reviewing files that changed from the base of the PR and between 102d719 and 0538b64.

📒 Files selected for processing: 1
  • internal/engine/kvrocks/redis.go
💤 Files with no reviewable changes: 1
  • internal/engine/kvrocks/redis.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The exported Client.GetOrCreateKey method was removed from the Kvrocks client. Its existing-key lookup, SETNX creation path, concurrent-creation fallback, and associated errors were also removed.

Changes: Kvrocks API

Layer / File(s) Summary
Remove GetOrCreateKey API
internal/engine/kvrocks/redis.go
Removed Client.GetOrCreateKey and its lookup, creation, fallback, and error handling logic.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 0538b

No affected repository workflow was identified; this change is ready to merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly identifies the refactor and the specific unused method removed.
Description check Passed The description includes the required Summary section, explains the duplicate method and its defects, states the expected behavior impact, and lists verification steps.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the key-shaped nook
The old creation path is gone
No lookup now, no SETNX spring
The Kvrocks client moves along
My paws tap out a quiet song

Comment @coderabbitai help to get the list of available commands.

@JinHai-CN JinHai-CN self-assigned this Nov 2, 2026
@JinHai-CN JinHai-CN added the ci Continue Integration label Nov 2, 2026
@JinHai-CN
JinHai-CN merged commit ac0a268 into infiniflow:main Nov 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants