Git Product home page Git Product logo

Comments (4)

superfell avatar superfell commented on June 12, 2024

So the problem seems to be in raft.runFSM(), the lastIndex & lastTerm variables are local to the func, are only set when there's a commit or a restore called for, but the initial load of the snapshot at startup is done outside of that via restoreSnapshot(). so if the first request that runFSM() sees is to create a snapshot, it hasn't set lastIndex & lastTerm yet.

from raft.

armon avatar armon commented on June 12, 2024

@superfell This is an interesting one. I'm not sure what the correct behavior is in this case. The snapshot really is capturing nothing if there is no commits or restores prior to this, so that part is correct. We should be calling restoreSnapshot() before returning the Raft instance, so I'm not even sure how this is possible.

from raft.

superfell avatar superfell commented on June 12, 2024

From what i could tell, the initial snapshot load at startup doesn't go through the FSM goroutine.

It seems like either it should spot this and return an error for the snapshot attempt (as there's nothing new that would require a snapshot), or the FSM goroutine should initialize it index/term local vars from the Raft instance. I'd be happy to code up either solution if you have a prefernce [i mostly lean towards having the snapshot attempt return an error]

from raft.

armon avatar armon commented on June 12, 2024

@superfell Agreed, it is strange to snapshot when there is no data. Lets go with the error return.

from raft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.