Skip to content

fix: [6980850041] avoid-vote-at-learner-state#35258

Open
cadem wants to merge 2 commits intomainfrom
fix/dmchen/6980850041-avoid-vote-at-learner-state
Open

fix: [6980850041] avoid-vote-at-learner-state#35258
cadem wants to merge 2 commits intomainfrom
fix/dmchen/6980850041-avoid-vote-at-learner-state

Conversation

@cadem
Copy link
Copy Markdown
Contributor

@cadem cadem commented Apr 29, 2026

Description

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 06:57
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new error code, TSDB_CODE_SYN_LEARNER_NO_VOTE, and implements a check in the syncNodeOnRequestVote function to ensure that nodes in the learner state do not participate in voting. The error code is defined in both the header and the error string mapping files. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent Raft learner nodes from participating in leader elections by rejecting RequestVote handling when a node is in TAOS_SYNC_STATE_LEARNER.

Changes:

  • Add a new sync error code TSDB_CODE_SYN_LEARNER_NO_VOTE.
  • Reject RequestVote processing when the receiver node is in learner state.
  • Register the new error code in the central error string table.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
source/util/src/terror.c Adds the human-readable string for TSDB_CODE_SYN_LEARNER_NO_VOTE.
include/util/taoserror.h Defines the numeric value for the new sync error code.
source/libs/sync/src/syncRequestVote.c Adds a learner-state guard to avoid voting during RequestVote processing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/libs/sync/src/syncRequestVote.c
@cadem cadem requested a review from a team as a code owner April 29, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants