-
Notifications
You must be signed in to change notification settings - Fork 7.3k
ZOOKEEPER-3720: Fix rolling upgrade failure (invalid protocol version) #1251
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2ed0aaa
ZOOKEEPER-3720: Fix rolling upgrade failure (invalid protocol version)
symat b01d1bf
ZOOKEEPER-3720: fix based on PR comments
symat 762d3eb
ZOOKEEPER-3720: fix checkstyle
symat eee0c7f
ZOOKEEPER-3720: rename protocol version constants
symat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1211,7 +1211,8 @@ of servers -- that is, when deploying clusters of servers. | |
| <a name="id_multi_address"></a> | ||
| Since ZooKeeper 3.6.0 it is possible to specify **multiple addresses** for each | ||
| ZooKeeper server (see [ZOOKEEPER-3188](https://issues.apache.org/jira/projects/ZOOKEEPER/issues/ZOOKEEPER-3188)). | ||
| This helps to increase availability and adds network level | ||
| To enable this feature, you must set the *multiAddress.enabled* configuration property | ||
| to *true*. This helps to increase availability and adds network level | ||
| resiliency to ZooKeeper. When multiple physical network interfaces are used | ||
| for the servers, ZooKeeper is able to bind on all interfaces and runtime switching | ||
| to a working interface in case a network error. The different addresses can be specified | ||
|
|
@@ -1220,7 +1221,18 @@ of servers -- that is, when deploying clusters of servers. | |
| server.1=zoo1-net1:2888:3888|zoo1-net2:2889:3889 | ||
| server.2=zoo2-net1:2888:3888|zoo2-net2:2889:3889 | ||
| server.3=zoo3-net1:2888:3888|zoo3-net2:2889:3889 | ||
|
|
||
|
|
||
|
|
||
| ###### Note | ||
| >By enabling this feature, the Quorum protocol (ZooKeeper Server-Server protocol) will change. | ||
| The users will not notice this and when anyone starts a ZooKeeper cluster with the new config, | ||
| everything will work normally. However, it's not possible to enable this feature and specify | ||
| multiple addresses during a rolling upgrade if the old ZooKeeper cluster didn't support the | ||
| *multiAddress* feature (and the new Quorum protocol). In case if you need this feature but you | ||
| also need to perform a rolling upgrade from a ZooKeeper cluster older than *3.6.0*, then you | ||
| first need to do the rolling upgrade without enabling the MultiAddress feature and later make | ||
| a separate rolling restart with the new configuration where **multiAddress.enabled** is set | ||
| to **true** and multiple addresses are provided. | ||
|
|
||
| * *syncLimit* : | ||
| (No Java system property) | ||
|
|
@@ -1584,6 +1596,16 @@ and [SASL authentication for ZooKeeper](https://cwiki.apache.org/confluence/disp | |
| (e.g. the zk/[email protected] client principal will be authenticated in ZooKeeper as zk/myhost) | ||
| Default: false | ||
|
|
||
| * *multiAddress.enabled* : | ||
| (Java system property: **zookeeper.multiAddress.enabled**) | ||
| **New in 3.6.0:** | ||
| Since ZooKeeper 3.6.0 you can also [specify multiple addresses](#id_multi_address) | ||
| for each ZooKeeper server instance (this can increase availability when multiple physical | ||
| network interfaces can be used parallel in the cluster). Setting this parameter to | ||
| **true** will enable this feature. Please note, that you can not enable this feature | ||
| during a rolling upgrade if the version of the old ZooKeeper cluster is prior to 3.6.0. | ||
| The default value is **false**. | ||
|
|
||
| * *multiAddress.reachabilityCheckTimeoutMs* : | ||
| (Java system property: **zookeeper.multiAddress.reachabilityCheckTimeoutMs**) | ||
| **New in 3.6.0:** | ||
|
|
@@ -1596,7 +1618,8 @@ and [SASL authentication for ZooKeeper](https://cwiki.apache.org/confluence/disp | |
| in parallel for the different addresses, so the timeout you set here is the maximum time will be taken | ||
| by checking the reachability of all addresses. | ||
| The default value is **1000**. | ||
|
|
||
|
|
||
| This parameter has no effect, unless you enable the MultiAddress feature by setting *multiAddress.enabled=true*. | ||
|
|
||
| <a name="Experimental+Options%2FFeatures"></a> | ||
|
|
||
|
|
@@ -1688,6 +1711,7 @@ the variable does. | |
| Please note, disabling the reachability check will cause the cluster not to be able to reconfigure | ||
| itself properly during network problems, so the disabling is advised only during testing. | ||
|
|
||
| This parameter has no effect, unless you enable the MultiAddress feature by setting *multiAddress.enabled=true*. | ||
|
|
||
| <a name="Disabling+data+directory+autocreation"></a> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of new protocol (v2) I would like to spend here a 64bit long of 'flags' (filled with zeros in 3.6.0) in order to introduce a more futureproof 'feature detection' that is better than using protocol version numbers.
We can then add 'multiaddress' as an enabled feature.
We should do more reasoning and design steps but this way of coding the initial handshake is quite common and it will open up the way for future improvements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I really like this idea with the 'feature flags', I will change accordingly.
The only constraint is that the version number must be negative. I think I saw in the git history, that some years ago, when the protocol version was not introduced yet, this was the way how someone solved the introduction of versioning. The old code sent some positive sid or message size, and the new code sent a negative version number. This way enforcing the old code to break and throw away the message, while the new code was able to verify if it got the message in the new format based on the negative number. But I need to double-check this tomorrow, maybe I remember wrong.
And also there can be maybe 1-2 negative numbers already used as protocol versions, so I will check which bits are still available.
Although I think it is enough to support the rolling upgrade from the first stable 3.4 release, which can simplify things, and we don't need to go back in time in the code too much.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I did some deeper digging in the git history, this is what I found:
The different version numbers / behaviors we had before:
This also means, that we can choose any negative number as new protocol version for the MultiAddress feature, and then the rolling upgrade from 3.4.7-3.4.14 to 3.6.0 could work theoretically even with MultiAddress enabled, as long as we always send the SID right after the protocol version.
But the value of the protocol version is actually checked in 3.5.0, so we definitely need to disable MultiAddress to be able to get the rolling upgrade to work from 3.5.
Long story short: we only have a single protocol version, -65536 (0xffff0000) as of now, plus the case when positive numbers are sent. The -65535 (0xffff0001) seems to me a good protocol version candidate for the multiaddress compatible protocol, since it is also only a single bit difference between the two. So if later we will introduce the 'feature flags' we can already say that the last bit represented the multiaddress feature.
What do you think? (maybe I misunderstood your proposal here)
But I just don't know how this whole thing should look in the later releases. Also this whole protocol version is now only about the initial message. We don't know if there is any other incompatibility between the other messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eolivelli what do you think?
should we add the 'feature flags' implementation here in 3.6.0? Or is it enough if we choose a new optional version number that differs only in a single bit to the current version number, so that we are keeping this possibility of 'feature flags' open for the future? (currently we have only a single 'feature' anyway)
I am not sure if it worths to push for a more generic solution, given that we don't really know yet how to design this in the future.