Comments (7)
Thanks for clarifying, I was overlooking the fact that a log is committed before it's replicated everywhere.
from openraft.
👋 Thanks for opening this issue!
Get help or engage by:
/help
: to print help messages./assignme
: to assign this issue to you.
from openraft.
Thank you for your detailed report. By the current design it should not be
considered as a bug.
Because the removed and then restarted node has unexpectedly changed its data,
the leader can not guarantee handling such condition correctly.
In a distributed system like Openraft, a node must guarantee the persisted
data wont change. Otherwise it is a severe bug and the entire system should be
shutdown at once to prevent further data damage.
However, we understand that in certain scenarios, like testing or
troubleshooting, you may need to wipe out all data and restart the node.
To address your specific use case, I propose adding a feature flag that relaxes
the replication progress checks. This would allow the leader node to continue data
replication to the follower, even in scenarios where all data has been wiped out
and the node restarted.
Please let me know if you have further questions.
from openraft.
I guess I'm thinking of this slightly differently, in my case all the nodes are known in advance and configured as a cluster. These clusters are then deployed as an isolated unit of 5 machines.
I was thinking of production scenarios, where a node has to be replaced. In production the nodes could be VMs which can die at any time. Being able to bring a new one online to replace a failed one would make this easier to operate, and does seem to work if we don't panic in the leader.
With the panic, ( if handled and shutdown is initiated), then the rest of the cluster is fine, but the leader ends up shutting down abruptly and restarting.
Is there something I'm not considering here that makes this operational plan invalid or dangerous?
from openraft.
The feature flag seems like a good plan though. I must admit I didn't find a good place in the codepath to check for this case.
Do you think the solution is on the Follower side codepath? Or in the leader's handling of the Conflict Message?
from openraft.
@pepinns
Yes it is dangerous: Replacing a node with another empty one may cause data loss.
Assumes the leader is N1, followers are N2,N3,N4,N5;
- A log(
x
) that is replicated by N1 to N2,N3 is considered committed. - At this point, if N3 is replaced with an empty node, and at once the leader N1 is crashed. Then N5 may elected as a new leader with granted vote by N3,N4;
- Then the new leader N5 will not have log
x
.
The standard way is call change_membership()
to remove the crashed node, then start a new empty node, finally call change_membership()
again to add the new empty node back to the cluster.
Another non-standard tricky way is to set up a cluster of 6 nodes. The quorum is 4 nodes thus you can replace one node with empty state without losing data.
I'll open a PR to show you where to add the patch to address the panicking issue.
from openraft.
@pepinns
The log reversion issue should best be addressed when the conflicting
event is reported to the progress:
from openraft.
Related Issues (20)
- Feature: Monoio Runtime HOT 3
- Add sync primitives to `AsyncRuntime` trait HOT 1
- Hide `RaftStorage` and similar types from generic arguments to `Raft`/`RaftInner` HOT 7
- RaftMsg::ExternalRequest: should not rely on RaftLogStorage and RaftNetworkFactory HOT 3
- Add random number generation to `Runtime` HOT 5
- Ditch `async_trait` in favor of the official `async_fn_in_trait` feature HOT 6
- Refactor: Move `client_resp_channels` from `LeaderData` to new `tx_...`-field in `RaftCore` HOT 2
- Linearizable read with `ReadIndex` HOT 1
- about single node HOT 6
- Cluster Bootstrap and Node Initialization Sequence HOT 4
- Tracking issue for examples update HOT 1
- Update example `raft-kv-memstore` to use `storage-v2` HOT 2
- Update example `raft-kv-rocksstore` to use `storage-v2` HOT 1
- Move examples into the workspace HOT 1
- Install Snapshot v1 api HOT 3
- Observe state changes in a Raft node HOT 6
- Split metrics into data metrics and server metrics HOT 5
- About automatic remove HOT 3
- Backing up the WAL HOT 6
- Raft Core Panicking HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openraft.