sofastack / sofa-jraft

A production-grade java implementation of RAFT consensus algorithm.
https://www.sofastack.tech/projects/sofa-jraft/
Apache License 2.0
3.57k stars 1.14k forks source link

feat(iterator):Auto commit mode for applying log iterator #962

Closed 1294566108 closed 1 year ago

1294566108 commented 1 year ago

Motivation:

Auto commit mode for applying log iterator

Modification:

issue link is here.

Result:

killme2008 commented 1 year ago

@1294566108 I think we should call commit in Iterator#next(). It means committing the state machine before getting the next element, just like we don't have auto-commit mode but we want to commit on every log:

while(it.hasNext()) {
   byte [] data = it.getData();
   it.commit();
   it.next();   
}

It looks like we don't need the variable lastCommit, commit many times for the same log index has no side effects.

killme2008 commented 1 year ago

@1294566108 Please sign the CLA and format the code by mvn compile:compile.

1294566108 commented 1 year ago

@1294566108 Please sign the CLA and format the code by mvn compile:compile.

Okay, I have recompiled and submitted it

killme2008 commented 1 year ago

@1294566108 You have to sign the CLA http://cla.sofastack.tech/

If not, we can't merge this PR. thank you.

1294566108 commented 1 year ago

@1294566108 You have to sign the CLA http://cla.sofastack.tech/

If not, we can't merge this PR. thank you.

之前似乎有签署过个人的CLA,刚刚又签了一次,请问还需要签署公司CLA吗 image

killme2008 commented 1 year ago

@seeflood Hi, the new contributor's CLA state can't be updated again, please help to check it.