Skip to content

Releases: databendlabs/openraft

v0.9.6

25 Apr 10:03
Compare
Choose a tag to compare

Summary:

  • Added:
    • 5776139d Add #[since(version="1.0")] to specify first version of a feature.
    • b172dc8e Add macro expand!() to expand a template.
  • Improved:
    • 99596c75 declare_raft_types allows the types in any order.
  • Fixed:
    • 14d42e4f Load mebmership since last_applied, not last_membership.index on startup.

Detail:

Added:

  • Added: 5776139d Add #[since(version="1.0")] to specify first version of a feature; by 张炎泼; 2024-04-12

    #[since(version = "1.0.0")] adds a doc line /// Since: Version(1.0.0).

    Example:

    /// Foo function
    ///
    /// Does something.
    #[since(version = "1.0.0")]
    fn foo() {}

    The above code will be transformed into:

    /// Foo function
    ///
    /// Does something.
    ///
    /// Since: Version(1.0.0)
    fn foo() {}
  • Added: b172dc8e Add macro expand!() to expand a template; by 张炎泼; 2024-04-13

    expand!() renders a template with arguments multiple times.

    Example:

    expand!(KEYED, // ignore duplicate by `K`
            (K, T, V) => {let K: T = V;},
            (a, u64, 1),
            (a, u32, 2), // duplicate `a` will be ignored
            (c, Vec<u8>, vec![1,2])
    );

    The above code will be transformed into:

    let a: u64 = 1;
    let c: Vec<u8> = vec![1, 2];

Improved:

  • Improved: 99596c75 declare_raft_types allows the types in any order; by 张炎泼; 2024-04-13

    By rewriting the template expanding part with a #[proc_macro]
    expand!() defined in openraft_macros, declare_raft_types
    does not require the types in fixed order:

    Example:

    declare_raft_types!(All:
            D = (),
            NodeId = u64,
            R = (),
            Node = (),
    

Fixed:

  • Fixed: 14d42e4f Load mebmership since last_applied, not last_membership.index on startup; by 张炎泼; 2024-04-25

    Modify StorageHelper::last_membership_in_log() to scan the log
    starting from the last applied index rather than the index of the last
    applied membership log. This change reduces unnecessary I/O operations
    during startup, previously caused by scanning from an incorrect starting
    point.

v0.9.5

09 Apr 06:32
Compare
Choose a tag to compare

Summary:

  • Added:
    • e4fed706 Add Raft::is_initialized().
    • 3b18517a Add RaftTypeConfig::Responder to customize returning client write response.
    • c508a354 Raft::client_write_ff() ff for fire-and-forget.

Detail:

Added:

  • Added: e4fed706 Add Raft::is_initialized(); by 张炎泼; 2024-04-08

    Raft::is_initialized() returns true if this raft node is already
    initialized with Raft::initialize(), by checking if log is empty and
    vote is not written.

  • Added: 3b18517a Add RaftTypeConfig::Responder to customize returning client write response; by 张炎泼; 2024-04-03

    This commit introduces the Responder trait that defines the mechanism
    by which RaftCore sends responses back to the client after processing
    write requests. Applications can now customize response handling by
    implementing their own version of the RaftTypeConfig::Responder trait.

    The Responder::from_app_data(RaftTypeConfig::D) method is invoked to
    create a new Responder instance when a client write request is
    received.
    Once the write operation is completed within RaftCore,
    Responder::send(WriteResult) is called to dispatch the result
    back to the client.

    By default, RaftTypeConfig::Responder retains the existing
    functionality using a oneshot channel, ensuring backward compatibility.

    This change is non-breaking, requiring no modifications to existing
    applications.

  • Added: c508a354 Raft::client_write_ff() ff for fire-and-forget; by 张炎泼; 2024-04-08

    Raft<C>::client_write_ff() -> C::Responder::Receiver submit a client
    request to Raft to update the state machine, returns an application
    defined response receiver Responder::Receiver to receive the response.

    _ff means fire and forget.

    It is same as [Raft::client_write] but does not wait for the response.
    When using this method, it is the application's responsibility for
    defining mechanism building and consuming the Responder::Receiver.

Full Changelog: v0.9.4...v0.9.5

v0.9.4

08 Apr 06:06
Compare
Choose a tag to compare

Summary:

  • Changed:
    • 2b8bc842 Add default value to declare_raft_types.
  • Added:
    • 93c0d9ae Implement TryAsRef<ForwardToLeader<..>> for RaftError.

Detail:

Changed:

  • Changed: 2b8bc842 Add default value to declare_raft_types;

    Types used in declare_raft_types can be omitted, in which case the default type will be used.
    The default values for each type are:

    • D: String
    • R: String
    • NodeId: u64
    • Node: ::openraft::BasicNode
    • Entry: ::openraft::Entry<Self>
    • SnapshotData: Cursor<Vec<u8>>
    • AsyncRuntime: ::openraft::TokioRuntime

    Note that The types must be specified in the exact order:
    D, R, NodeId, Node, Entry, SnapshotData, AsyncRuntime.

    For example, to declare with only D, R and Entry types:

    openraft::declare_raft_types!(
       pub TypeConfig:
           D = ClientRequest,
           R = ClientResponse,
           Entry = MyEntry,
    );

    Type NodeId, Node, SnapshotData and AsyncRuntime will be filled
    with default values mentioned above.

    Or one can just use the default types for all:

    openraft::declare_raft_types!(pub TypeConfig);

    Upgrade tip:

    Ensures types declared in declare_raft_types are in the correct order

Added:

  • Added: 93c0d9ae Implement TryAsRef<ForwardToLeader<..>> for RaftError;

Full Changelog: v0.9.3...v0.9.4

Contributors

v0.9.2

19 Mar 12:52
Compare
Choose a tag to compare
  • Added:
    • 8b54a80f Raft::config() returns a ref to Config this raft node uses.
    • 7d5326ce add RaftMetrics::millis_since_quorum_ack.
  • Improved:
    • d4a3053f Update example network err implementation.
    • d2d155db Use Unreachable error in examples/raft-kv-rocksdb.
  • Fixed:
    • 17795e7f Ensure heartbeat results are returned to RaftCore.
    • 768dfdc9 Ensure RaftMetrics are sent after RaftDataMetrics and RaftServerMetrics.

v0.9.0

11 Mar 14:44
Compare
Choose a tag to compare

Upgrade guide from 0.8 to 0.9:
https://docs.rs/openraft/latest/openraft/docs/upgrade_guide/upgrade_08_09/index.html

What's Changed

  • Feature: define custom Entry type for raft log by @drmingdrmer in #720
  • Fix: trait RaftLogId should be public by @drmingdrmer in #726
  • Change: StoreBuilder does not need to run a test, it only needs to build a store by @drmingdrmer in #730
  • Feature: add methods to StorageIOError to simplify error creation by @drmingdrmer in #738
  • Change: remove Clone from trait AppData by @drmingdrmer in #740
  • Change: instead of a slice, RaftStorage::append_to_log() now accepts an IntoIterator by @drmingdrmer in #742
  • Improve: send AppendEntries response before committing entries by @drmingdrmer in #751
  • Change: remove unused trait RaftStorageDebug by @drmingdrmer in #759
  • Change: remove defensive check utilities by @drmingdrmer in #761
  • Change: move RaftStateMachine out of RaftStorage by @drmingdrmer in #763
  • Improve: move state machine operations to another task by @drmingdrmer in #767
  • Fix: if the application does not persist snapshot, build a snapshot when starting up by @drmingdrmer in #768
  • Improve: getting a snapshot does not block RaftCore task by @drmingdrmer in #773
  • Fix: debug level check by @drmingdrmer in #780
  • Improve: reduce rate to flush metrics by @drmingdrmer in #782
  • Change: RaftMetrics.replication type to BTreeMap<NodeId, Option<LogId>> by @drmingdrmer in #785
  • Feature: add backoff strategy for unreachable nodes by @drmingdrmer in #779
  • Change: move snapshot type definition from storage traits to RaftTypeConfig by @drmingdrmer in #799
  • Feature: add RaftMetrics::purged to report the last purged log id by @drmingdrmer in #809
  • Feature: add Wait::purged() to wait for purged to become the expected by @drmingdrmer in #810
  • Fix: replication should be able to shutdown when replicating snapshot to unreachable node by @drmingdrmer in #811
  • Feature: add RaftMetrics.vote, Wait::vote() by @drmingdrmer in #815
  • Improve: build snapshot in anohter task by @drmingdrmer in #816
  • Feature: new RaftNetwork API with argument RCPOption by @drmingdrmer in #825
  • Feature: RaftNetwork::send_append_entries() can return PartialSuccess by @drmingdrmer in #831
  • Change: remove unused error CommittedAdvanceTooMany by @drmingdrmer in #838
  • Fix: add_learner() should block forever by @drmingdrmer in #847
  • Feature: leader lease by @drmingdrmer in #848
  • Feature: add SnapshotPolicy::Never by @drmingdrmer in #854
  • Feature: add Raft::purge_log() by @drmingdrmer in #855
  • Change: add AsyncRuntime type parameter to RaftTypeConfig by @wvwwvwwv in #869
  • Feature: add ChangeMembers::SetNodes by @drmingdrmer in #876
  • Feature: add 'singlethreaded' raft mode by @wvwwvwwv in #878
  • Fix: restore replication progress when a leader starts up by @drmingdrmer in #884
  • Change: move external command trigger to dedicated Trigger struct by @drmingdrmer in #888
  • Change: move runtime config API to dedicated RuntimeConfigHandle by @drmingdrmer in #889
  • Change: RaftLogReaderExt::get_log_id() should not return last-purged-id by @drmingdrmer in #892
  • Change: move get_log_state() from RaftLogReader to RaftStorage by @drmingdrmer in #893
  • Feature: save committed log id by @drmingdrmer in #897
  • Feature: permit follower log to revert to earlier state with --features loosen-follower-log-revert by @drmingdrmer in #903
  • Feature: add feature flag "tracing-log" to emit log record for tracing event by @drmingdrmer in #908
  • Fix: Do not report snapshot.last_log_id to metrics until snapshot is finished building/installing by @drmingdrmer in #913
  • Fix: AsyncReadExt::read_buf() only reads at most 2MB per call by @drmingdrmer in #925
  • Fix: End tick_loop() when the receiver is gone. by @schreter in #930
  • Fix: avoid panic with "loosen-follower-log-revert" enabled by @drmingdrmer in #937
  • Fix: For single-threaded execution, there is no need for Send/Sync bounds by @schreter in #934
  • Change: remove N, LS, SM from Raft<C, N, LS, SM> by @drmingdrmer in #941
  • Feature: add PayloadTooLarge error by @drmingdrmer in #951
  • Feature: add Raft::access_raft_state() to access RaftState with a function by @drmingdrmer in #957
  • Feature: Add new methods to openraft::metrics::Wait by @drmingdrmer in #960
  • Feature: add Wait::voter_ids() and deprecate Wait::members() by @drmingdrmer in #961
  • Feature: add Raft::ensure_linearizable() to ensure linearizable read by @drmingdrmer in #964
  • Feature: add Wait::eq() and ge() to await a metics by @drmingdrmer in #967
  • Change: #959 ditch async_trait for the singlethreade feature by @wvwwvwwv in #982
  • Feature: add Raft::data_metrics() and Raft::server_metrics() by @YangKian in #990
  • Fix: Split serde bound for RaftError into serialize and deserialize by @tvsfx in #991
  • Feature: Add random number generator to AsyncRuntime by @schreter in #995
  • Feature: add Raft::get_snapshot() to get the last snapshot from state machine by @drmingdrmer in #1000
  • Fix: Remove implementation of Instant for std::time::Instant by @schreter in #1001
  • Feature: add Raft::install_complete_snapshot() to install a snapshot by @drmingdrmer in #1002
  • Feature: Add Raft::begin_receiving_snapshot() by @drmingdrmer in #1008
  • Change: remove AsyncRuntime::abort() by @drmingdrmer in #1012
  • Feature: RaftNetwork::snapshot() to send a complete snapshot by @drmingdrmer in #1009
  • Feature: feature flag generic-snapshot-data by @drmingdrmer in #1016
  • Change: remove deprecated RaftNetwork methods without option argument by @drmingdrmer in #1028
  • Change: rename Raft::install_complete_snapshot() to install_full_snapshot() by @drmingdrmer in #1030
  • Feature: AsyncRuntime::oneshot by @Miaxos in #1026
  • Change: remove openraft-0.7 compatibility support by @drmingdrmer in #1033
  • Feature: add trait RaftLogStorageExt to provide additional raft-log methods by @drmingdrmer in #1034
  • Change: Raft::begin_receiving_snapshot() does not need to check Vote by @drmingdrmer in #1037
  • Change: Raft::begin_receiving_snapshot() return only Fatal error. by @drmingdrmer in #1038
  • Fix: install_snapshot() should return local vote, not request vote by @drmingdrmer in #1042

New Contributors

Read more

v0.8.9

06 Mar 14:13
Compare
Choose a tag to compare

What's Changed

New Contributors

  • @HHoflittlefish777 made their first contribution in #842
  • @leiysky made their first contribution in #849

Full Changelog: v0.8.3...v0.8.9

Fix election timeout to reduce conflicts

19 Mar 03:30
Compare
Choose a tag to compare

Improved:

  • Improved: 23f4a73b AppDataResponse does not need a Clone trait bound; by 张炎泼; 2023-03-09

  • Improved: 664635e0 loosen validity check with RaftState.snapshot_last_log_id(); by 张炎泼; 2023-03-10

    A application may not persist snapshot. And when it restarted, the
    last-purged-log-id is not None but snapshot_last_log_id() is None.
    This is a valid state and should not emit error.

  • Improved: 54aea8a2 fix: delay election if a greater last log id is seen; by 张炎泼; 2023-03-14

    If this node sees a greater last-log-id on another node, it will be less
    likely to be elected as a leader.
    In this case, it is necessary to sleep for a longer period of time
    smaller_log_timeout so that other nodes with a greater last-log-id
    have a chance to elect themselves.

Changed:

  • Changed: 9ddb5715 RaftState: make RaftState.vote private. Accesses vote via 2 new public methods: vote_ref() and vote_last_modified().; by 张炎泼; 2023-03-12

  • Changed: 3b4f4e18 move log id related traits to mod openraft::log_id; by 张炎泼; 2023-03-14

    Move trait RaftLogId, LogIdOptionExt and LogIndexOptionExt from openraft::raft_types to mod openraft::log_id

Revert to standard heartbeat; Improve change-membership API; Fix bugs

07 Mar 03:13
Compare
Choose a tag to compare

Full change-log: https://github.com/datafuselabs/openraft/blob/v0.8.2/change-log.md#v082

Changed:

  • Changed: 342d0de2 rename variants in ChangeMembers, add AddVoters; by 张炎泼; 2023-03-01

Added:

  • Added: 50821c37 impl PartialEq for Entry; by 张炎泼; 2023-03-02

Fixed:

  • Fixed: 97fa1581 discard blank log heartbeat, revert to the standard heartbeat; by 张炎泼; 2023-03-04

  • Fixed: b5caa44d Wait::members() should not count learners as members; by 张炎泼; 2023-03-04

Add Membership methods: voter_ids(), learner_ids(), get_node()

28 Feb 08:19
Compare
Choose a tag to compare

Feature: add Membership methods: voter_ids(), learner_ids(), get_node()

Generalization and refactor code base

28 Feb 02:39
Compare
Choose a tag to compare

Openraft 0.8 focused on refactoring codebase, including:

  • Move logic to Engine, which is a event-driven non-async mod, in order to make logic more clear and tests easier: #291
  • Migrate to a more generic API design: NodeId and Node are no longer concrete types but a trait, so it is possible for an application to use any node-id type or node type.
  • Make the consensus implementation more generic: it supports both multi-leader per term mode and single-leader per term mode: feature flag single-term-leader

Full change log: https://github.com/datafuselabs/openraft/blob/release-0.8/change-log/v0.8.0.md