Open ptyin opened 3 months ago
I think this should be a plug-in. Users can choose etcd, zookeeper, raft, or even mysql and other external storage. Reference https://github.com/apache/dolphinscheduler/tree/dev/dolphinscheduler-registry/dolphinscheduler-registry-plugins
I think this should be a plug-in. Users can choose etcd, zookeeper, raft, or even mysql and other external storage. Reference https://github.com/apache/dolphinscheduler/tree/dev/dolphinscheduler-registry/dolphinscheduler-registry-plugins
I see. However, dolphinscheduler use pom.xml profile
to define which code should be included and excluded. If we surely want to implement this behaviour, we probably need to modify Makefile
and use Go build tags.
@git-hulk What do you think?
I think this should be a plug-in. Users can choose etcd, zookeeper, raft, or even mysql and other external storage. Reference https://github.com/apache/dolphinscheduler/tree/dev/dolphinscheduler-registry/dolphinscheduler-registry-plugins
I see. However, dolphinscheduler use pom.xml
profile
to define which code should be included and excluded. If we surely want to implement this behaviour, we probably need to modifyMakefile
and use Go build tags.@git-hulk What do you think?
It should be fine to include plugins while building and users can choose which engine to use via the configuration file. But from my personal perspective, I prefer encouraging users to use raft + embedded storage instead of the external service if it's ready.
@ptyin This requirement does not have to be completed in this PR. Maybe I will send a proposal after I write a complete plan. Thank you for your suggestion.
Rationale
The
kvrocks-controller
previously depended on external storage systems such as Apache ZooKeeper or ETCD for metadata management and leader election. This reliance introduces increased operational complexity and user burden. This proposal aims to alleviate these issues by integrating an embedded storage solution.Implementation Overview
The detailed design can be reviewed in the proposal document.
Key components include:
Embedded System
The
Embedded
struct houses the application logic to manipulate the metadata:The
kv
map serves as the primary data structure, akin to the functionality found in etcd or ZooKeeper. Here's how data operations are handled:Get
,Exists
) directly queries thekv
map.Set
,Delete
) utilizes thePropose
method rather than modifyingkv
directly.A background process consistently reads from the
commitCh
channel, which receives commits published byraftNode
.Communication between the
Embedded
system andraftNode
occurs viaproposeCh
andcommitCh
.Raft Node
raftNode
is explored inraft.go
. It initializes its state when created:Recovery of state occurs prior to regular operations, restoring from snapshots and replaying WAL for uncommitted entries.
Establishment of network communication with peer nodes follows recovery:
With go
rc.serveChannels()
, the system enters the critical event loop, primarily divided into two main goroutines:Receiving proposals from
proposeCh
This goroutine is responsible for handling incoming proposalsEvent Loop on Raft State Machine Updates This loop processes state machine updates and manages storage interactions