Fix wrongly try to rewrite the namespace in the cluster mode #2221
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 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 which was
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 userwill do this since the namespace replication is meaningless to the cluster mode.
Please refer to the first commit in this PR for the reproduced code.
The replica will lose one update before applying this patch:
And it works well after this patch.