-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slave does not sync key updates during downtime after restart #2214
Comments
@sam-hn Can you check if the replication is correct while restarting via the command |
thanks for your feedback. |
@sam-hn I cannot reproduce this issue on my side, what I do is:
Can you provide how do you reproduce this? |
@git-hulk thanks for your test results. This is the exact steps I tried except I was testing with cluster mode. Then I did another test with two new kvrocks nodes which had cluster mode disabled, and this time I could not reproduce the issue either. After that, I removed db dir and enabled cluster mode on the nodes, called controller API to create new cluster then did the test again, and the issue came back. So I think the issue only happens with master-slave replication in a cluster. Can you please try the same and see if issue can reproduce this time? |
Attached my test results for reference, below is the cluster info
during slave downtime, update a to 101 and create b
after slave restarted, key a still keeps old value
|
@sam-hn Thank you, I will have a try soon when I get time. |
slave-config.txt |
@sam-hn Thanks for your input. I found the root cause now and will submit a PR to resolve this soon. |
This closes #2214 The namespace mechanism is NOT allowed in cluster mode, so it's unnecessary to rewrite while the cluster mode is enabled. This config rewrite behavior will cause the replication issue mentioned in #2214 when starting the cluster node. The root cause is that the server will try to rewrite the namespace into the rocksdb if the option `repl-namespace-enabled` is enabled. So it will increase the server's rocksdb sequence and replication will start with the wrong offset. We have checked if the role is a slave before rewriting, but the cluster replication is NOT set at that time(master-replica is good). The good news is it only affects the cluster users who enabled the option `repl-namespace-enabled`, so I guess almost no user will do this since the namespace replication is meaningless to the cluster mode. ``` === RUN TestClusterReplication/Cluster_replication_should_work_normally_after_restart replication_test.go:88: Error Trace: /Users/hulk/code/cxx/kvrocks/tests/gocase/integration/replication/replication_test.go:88 Error: Not equal: expected: "v1" actual : "v0" ``` And it works well after this patch.
Search before asking
Version
Kvrocks 2.7.0
Minimal reproduce step
test1
and create a new keytest2
in master nodetest1
in slave is not updated andtest2
is createdWhat did you expect to see?
after restart, slave should have the updated value of
test1
What did you see instead?
test1
key in slave is not updatedAnything Else?
I also tried updating key
test2
in master node to see if this could trigger the sync of keytest1
between slave and master, but only to findtest2
is updated in slaveAre you willing to submit a PR?
The text was updated successfully, but these errors were encountered: