Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces major enhancements to the distributed cache system, focusing on improved Raft cluster management, dynamic peer membership, observability, and overall robustness. The changes include adding support for dynamic peer addition/removal via HTTP endpoints, implementing a more robust Raft leader election process with randomized timeouts and persistent term/vote tracking, and exposing new Prometheus metrics for better cluster monitoring. Configuration files and code have been updated to support these features, and logging has been improved for easier debugging.
Raft Cluster Management and Dynamic Membership:
/cluster/join,/cluster/leave,/cluster/peers) to allow dynamic addition and removal of cluster peers at runtime, as well as querying the current peer list. (pkg/cmd/main.go)AddPeer,RemovePeer, andPeersmethods in the Raft node and transport layers to support dynamic peer management, updating metrics accordingly. (pkg/raft/node.go,pkg/raft/http_transport.go) [1] [2]Raft Protocol Improvements:
termandvotedFortracking, and enhanced logics for handling vote requests and append entries. This improves split-brain handling and cluster stability. (pkg/raft/node.go) [1] [2] [3] [4]pkg/raft/node.go,pkg/raft/http_transport.go) [1] [2] [3]Observability and Metrics:
simple_cache_peers_total) to track the number of peers in the Raft cluster. (pkg/metrics/metrics.go) [1] [2] [3]metrics_addrin configuration files and environment variable, and updated configuration defaults and examples. (pkg/config/config.go,config.example.yaml,configs/node1.yaml,configs/node2.yaml,configs/node3.yaml) [1] [2] [3] [4] [5] [6]Configuration and Logging:
CONFIG_PATHenvironment variable, improving deployment flexibility. (pkg/cmd/main.go)Infofor less verbose output in production. (pkg/cmd/main.go)Code Quality and Robustness:
pkg/cmd/main.go)bench/benchmark_test.go,pkg/raft/http_transport.go,pkg/raft/storage.go,pkg/cmd/main.go,pkg/raft/node.go) [1] [2] [3] [4] [5]