Closed drmingdrmer closed 3 months ago
The recent changes enhance the Raft protocol's metrics handling and error management, introducing better serialization for time-related metrics and refining error documentation. Key updates include the implementation of SerdeInstant
for timestamp metrics, deprecation of older fields, and improved logging mechanisms. These modifications aim to increase performance and reliability while maintaining backward compatibility and clarity in error reporting.
Files | Change Summary |
---|---|
openraft/src/core/raft_core.rs |
Updated RaftMetrics and RaftDataMetrics to use SerdeInstant for last_quorum_acked , enhancing time metrics serialization. |
openraft/src/error.rs |
Removed comments regarding future error subtype enhancements, simplifying error handling. |
openraft/src/metrics/mod.rs |
Introduced serde_instant module and exported SerdeInstant type for improved modularity. |
openraft/src/metrics/raft_metrics.rs |
Added last_quorum_acked field to RaftMetrics and RaftDataMetrics , deprecated millis_since_quorum_ack . Updated documentation and Display implementation. |
openraft/src/metrics/serde_instant.rs |
Implemented SerdeInstant struct for Instant serialization, including conversion and testing functionalities. |
openraft/src/metrics/wait_test.rs |
Added #[allow(deprecated)] to maintain compatibility and initialized last_quorum_acked in metrics. |
scripts/check.kdl |
Removed close_on_exit option from pane definitions to keep output visible after command execution. |
tests/tests/fixtures/mod.rs |
Enhanced set_panic_hook and log_panic for structured logging of panic information. |
tests/tests/metrics/t10_leader_last_ack.rs |
Added leader_last_ack_3_nodes_abs_time test; updated assertions in existing tests for acknowledgment timing validation. |
sequenceDiagram
participant Leader
participant Quorum
participant Metrics
Leader->>Quorum: Sends heartbeat
Quorum-->>Leader: Acknowledgment received
Leader->>Metrics: Update last_quorum_acked timestamp
Metrics-->>Leader: Store updated timestamp
π° Hop, hop, letβs give a cheer,
For metrics bright and changes clear!
WithSerdeInstant
now in sight,
Our Raftβs performance takes to flight!
From bugs and errors, we shall part,
And celebrate with all our heart! π
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
RaftMetrics::last_quorum_acked
is the absolute timestamp of the most recent time point that is accepted by a quorum viaAppendEntries
RPC. This field is a wrappedInstant
type:SerdeInstant
which support serde forInstant
. This field is added as a replacement ofmillis_since_quorum_ack
, which is a relative time.SerdeInstant
serializeInstant
into a string formatted as "%Y-%m-%dT%H:%M:%S%.9f%z", e.g., "2024-07-24T04:07:32.567025000+0000".Note: Serialization and deserialization are not perfectly accurate and can be indeterministic, resulting in minor variations each time. These deviations(could be smaller or greater) are typically less than a microsecond (10^-6 seconds).
Checklist
Summary by CodeRabbit
New Features
last_quorum_acked
, to track leader acknowledgment timing inRaftMetrics
andRaftDataMetrics
.Bug Fixes
Tests
Chores