fix(deps): update rust crate openraft to 0.9.0 #39
			No reviewers
			
				
				
			
		
		
		
	
	
	
		Labels
		
	
	
	
	No labels
	
		
		
			
	
	bug
		
			duplicate
		
			enhancement
		
			help wanted
		
			invalid
		
			question
		
			renovate-bot
		
			renovate-security
		
			security
		
			wontfix
		
	
		No milestone
		
			
		
	No project
	
		
	
	
	
	
		No assignees
		
	
	
		
			
		
	
	
	
		1 participant
	
	
		
		
	Notifications
	
		
	
	
	
		
	
	
	Due date
No due date set.
	
		Dependencies
		
		
	
	
	No dependencies set.
	
	
		
	
	
		
			Reference
		
	
	
		
	
	
			mCaptcha/dcache!39
			
		
	
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	
	No description provided.
		
		Delete branch "renovate/openraft-0.x"
	
	Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
0.8.8->0.9.0Release Notes
datafuselabs/openraft (openraft)
v0.9.21Compare Source
v0.9.20Compare Source
Summary:
Detail:
Fixed:
Fixed: 33fde29d reset progress when heartbeat response indicates conflict; by Zhang Yanpo; 2025-06-19
With
loosen-follower-log-revertenabled:Before this fix,
RaftCoreignoredconflictmessages fromHeartbeatRPCs,preventing leaders from discovering follower state changes. When a follower's
state reverted and responded with a conflict message, the leader wouldn't
retransmit necessary data to the follower.
This commit ensures
conflictresponses are always processed properly andprogress is reset to trigger data retransmission to the follower.
v0.9.19Compare Source
Summary:
Detail:
Improved:
Improved: 9bfd517f tolerate leader state reversion upon restart; by Zhang Yanpo; 2025-06-10
When a leader restarted and its log reverted, and tried to re-elect
itself as leader:
And when vote request is rejected and see a greater vote,
it should only update to the non-committed version of the responded vote
to its local state:
This prevents a dangerous scenario when state reversion is allowed:
become leader again;
lost or inconsistent;
By using the non-committed version, we prevent this reverted node from
becoming leader while still allowing proper vote updates for legitimate
cases.
v0.9.18Compare Source
Summary:
serdefeature detection fromdeclare_raft_types!macro.Detail:
Fixed:
Fixed: 5ae1965b Remove
serdefeature detection fromdeclare_raft_types!macro; by 张炎泼; 2024-11-30The
[cfg_attr(feature = "serde")]feature detection forRaftTypeConfigimplementation should not be evaluated in applicationcrates when the
declare_raft_types!macro is called. This detectionlogic should be removed from the macro and instead added to each type
that uses
RaftTypeConfig.v0.9.17Compare Source
Summary:
Copybound fromNodeId.Detail:
Improved:
Improved: 536a435e Chunk read log entry and check range on startup; by 张炎泼; 2024-09-14
Implement chunk-based reading of committed log entries when
re-applying to state machine upon startup.
Add validation for log entry indexes, to avoid applying wrong entries
to state machine.
Improved: dc18dc6f remove
Copybound fromNodeId; by 张炎泼; 2024-10-14The
NodeIdtype is currently defined as:This commit removes the
Copybound fromNodeId.This modification will allow the use of non-
Copytypes asNodeId,providing greater flexibility for applications that prefer
variable-length strings or other non-
Copytypes for nodeidentification.
This change maintain compatibility by updating derived
Copyimplementations with manual implementations:
v0.9.16Compare Source
What's Changed
Raft::change_membership()on uninitialized node by @drmingdrmer in #1243Full Changelog: https://github.com/datafuselabs/openraft/compare/v0.9.15...v0.9.16
v0.9.15Compare Source
Summary:
votewhen seeing higher vote inRequestVoteresponse.TypeConfigExtto simplifyRaftTypeConfigAccess.Detail:
Fixed:
Fixed: 0b1293f3 Should not update
votewhen seeing higher vote inRequestVoteresponse; by 张炎泼; 2024-07-04This commit addresses an issue in the vote updating mechanism during the
handling of
RequestVoteresponses. Previously, encountering a highervotein a response incorrectly led to an update of the localstate.vote, which could break Raft consistency rules.Issue Description:
voteseen in aRequestVoteresponse does not necessarilymean that the vote is granted. The local
state.voteshould only beupdated if the vote is actually granted, i.e., the responding node has
a higher
voteand alast_log_idthat allows it to become a leader.Resolution:
state.votewill no longer be updated upon merely seeing ahigher
votein theRequestVoteresponse. Instead, this higher votewill be recorded in
last_seen_votefor consideration in the nextelection cycle, without updating the current
state.vote.This bug is introduced in:
f0a9e34Fixed: 94b1e843 Clarify that receiving an equal vote does not grant leadership.; by 张炎泼; 2024-08-28
A node's
votemay be updated when a leader observes a higher vote.In such cases, the leader updates its local vote and steps down.
However, this vote update does not imply that the node accepts the
higher vote as valid for leadership, as it has not yet compared their
logs.
In this commit, re-enable
VoteResponse.vote_grantedto indicate a voteis granted.
This commit also fix:
Added:
Added: 5f5d7e9f Add
TypeConfigExtto simplifyRaftTypeConfigAccess; by 张炎泼; 2024-07-03This commit introduces a new trait,
TypeConfigExt, which extendsRaftTypeConfig. The purpose of this trait is to simplify the access tovarious functionalities provided by the
RaftTypeConfigtrait,enhancing code readability and reducing complexity.
Methods Added to
TypeConfigExt:now()sleep()sleep_until()timeout()timeout_at()oneshot()spawn()Usage Improvement:
<<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::Instant::now(),you can now simply call
C::now().v0.9.14Compare Source
v0.9.13Compare Source
Summary:
DecomposeResultto simplify error handling.Detail:
Added:
Added: fb49efb3 Add
DecomposeResultto simplify error handling; by 张炎泼; 2024-06-20This commit treats remote errors occurring during RPC, like a
Fatalerror, as an
Unreachableerror. This is due to Openraft's currentinability to distinguish between an unreachable node and a broken node.
DecomposeResult: Introduced to simplify handlingcomposite errors. It converts a result of the
form
Result<R, ErrorAOrB>into a nested result
Result<Result<R, ErrorA>, ErrorB>.v0.9.12Compare Source
Summary:
RaftLogReader::limited_get_log_entries().Detail:
DocFixed:
Added:
Added: 8cd00388 Add
RaftLogReader::limited_get_log_entries(); by 张炎泼; 2024-06-16This commit adds the
RaftLogReader::limited_get_log_entries()method,which enables applications to fetch log entries that are equal to or
smaller than a specified range. This functionality is particularly
useful for customizing the size of AppendEntries requests at the storage
API level.
Applications can now decide the number of log entries to return based
on the input range. If the application determines that the requested
log entries range is too large for a single RPC, it can opt to return
only the first several requested log entries instead of the full
range.
The method provides a default implementation that delegates the
operation to
RaftLogReader::try_get_log_entries.This enhancement allows for more flexible and efficient handling of log
entries, particularly in scenarios where network constraints or
performance considerations require smaller data transfers.
v0.9.11Compare Source
Summary:
Detail:
Fixed:
Fixed: 30cdf5fb New leader must flush blank log; by 张炎泼; 2024-05-14
This commit addresses a critical issue where if a new leader does not
flush the blank log to disk upon becoming established and then restarts
immediately, there is a possibility that previously committed data
becomes invisible to readers.
Before the blank log is flushed, the leader (identified by vote
v3)assumes it will be flushed and commits this log once (|quorum|-1)
replication responses are received. If the blank log is lost and the
server is restarted, data committed by a new leader (vote
v2) maynot be visible.
This issue is addressed by utilizing
LeaderHandler::leader_append_entries()instead of
ReplicationHandler::append_blank_log(), where the formerdoes not wait for the blank log to flush.
Changes:
When assigning log IDs to log entries, the
Leading.last_log_id,which represents the state of the log proposer (equivalent term in
Paxos is Proposer), should be used instead of
RaftState.last_log_id,which represents the state of the log receiver (equivalent term in
Paxos is Acceptor).
Consequently, the method
assign_log_ids()has been moved fromRaftStatetoLeading.Avoid manual implementation of duplicated logic:
During
initialize(), reuseFollowingHandler::do_append_entries()to submit the very first log to storage.
In
establish_leader(), reuseLeaderHandler::leader_append_entries()to submit log to storageand remove
ReplicationHandler::append_blank_log().Remove
Command::AppendEntry.v0.9.10Compare Source
Summary:
cancelpassed tofull_snapshot()should bestatic.Detail:
Improved:
cancelpassed tofull_snapshot()should bestatic; by 张炎泼; 2024-05-06v0.9.9Compare Source
Summary:
Detail:
Fixed:
Fixed: 8b62c797 Immediate response when snapshot installation is unnecessary; by 张炎泼; 2024-05-05
When
Engine::handle_install_full_snapshot()is called and the providedsnapshot is not up-to-date, the snapshot should not be installed, and
the response should be sent back immediately. Previously, the method
might delay the response unnecessarily, waiting for an installation
process that would not proceed.
This commit adjusts the logic so that if the snapshot is recognized as
outdated, it immediately returns a
NoneCondition, ensuring thecaller is informed straightaway that no installation will occur.
v0.9.8Compare Source
Summary:
Chunkedshould reset offset 0 when aSnapshotMismatcherror is received.Detail:
Fixed:
Fixed: fd5c657f
Chunkedshould reset offset 0 when aSnapshotMismatcherror is received; by 张炎泼; 2024-05-02When a
SnapshotMismatchis received, the sending end should re-sendall snapshot data from the beginning.
v0.9.7Compare Source
Summary:
Detail:
Fixed:
v0.9.6Compare Source
Summary:
#[since(version="1.0")]to specify first version of a feature.expand!()to expand a template.declare_raft_typesallows the types in any order.last_applied, notlast_membership.indexon 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:
The above code will be transformed into:
Added: b172dc8e Add macro
expand!()to expand a template; by 张炎泼; 2024-04-13expand!()renders a template with arguments multiple times.Example:
Improved:
Improved: 99596c75
declare_raft_typesallows the types in any order; by 张炎泼; 2024-04-13By rewriting the template expanding part with a
#[proc_macro]expand!()defined inopenraft_macros,declare_raft_typesdoes not require the types in fixed order:
Example:
Fixed:
Fixed: 14d42e4f Load mebmership since
last_applied, notlast_membership.indexon startup; by 张炎泼; 2024-04-25Modify
StorageHelper::last_membership_in_log()to scan the logstarting 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.5Compare Source
Summary:
Raft::is_initialized().RaftTypeConfig::Responderto customize returning client write response.Raft::client_write_ff()ff for fire-and-forget.Detail:
Added:
Added: e4fed706 Add
Raft::is_initialized(); by 张炎泼; 2024-04-08Raft::is_initialized()returnstrueif this raft node is alreadyinitialized with
Raft::initialize(), by checking if log is empty andvoteis not written.Added: 3b18517a Add
RaftTypeConfig::Responderto customize returning client write response; by 张炎泼; 2024-04-03This commit introduces the
Respondertrait that defines the mechanismby which
RaftCoresends responses back to the client after processingwrite requests. Applications can now customize response handling by
implementing their own version of the
RaftTypeConfig::Respondertrait.The
Responder::from_app_data(RaftTypeConfig::D)method is invoked tocreate a new
Responderinstance when a client write request isreceived.
Once the write operation is completed within
RaftCore,Responder::send(WriteResult)is called to dispatch the resultback to the client.
By default,
RaftTypeConfig::Responderretains the existingfunctionality 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-08Raft<C>::client_write_ff() -> C::Responder::Receiversubmit a clientrequest to Raft to update the state machine, returns an application
defined response receiver
Responder::Receiverto receive the response._ffmeans 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: https://github.com/datafuselabs/openraft/compare/v0.9.4...v0.9.5
v0.9.4Compare Source
Summary:
declare_raft_types.TryAsRef<ForwardToLeader<..>>forRaftError.Detail:
Changed:
Changed: 2b8bc842 Add default value to
declare_raft_types;Types used in
declare_raft_typescan be omitted, in which case the default type will be used.The default values for each type are:
D:StringR:StringNodeId:u64Node:::openraft::BasicNodeEntry:::openraft::Entry<Self>SnapshotData:Cursor<Vec<u8>>AsyncRuntime:::openraft::TokioRuntimeNote that The types must be specified in the exact order:
D,R,NodeId,Node,Entry,SnapshotData,AsyncRuntime.For example, to declare with only
D,RandEntrytypes:Type
NodeId,Node,SnapshotDataandAsyncRuntimewill be filledwith default values mentioned above.
Or one can just use the default types for all:
Upgrade tip:
Ensures types declared in
declare_raft_typesare in the correct orderAdded:
TryAsRef<ForwardToLeader<..>>forRaftError;Full Changelog: https://github.com/datafuselabs/openraft/compare/v0.9.3...v0.9.4
Contributors
v0.9.3Compare Source
v0.9.2Compare Source
Raft::config()returns a ref to Config this raft node uses.RaftMetrics::millis_since_quorum_ack.Unreachableerror inexamples/raft-kv-rocksdb.RaftCore.RaftMetricsare sent afterRaftDataMetricsandRaftServerMetrics.v0.9.1Compare Source
v0.9.0Compare Source
Summary:
RaftLogReaderExt::get_log_id()should not return last-purged-id.get_log_state()from RaftLogReader to RaftStorage.N, LS, SMfromRaft<C, N, LS, SM>.optionargument.ChangeMembers::SetNodes(#876).--features loosen-follower-log-revert.PayloadTooLargeerror.Raft::with_raft_state()to accessRaftStatewith a function.openraft::metrics::Wait.Raft::ensure_linearizable()to ensure linearizable read.Raft::data_metrics()andRaft::server_metrics()(#990).Raft::get_snapshot()to get the last snapshot from state machine.Raft::install_full_snapshot()to install a snapshot.Raft::begin_receiving_snapshot().RaftNetwork::full_snapshot()to send a complete snapshot.generic-snapshot-data.RaftLogStorageExtto provide additional raft-log methods.snapshot.last_log_idto metrics until snapshot is finished building/installing.AsyncReadExt::read_buf()only reads at most 2MB per call.tick_loop()when the receiver is gone.RaftErrorinto serialize and deserialize.async_traitwith RPITIT.Detail:
Changed:
Changed: 6098f5cf add AsyncRuntime type parameter to RaftTypeConfig (#869); by wvwwvwwv; 2023-06-21
Add AsyncRuntime type parameter to RaftTypeConfig
This commit introduces the AsyncRuntime type parameter to
RaftTypeConfig, allowing applications to choose their preferred
asynchronous runtime, such as tokio or async-std.
Parameterize Instant type for flexibility with async runtimes
To create a more flexible interface between the crate and
asynchronous runtimes, the Instant type is now associated with the
async runtime. This is because Instant::now can have different
implementations. This commit adds the trait Instant and TokioInstant
for representing system states.
Fix: #741
Changed: 4c488a61 move external command trigger to dedicated Trigger struct (#888); by 张炎泼; 2023-07-01
Refactor: move RaftTypeConfig to separate file
Change: move external command trigger to dedicated Trigger struct
Moved trigger election, heartbeat, snapshot and purge log from
Raftto a new
Triggerstruct, to separate externally trigger actions fromthe main Raft API.
Marked the old trigger methods in
Raftas deprecated, and recommendedusing the new
Triggerstruct instead.The main motivation of these changes is to organize the Raft API in a
more structured way, by extracting trigger actions into a dedicated
struct, instead of mixing them together in the
RaftAPI.Changed: 5d37d4c3 move runtime config API to dedicated RuntimeConfigHandle; by 张炎泼; 2023-07-02
Changed: 8a81df53
RaftLogReaderExt::get_log_id()should not return last-purged-id; by 张炎泼; 2023-07-02get_log_id()should only return present log id,and should not be responsible to return id of an already purged log
entry, which introduce unnecessary complexity.
Upgrade tip:
An RaftStorage implementation should have already maintained the
last-purge-log-id. Avoid getting it via
RaftLogReaderExt::get_log_id().Changed: 330b1fff move
get_log_state()from RaftLogReader to RaftStorage; by 张炎泼; 2023-07-03Move the
get_log_state()method from theRaftLogReadertrait tothe
RaftStoragetrait.For applications that enable the
storage-v2feature,get_log_state()will be moved fromRaftLogReadertoRaftLogStorage.get_log_state()should only be called once when openraft starts up.Only the
ReplicationCoreusesRaftLogReader, and it does not needget_log_state(). The log entries to replicate are decided byRaftCore.Upgrade tip:
Implement
get_log_state()in theRaftStorageorRaftLogStoragetrait instead of
RaftLogReader.Refer to the changes in
rocksstore/src/lib.rsin this commit for anexample.
Changed: 87c0d74f remove
N, LS, SMfromRaft<C, N, LS, SM>; by 张炎泼; 2023-11-20Raft<C, ..>: is a control handle ofRaftCoreand it does not directlyrely on
N: RaftNetworkFactory,LS: RaftLogStorageandSM: RaftStateMachine.Thus these types should not be part of
Raft.In this commit, we remove
N, LS, SMfromRaft<C, N, LS, SM>,RaftInner<C, N, LS>andRaftMsg<C, N, LS>.Type
N, LS, SMnow are only used byRaft::new()which needs thesetypes to create
RaftCore.Raft::external_request(): Another change is the signature of theFnpassed toRaft::external_request()changes fromFnOnce(&RaftState, &mut LS, &mut N)toFnOnce(&RaftState).Fix: the
FnOncepassed toRaft::external_request()should alwaysbe
Send, unoptionally. Because it is used to send fromRafttoRaftCore.Fix: #939
Changed: 22cd3bb4 remove deprecated RaftNetwork methods without
optionargument; by 张炎泼; 2024-02-24Changed: a1c7f6e6 remove openraft-0.7 compatibility support; by 张炎泼; 2024-03-04
Added:
Added: d629dbeb add
ChangeMembers::SetNodes(#876); by 张炎泼; 2023-06-22During dynamic cluster changes, we sometimes need to update an existing
node, for example changing its network address.
Adding
SetNodesvariant toChangeMembersallows replacing anexisting node directly.
However, this also carries risk of creating a split brain scenario if
used incorrectly.
Added: 104983db add 'singlethreaded' raft mode (#878); by wvwwvwwv; 2023-06-27
The new feature gate forces the raft instance to be used by a single thread by not implementing
Sendfor certain data structures and substituting calls totokio::spawnwithtokio::spawn_localwhen using thetokioasynchronous runtime.Re-export
add_async_traitfor application to define a!Sendasync trait.Fix: #862
Added: 942ec78b save committed log id; by 张炎泼; 2023-07-16
Wrote committed log id to storage
Save the committed log id to storage before Raft apply log entries. This can
recover state machine to the state corresponding to the committed log id upon
system startup.
Re-applied log entries after startup
If the last applied log id is smaller than the committed log id saved in
storage, re-apply log entries from the next index of last applied log id to the
committed log id.
Version 1 storage API
RaftStorageand Version 2 storage APIRaftLogStorageboth add APIsave_committed()andread_committed()to support saving/reading committed log id.
These two new API are optional and provides default dummy
implementation, an application does not need any modifications if it
does not need this feature.
Added: 6d42c6e2 permit follower log to revert to earlier state with
--features loosen-follower-log-revert; by 张炎泼; 2023-07-20Add a new feature flag
loosen-follower-log-revert, to permit thefollower's log to roll back to an earlier state without causing the
leader to panic.
Although log state reversion is typically seen as a bug, enabling it can
be useful for testing or in some special scenarios.
For instance, in an even number nodes cluster, erasing a node's data
and then rebooting it(log reverts to empty) will not result in data
loss.
Added: 3fc8ede6 add feature flag "tracing-log" to emit log record for tracing event; by 张炎泼; 2023-08-02
Added: 961469c0 add
PayloadTooLargeerror; by 张炎泼; 2023-11-24If a
RaftNetworkimplmentation found anAppendEntriesRequestis toolarge, it could return a
PayloadTooLarge::new_entries_hint(n)error totell openraft devide request into smaller chunks containing at most
nentries. Openraft will limit the number of entries in the next 10
AppendEntrieRPC.Exmaple:
Added: ee3b9421 add
Raft::with_raft_state()to accessRaftStatewith a function; by 张炎泼; 2023-12-06This new method serves as a convenience wrapper around
Raft::external_request(), streamlining use cases where only a singlevalue needs to be returned.
Thanks to @tvsfx
Added: d1607529 Add new methods to
openraft::metrics::Wait; by 张炎泼; 2023-12-07Add
log_index(),log_index_at_least(),applied_index()andapplied_index_at_least()toopenraft::metrics::Waitto replaceWait::log()andWait::log_at_least().These two methods are deprecated since
0.9.0because the names doesnot imply that they will be blocked by
last_appliedlog index.Thanks to @tvsfx
Added: 79372b4d add
Raft::ensure_linearizable()to ensure linearizable read; by 张炎泼; 2023-12-07The
Raft::is_leader()method does not fully ensure linearizable readoperations and is deprecated in this version. Instead, applications
should use the
Raft::ensure_linearizable()method to guaranteelinearizability.
Under the hood,
Raft::ensure_linearizable()obtains aReadIndexfromRaftCoreif it remains the leader, and blocks until the statemachine applies up to the
ReadIndex. This process ensures that theapplication observes all state visible to a preceding read operation.
Upgrade tip:
Replace
Raft::is_leader()withRaft::ensure_linearizable().Added: 82615896 add
Raft::data_metrics()andRaft::server_metrics()(#990); by YangKian; 2024-01-14Added: c1cf8a82 add
Raft::get_snapshot()to get the last snapshot from state machine; by 张炎泼; 2024-02-10Added: c1aa1b5a add
Raft::install_full_snapshot()to install a snapshot; by 张炎泼; 2024-02-10Using this method, the application provides a full snapshot to
Openraft, which is then used to install and replace the state machine.
It is entirely the responsibility of the application to acquire a
snapshot through any means: be it in chunks, as a stream, or via shared
storage solutions like S3.
This method necessitates that the caller supplies a valid
Votetoconfirm the legitimacy of the leader, mirroring the requirements of
other Raft protocol APIs such as
append_entriesandvote.Added: 5631ecfb Add
Raft::begin_receiving_snapshot(); by 张炎泼; 2024-02-14Raft::begin_receiving_snapshot()request the state machine to return aSnapshotDatafor receiving snapshot from the leader.Internally it calls
RaftStateMachine::begin_receiving_snapshot()Handling snapshot receiving is moved out of state-machine worker task.
Now it is in implemented outside the
RaftCore.Receiving snapshot could be totally application specific and should not
be part of Openraft.
The in sm-worker snapshot receiving is removed.
Added: 687fcf2f
RaftNetwork::full_snapshot()to send a complete snapshot; by 张炎泼; 2024-02-11Add
RaftNetwork::snapshot()to send a complete snapshot and movesending snapshot by chunks out of ReplicationCore.
To enable a fully customizable implementation of snapshot transmission
tailored to the application's needs, this commit relocates the
chunk-by-chunk transmission logic from
ReplicationCoreto a newsub mod,
crate::network::snapshot_transport.The
snapshot_transportmod provides a default chunk-based snapshottransmission mechanism, which can be overridden by creating a custom
implementation of the
RaftNetwork::full_snapshot()method. As part of thiscommit,
RaftNetwork::full_snapshot()simply delegates tosnapshot_transport.Developers may use
snapshot_transportas a reference when implementingtheir own snapshot transmission strategy.
Snapshot transmission is internally divided into two distinct phases:
Upon request for snapshot transmission,
ReplicationCoreinitiates anew task
RaftNetwork::full_snapshot()dedicated to sending a completeSnapshot. This task should be able to be terminated gracefully bysubscribing the
cancelfuture.Once the snapshot has been fully transmitted by
RaftNetwork::full_snapshot(), the task signals an event back toReplicationCore. Subsequently,ReplicationCoreinformsRaftCoreof the event, allowing it to acknowledge the completion of the
snapshot transmission.
Other changes:
ReplicationCorehas twoRaftNetworks, one for log replication andheartbeat, the other for snapshot only.
ReplicationClosedbecomes a public error for notifying theapplication implemented sender that a snapshot replication is
canceled.
StreamingErroris introduced as a container of errors that may occurin application defined snapshot transmission, including local IO
error, network errors, errors returned by remote peer and
ReplicationClosed.The
SnapshotResponsetype is introduced to differentiate it from theInstallSnapshotResponse, which is used for chunk-based responses.Added: 907f5f74 feature flag
generic-snapshot-data; by 张炎泼; 2024-02-16Add feature flag
generic-snapshot-data: when enabled,SnapshotDatadoes not have
AsyncSeek + AsyncRead + AsyncWritebound.This enables application to define their own snapshot format and
transmission protocol.
If this feature flag is not eabled, no changes are required for
application to upgrade Openraft.
On the sending end(leader that sends snapshot to follower):
Without
generic-snapshot-data:RaftNetwork::snapshot()provides a default implementation that invokes the chunk based API
RaftNetwork::install_snapshot()for transmit.With
generic-snapshot-dataenabled:RaftNetwork::snapshot()must beimplemented to provide application customized snapshot transmission.
Application does not need to implement
RaftNetwork::install_snapshot().On the receiving end(follower):
Raft::install_snapshot()is available only whengeneric-snapshot-datais disabled.Add an example
examples/raft-kv-memstore-generic-snapshot-datawithgeneric-snapshot-dataenabled.In this example snapshot is transmitted without fragmentation, i.e., via
RaftNetwork::snapshot(). The chunk based APIRaftNetwork::install_snapshot()is not used.In a production scenario, a snapshot can be transmitted in arbitrary
manner.
Added: 884f0da6 add trait
RaftLogStorageExtto provide additional raft-log methods; by 张炎泼; 2024-03-04The
RaftLogReaderExt::blocking_append()method enables the caller toappend logs to storage in a blocking manner, eliminating the need to
create and await a callback. This method simplifies the process of
writing tests.
Fixed:
Fixed: 86b46a08 restore replication progress when a leader starts up (#884); by 张炎泼; 2023-06-29
As a leader, the replication progress to itself should be restored upon
startup.
And if this leader is the only node in a cluster, it should re-apply all
of the logs to state machine at once.
Fixed: 97254a31 Do not report
snapshot.last_log_idto metrics until snapshot is finished building/installing; by 张炎泼; 2023-10-18Before this commit
RaftMetrics.snapshotcontains the last log id of asnapshot that is going to install. Therefore there is chance the
metrics is updated but the store does not.
In this commit,
RaftMetrics.snapshotwill only be updated when asnapshot is finished building or installing, by adding a new field
snpashottoIOStatefor tracking persisted snapshot meta data.Fixed: ffae5224
AsyncReadExt::read_buf()only reads at most 2MB per call; by 张炎泼; 2023-11-08When streaming a snapshot chunk, it should repeatly
read_buf()untilsnapshot_max_chunk_sizeis full or read EOF.Fixed: f41729a1 End
tick_loop()when the receiver is gone.; by Ivan Schréter; 2023-11-13Currently,
tick_loop()would keep printing the trace message everytick even when the receiver (Raft main loop) is gone in this form:
INFO openraft::core::tick: .../tick.rs:70: Tick fails to send, receiving end quit: channel closedIf the tick message fails to send, then terminate the loop, since every
future message will fail to send as well.
Also adjust the trace message to better describe what happened.
Fixed: 0799972e Split serde bound for
RaftErrorinto serialize and deserialize; by Thomas Van Strydonck; 2024-01-16Improved:
async_traitwith RPITIT; by Josh Griffith; 2024-01-28v0.8.9Compare Source
What's Changed
Clonefrom traitAppDataby @drmingdrmer in #740RaftStorage::append_to_log()now accepts anIntoIteratorby @drmingdrmer in #742RaftStateMachineout ofRaftStorageby @drmingdrmer in #763RaftMetrics.replicationtype toBTreeMap<NodeId, Option<LogId>>by @drmingdrmer in #785notifyspecifically for interal messages by @drmingdrmer in #794RaftTypeConfigby @drmingdrmer in #799RaftMetrics.vote,Wait::vote()by @drmingdrmer in #815RaftNetwork::send_append_entries()can return PartialSuccess by @drmingdrmer in #831New Contributors
Full Changelog: https://github.com/datafuselabs/openraft/compare/v0.8.3...v0.8.9
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.
498b7157d535acb1c81835acb1c8185c9ec4f34f5c9ec4f34f3c4f1116a93c4f1116a98f515cd882View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.