Open siddontang opened 5 years ago
Most of the time, the leader can only send Log meta (not including Log data) to the witness, but if the log entry contains ConfChange or Admin(like Split, Merge), we need to send these log data too.
We can check ConfChange with https://github.com/pingcap/raft-rs/blob/master/proto/eraftpb.proto#L6 directly, but for Admin, maybe we need to add a flag to https://github.com/pingcap/raft-rs/blob/master/proto/eraftpb.proto#L24.
IMO, we can only introduce the Witness role to the Raft lib, the Witness can't be promoted to Follower or Learner because it has no data.
The Raft module still sends whole messages to the Witness, and we will decide whether to filter the messages outside. This can make the Raft library simple. Another way is to introduce a send-hook and do the filter in the Raft send function. But I prefer the first way.
We can also support Witness in etcd if possible. /cc @xiang90
Witness mode can be implemented outside raft by:
But I am fine adding it into raft though.
Please also take a look at https://github.com/lni/dragonboat/issues/106.
From Spanner https://cloud.google.com/spanner/docs/replication
It is helpful for us to support crossing IDC replication too.