Skip to content

Engine::sync() never flushes to disk #395

@AustenSchunk

Description

@AustenSchunk

Basically, engine.sync() creates an empty LogBatch and calls engine.write(). However, inside engine.write() there is an exit early if empty condition.

  • Engine::sync creates an empty write batch here
/// Synchronizes the Raft engine.
pub fn sync(&self) -> Result<()> {
    self.write(&mut LogBatch::default(), true)?;
    Ok(())
}
if log_batch.is_empty() {
    return Ok(0);
}

Unless I'm missing something, engine.sync() is always a no-op and will hit that .is_empty() block every time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributionThis PR is from a community contributor.first-time-contributorIndicates that the PR was contributed by an external member and is a first-time contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions