GithubHelp home page GithubHelp logo

Question: Reads from followers about nuraft HOT 4 CLOSED

alesapin avatar alesapin commented on July 22, 2024
Question: Reads from followers

from nuraft.

Comments (4)

greensky00 avatar greensky00 commented on July 22, 2024 1

Read-path is not a part of Raft protocol. You can use your own way to ask the leader for its committed index.

get_leader_committed_log_idx() returns the last "seen" committed index from heartbeats or append_entries messages from the leader. So it can be outdated at the time when a follower reads this value.

But please note that even though a follower directly asks the leader for the committed index, that value also can be outdated at the time when the follower receives the response from the leader. So there is no guarantee in either way.

from nuraft.

greensky00 avatar greensky00 commented on July 22, 2024 1

I see. For that purpose, you can use this API

/**
* Check if there is live leader in the current cluster.
*
* @return `true` if live leader exists.
*/
bool is_leader_alive() const {
if ( leader_ == -1 || !hb_alive_ ) return false;
return true;
}

It returns false if a follower is partitioned from the leader.

from nuraft.

alesapin avatar alesapin commented on July 22, 2024

Thanks, I think stale reads are OK in my case. What is the best way to check that we are not completely partitioned from the leader (still receiving heartbeats)? https://github.com/eBay/NuRaft/blob/master/include/libnuraft/raft_server.hxx#L442-L444?

from nuraft.

alesapin avatar alesapin commented on July 22, 2024

Thanks!

from nuraft.

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.