Giter Club home page Giter Club logo

Comments (6)

avantgardnerio avatar avantgardnerio commented on June 20, 2024 1

Thanks for the clarification!

from openraft.

github-actions avatar github-actions commented on June 20, 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.

drmingdrmer avatar drmingdrmer commented on June 20, 2024

0.7.3 does not implement persistent learner storage in Membership.

If you need this feature, use the main branch instead. :(

from openraft.

avantgardnerio avatar avantgardnerio commented on June 20, 2024

Thanks for your response. I switched to the master branch, and I can confirm it works there!

I did want to ask about some possibly unrelated behavior: on the 0.7.x branch I saw Blank messages were sent as heartbeats, but I didn't think they were appended to the log or applied to the state machine. In master, I see lots of Blank traffic:

Node 1: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }, payload: Blank }
Node 2: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }, payload: Blank }
Node 3: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }, payload: Blank }
Node 5: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }, payload: Blank }
Node 4: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }
Node 4: sending AppendEntriesRequest to 1 AppendEntriesRequest { vote: Vote { term: 1, node_id: 4, committed: true }, prev_log_id: Some(LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }), entries: [Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }], leader_commit: Some(LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }) }
Node 4: sending AppendEntriesRequest to 2 AppendEntriesRequest { vote: Vote { term: 1, node_id: 4, committed: true }, prev_log_id: Some(LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }), entries: [Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }], leader_commit: Some(LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }) }
Node 4: sending AppendEntriesRequest to 3 AppendEntriesRequest { vote: Vote { term: 1, node_id: 4, committed: true }, prev_log_id: Some(LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }), entries: [Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }], leader_commit: Some(LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }) }
Node 4: sending AppendEntriesRequest to 5 AppendEntriesRequest { vote: Vote { term: 1, node_id: 4, committed: true }, prev_log_id: Some(LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }), entries: [Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }], leader_commit: Some(LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 69 }) }
Node 1: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }
Node 2: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }
Node 3: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }
Node 5: append_to_log log_idx=LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 } entry=Entry { log_id: LogId { leader_id: LeaderId { term: 1, node_id: 4 }, index: 70 }, payload: Blank }

Is that normal? It seems like heartbeats in the raft log would cause quite a bit of write amplification.

from openraft.

avantgardnerio avatar avantgardnerio commented on June 20, 2024

Follow up confirmation, this filter used to work for heartbeats:

impl RaftNetwork<ColDbRaftConfig> for GrpcNetworkConnection {
    async fn send_append_entries(
        &mut self,
        req: AppendEntriesRequest<ColDbRaftConfig>,
    ) -> Result<AppendEntriesResponse<Nid>, RPCError<Nid, UuidNode, AppendEntriesError<Nid>>> {
        let is_heartbeat = req.entries.is_empty();
        if !is_heartbeat {
            println!("Node {}: sending AppendEntriesRequest to {} {:?}", self.owner.node_id, self.target, req);
        }

from openraft.

drmingdrmer avatar drmingdrmer commented on June 20, 2024

Yes, the heartbeat message is changed:

In main branch, I was trying to implement a heartbeat with a message with a blank log, instead of just a blank message, i.e., every heartbeat will commit a read log entry.

This simplifies the logic when granting a candidate's vote request. But it introduces unnecessary IO(to flush blank log to disk).

See:

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.