Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raftstore: change the condition of proposing rollback merge #6584

Merged
merged 15 commits into from
Apr 27, 2020

Conversation

gengliqi
Copy link
Member

@gengliqi gengliqi commented Feb 11, 2020

Signed-off-by: Liqi Geng gengliqiii@gmail.com

What have you changed?

In the previous implementation, the source peer will propose rollback merge
after the local target peer's epoch is larger than recorded previously.

In the current implementation, the rollback merge proposal can be proposed only when
the number of peers who want to rollback merge is greater than the majority of all
peers. If so, this merge is impossible to succeed.

The added failpoint test constructs a case that writing data to source region
after merging. This operation can succeed in the previous implementation which
causes data loss.

What is the type of the changes?

  • Bugfix (a change which fixes an issue)

How is the PR tested?

  • Integration test

Does this PR affect documentation (docs) or should it be mentioned in the release notes?

No

Does this PR affect tidb-ansible?

No

@zhangjinpeng87
Copy link
Member

Please fix the conflict.

Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
@gengliqi
Copy link
Member Author

PTAL

@gengliqi gengliqi removed the S: DNM label Feb 27, 2020
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
@gengliqi gengliqi force-pushed the fix-merge-bug-5 branch 2 times, most recently from dfe8a1d to 1c53a53 Compare March 19, 2020 02:45
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
components/raftstore/src/store/peer.rs Outdated Show resolved Hide resolved
components/raftstore/src/store/peer.rs Outdated Show resolved Hide resolved
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
@gengliqi
Copy link
Member Author

gengliqi commented Apr 16, 2020

PTAL

.peer
.add_want_rollback_merge_peer(self.fsm.peer_id());
if self.fsm.peer.want_rollback_merge_peers.len()
>= raft::majority(
Copy link
Member

Choose a reason for hiding this comment

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

How to ensure peers in want_rollback_merge_peers matches the current peer_list?

Copy link
Member Author

Choose a reason for hiding this comment

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

It can be ensured. If a peer can be added to want_rollback_merge_peers, it must be in current peer_list because its PrepareMerge commit index is the same as the leader's.

self.fsm.peer.pending_merge_state = None;
self.fsm.peer.want_rollback_merge_peers.clear();
Copy link
Member

Choose a reason for hiding this comment

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

Should clear when applying snapshot.

Copy link
Member Author

Choose a reason for hiding this comment

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

After applying a snapshot, on_ready_rollback_merge will be called.

@sre-bot sre-bot added the status/can-merge Status: Can merge to base branch label Apr 27, 2020
@gengliqi gengliqi added the needs-cherry-pick-release-4.0 Type: Need cherry pick to release 4.0 label Apr 27, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

@gengliqi merge failed.

@gengliqi
Copy link
Member Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

@sre-bot sre-bot merged commit f00746d into tikv:master Apr 27, 2020
sre-bot pushed a commit to sre-bot/tikv that referenced this pull request Apr 27, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

cherry pick to release-4.0 in PR #7664

@BusyJay
Copy link
Member

BusyJay commented Apr 27, 2020

I think 3.0 and 3.1 also needs this fix.

gengliqi added a commit to sre-bot/tikv that referenced this pull request Apr 27, 2020
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
@gengliqi
Copy link
Member Author

I think 3.0 and 3.1 also needs this fix.

Yes. 2.1 needs it too. I will add proto first then cherry-pick to these branches

@gengliqi gengliqi deleted the fix-merge-bug-5 branch April 29, 2020 05:08
sre-bot added a commit that referenced this pull request Apr 30, 2020
@yiwu-arbug yiwu-arbug added the needs-cherry-pick-release-3.1 Type: Need cherry pick to release 3.1 label May 8, 2020
@yiwu-arbug
Copy link

/run-cherry-picker

sre-bot pushed a commit to sre-bot/tikv that referenced this pull request May 8, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented May 8, 2020

cherry pick to release-3.1 in PR #7762

gengliqi added a commit to sre-bot/tikv that referenced this pull request May 8, 2020
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
gengliqi added a commit to sre-bot/tikv that referenced this pull request May 8, 2020
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
gengliqi added a commit to sre-bot/tikv that referenced this pull request May 8, 2020
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
c1ay pushed a commit to c1ay/tikv that referenced this pull request May 9, 2020
gengliqi added a commit to sre-bot/tikv that referenced this pull request May 9, 2020
Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
sre-bot added a commit that referenced this pull request May 11, 2020
solotzg added a commit to pingcap/tidb-engine-ext that referenced this pull request May 14, 2020
txn: only wake up waiters when locks are indeed released (tikv#7379) (tikv#7585)

Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>

txn: don't protect rollback for BatchRollback (tikv#7605) (tikv#7608)

Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>

tidb_query: add is true/false keep null ScalarFuncSig (tikv#7532) (tikv#7566)

Signed-off-by: zhongzc <zhongzc_arch@outlook.com>

tidb_query: fix the logical behavior of floats (tikv#7342) (tikv#7582)

Signed-off-by: zhongzc <zhongzc_arch@outlook.com>

tidb_query: fix converting bytes to bool (tikv#7486) (tikv#7547)

Signed-off-by: zhongzc <zhongzc_arch@outlook.com>

raftstore: change the condition of proposing rollback merge (tikv#6584) (tikv#7762)

Signed-off-by: Liqi Geng <gengliqiii@gmail.com>
Signed-off-by: Tong Zhigao <tongzhigao@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-3.1 Type: Need cherry pick to release 3.1 needs-cherry-pick-release-4.0 Type: Need cherry pick to release 4.0 sig/raft Component: Raft, RaftStore, etc. status/can-merge Status: Can merge to base branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants