Giter Club home page Giter Club logo

Comments (16)

eliasyaoyc avatar eliasyaoyc commented on May 24, 2024 2

/assignme

from openraft.

eliasyaoyc avatar eliasyaoyc commented on May 24, 2024 1

OKk, when #49 and #61 is over, l will start.

from openraft.

github-actions avatar github-actions commented on May 24, 2024

👋 Thanks for opening this issue!

Get help or engage by:

  • /help : to print help messages.
  • /assignme : to assign this issue to you.

from openraft.

eliasyaoyc avatar eliasyaoyc commented on May 24, 2024

what i understand is pre-appened a membership log at index 0,with term 0 that helpful for the cluster first startup, as your said we don't need to judge last_log_index.
But not first startup, even if add this index 0 term 0 log , it will be skipped without any impact
Right?

from openraft.

drmingdrmer avatar drmingdrmer commented on May 24, 2024

But not first startup, even if add this index 0 term 0 log , it will be skipped without any impact
Right?

If a node has received any log from some Leader, when starting up it has not to add a log at (0,0);

If a node has no logs at all, when initialize(members) is called, it should add a membership log at (0,0);

from openraft.

eliasyaoyc avatar eliasyaoyc commented on May 24, 2024

Okk,i seem to understand.

from openraft.

drmingdrmer avatar drmingdrmer commented on May 24, 2024

@eliasyaoyc
I am not fully sure this issue can be done before #49 and #61 are done. 🤔

from openraft.

eliasyaoyc avatar eliasyaoyc commented on May 24, 2024

today or tomorrow.

from openraft.

drmingdrmer avatar drmingdrmer commented on May 24, 2024

today or tomorrow.

I mean, this issue may be affected by the changes introduced by #49 and #61

from openraft.

eliasyaoyc avatar eliasyaoyc commented on May 24, 2024

general plan, add a param on RaftInner.
when RaftCore::spanw called, then get_log_state will used that determine this node whether received any log.
no log mark this param is true, then identify this param to determine whether to send term 0,index 0 log.

from openraft.

drmingdrmer avatar drmingdrmer commented on May 24, 2024

What is the name of param that will be added? Since IMO, it could always read the state from storage without the help of other additional fields.

Currently, the implementation adds a blank log entry at term:0, index:0, so that the initial value of such as last_log_id is valid.

I've been trying to remove this initial log term:0,index:0. After these get merged, it'd be simpler to get this issue done.

from openraft.

eliasyaoyc avatar eliasyaoyc commented on May 24, 2024

What is the name of param that will be added? Since IMO, it could always read the state from storage without the help of other additional fields.

I don't know how to notify initialize(members) that needs to add a term:0, index:0 log without additional field.

from openraft.

drmingdrmer avatar drmingdrmer commented on May 24, 2024

self.core.last_log_id.is_none() would be enough to ensure it is a uninitialized node I think 🤔

from openraft.

eliasyaoyc avatar eliasyaoyc commented on May 24, 2024

yes, last_log.is_none() can complete this work.
but initialize(members) haven't core reference.

    pub fn new(id: NodeId, config: Arc<Config>, network: Arc<N>, storage: Arc<S>) -> Self {
       ...
       let raft_handle = RaftCore::spawn(id, config, network, storage, rx_api, tx_metrics, rx_shutdown);
       ...
    }
    pub async fn initialize(&self, members: BTreeSet<NodeId>) -> Result<(), InitializeError> {
        let (tx, rx) = oneshot::channel();
        self.call_core(RaftMsg::Initialize { members, tx }, rx).await
    }

Is there something wrong with my understanding? 😭

from openraft.

drmingdrmer avatar drmingdrmer commented on May 24, 2024

These should be done in handle_init_with_config().

I've get this done in: https://github.com/datafuselabs/openraft/pull/107/files#diff-2b96982d340b2d4f989026d55516c495678f2320fe05d2841c65748f52c42ff5

from openraft.

drmingdrmer avatar drmingdrmer commented on May 24, 2024

from openraft.

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.