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
ZOOKEEPER-2083 Remove deprecated class AuthFastLeaderElection #1171
Conversation
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.
QuorumPeerConfig#parseProperties also needs a update
if (electionAlg != 1 && electionAlg != 2 && electionAlg != 3) {
throw new ConfigException("Invalid electionAlg value. Only 1, 2, 3 are supported.");
}
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
Show resolved
Hide resolved
…and change if condition in QuoromPeerConfig
Refer to this link for build results (access rights to CI server needed): |
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.
+1 lgtm
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
Outdated
Show resolved
Hide resolved
…eElectionAlgorithm
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.
LGTM, pending QA
Refer to this link for build results (access rights to CI server needed): |
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.
Looks good
I left a comment, please take a look
We are targeting only 3.7.0 (current master:
There is no need to port this change to 3.5 and 3.6
Refer to this link for build results (access rights to CI server needed): |
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.
LGTM
I want to port this to branch-3.6
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.
I'm +1 on removing this long deprecated (3.4.0) functionality. However it seems like we could provide more insight to anyone upgrading who is still using it?
Election implementation to use. A value of "1" corresponds to the | ||
non-authenticated UDP-based version of fast leader election, "2" | ||
corresponds to the authenticated UDP-based version of fast | ||
leader election, and "3" corresponds to TCP-based version of | ||
fast leader election. Currently, algorithm 3 is the default. | ||
###### Note | ||
>The implementations of leader election 1, and 2 are now | ||
**deprecated**. We have the intention | ||
of removing them in the next release, at which point only the | ||
FastLeaderElection will be available. |
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.
Wouldn't it be a good idea to note that these values have been used in prior versions (note which) and are no longer valid in the current version as they were deprecated in 3.4.0 and removed in...
Something along these lines would help people coming in with issues, ie if they were using 1 or 2 and upgraded.
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.
@phunt I have added back the removed explanation of the election algorithm back in the documentation along with changes that you mentioned. Default value was made 3 in 3.2 as per ZOOKEEPER-499 and was deprecated in 3.4 and will be removed in 3.6.0.
@@ -1221,36 +1221,23 @@ protected Observer makeObserver(FileTxnSnapLog logFactory) throws IOException { | |||
} | |||
|
|||
@SuppressWarnings("deprecation") | |||
protected Election createElectionAlgorithm(int electionAlgorithm) { |
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.
why remove this entirely? Wouldn't it be a good idea to keep it available for folks interested in implementing their own?
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.
I agree with @phunt . Let's keep this patch as simple as possible which would also make backporting easier. I would just blindly remove the option for AuthFastLeaderElection (and the class itself) making a note in documentation that it has been deprecated since 3.4.0.
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.
done
case 1: | ||
le = new AuthFastLeaderElection(this); | ||
break; | ||
case 2: | ||
le = new AuthFastLeaderElection(this, true); | ||
break; |
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.
similar to my comment above - if this were/is set wouldn't it be good to emit an error message?
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.
Agree. Throw an UnsupportedException here instead of removing the switch.
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.
Added back the switch statement and if cases are 1 and 2 then throw UnsupportedOperationException
@@ -312,8 +312,8 @@ public void parseProperties(Properties zkProp) throws IOException, ConfigExcepti | |||
connectToLearnerMasterLimit = Integer.parseInt(value); | |||
} else if (key.equals("electionAlg")) { | |||
electionAlg = Integer.parseInt(value); | |||
if (electionAlg != 1 && electionAlg != 2 && electionAlg != 3) { |
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.
perhaps a better location for the error..
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.
Didn't make any changes in this part because default value of electionAlg is 3 and if other than 3 is used then configException is thrown instead made changes in QuorumPeer.createElectionAlgorithm
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.
-1 because patch has already got enough votes, but I'd like to see @phunt 's comments addressed. Thanks.
prior versions (3.0.0 and 3.1.0) were using algorithm 1 and 2 as well. | ||
###### Note | ||
>The implementations of leader election 1, and 2 were | ||
**deprecated** in 3.4.0. We will be removing them in release of 3.6.0, |
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.
What about:
Since 3.6.0 only FastLeaderElection is available, in case of upgrade you have to shutdown all of your servers and restart them with electionAlg=3 (or removing the line from the configuration file)
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.
done pending QA
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.
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.
+1 Change looks good to me now.
The only thing I noticed in the diff that you introduced whitespace changes in QuorumPeer
class. I think it would cleaner to revert the original file and make changes again. Not a big deal though.
@ravowlga123 Awesome. Thanks. |
As per [ZOOKEEPER-2083](https://jira.apache.org/jira/browse/ZOOKEEPER-2083) we need to remove class AuthFastLeaderElection.java so I made changes in Quorumpeer.java by removing two cases 1 and 2 present in createElectionAlgorithm as QuorumPeerconfig.electioalg is always 3. Please do let me know if anything additional needs to be done. Author: ravowlga123 <ravowlga@gmail.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Andor Molnar <anmolnar@apache.org>, Patrick Hunt <phunt@apache.org> Closes #1171 from ravowlga123/ZOOKEEPER-2083 (cherry picked from commit 590e3cb) Signed-off-by: Enrico Olivelli <enrico.olivelli@diennea.com>
As per [ZOOKEEPER-2083](https://jira.apache.org/jira/browse/ZOOKEEPER-2083) we need to remove class AuthFastLeaderElection.java so I made changes in Quorumpeer.java by removing two cases 1 and 2 present in createElectionAlgorithm as QuorumPeerconfig.electioalg is always 3. Please do let me know if anything additional needs to be done. Author: ravowlga123 <ravowlga@gmail.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Andor Molnar <anmolnar@apache.org>, Patrick Hunt <phunt@apache.org> Closes apache#1171 from ravowlga123/ZOOKEEPER-2083
As per [ZOOKEEPER-2083](https://jira.apache.org/jira/browse/ZOOKEEPER-2083) we need to remove class AuthFastLeaderElection.java so I made changes in Quorumpeer.java by removing two cases 1 and 2 present in createElectionAlgorithm as QuorumPeerconfig.electioalg is always 3. Please do let me know if anything additional needs to be done. Author: ravowlga123 <ravowlga@gmail.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Andor Molnar <anmolnar@apache.org>, Patrick Hunt <phunt@apache.org> Closes apache#1171 from ravowlga123/ZOOKEEPER-2083
As per [ZOOKEEPER-2083](https://jira.apache.org/jira/browse/ZOOKEEPER-2083) we need to remove class AuthFastLeaderElection.java so I made changes in Quorumpeer.java by removing two cases 1 and 2 present in createElectionAlgorithm as QuorumPeerconfig.electioalg is always 3. Please do let me know if anything additional needs to be done. Author: ravowlga123 <ravowlga@gmail.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Andor Molnar <anmolnar@apache.org>, Patrick Hunt <phunt@apache.org> Closes apache#1171 from ravowlga123/ZOOKEEPER-2083
As per [ZOOKEEPER-2083](https://jira.apache.org/jira/browse/ZOOKEEPER-2083) we need to remove class AuthFastLeaderElection.java so I made changes in Quorumpeer.java by removing two cases 1 and 2 present in createElectionAlgorithm as QuorumPeerconfig.electioalg is always 3. Please do let me know if anything additional needs to be done. Author: ravowlga123 <ravowlga@gmail.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Andor Molnar <anmolnar@apache.org>, Patrick Hunt <phunt@apache.org> Closes apache#1171 from ravowlga123/ZOOKEEPER-2083
As per ZOOKEEPER-2083 we need to remove class AuthFastLeaderElection.java so I made changes in Quorumpeer.java by removing two cases 1 and 2 present in createElectionAlgorithm as QuorumPeerconfig.electioalg is always 3.
Please do let me know if anything additional needs to be done.