Skip to content
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

Closed
wants to merge 7 commits into from

Conversation

rabi-kumar
Copy link
Contributor

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.

Copy link
Member

@maoling maoling left a 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.");
}

@asf-ci
Copy link

asf-ci commented Dec 11, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/1711/

Copy link
Member

@maoling maoling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 lgtm

Copy link

@HorizonNet HorizonNet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pending QA

@asf-ci
Copy link

asf-ci commented Dec 17, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/1747/

Copy link
Contributor

@eolivelli eolivelli left a 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

@asf-ci
Copy link

asf-ci commented Dec 18, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/1752/

Copy link
Contributor

@eolivelli eolivelli left a 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

Copy link
Contributor

@phunt phunt left a 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?

Comment on lines 1024 to 1033
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.
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 1229 to 1234
case 1:
le = new AuthFastLeaderElection(this);
break;
case 2:
le = new AuthFastLeaderElection(this, true);
break;
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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..

Copy link
Contributor Author

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

Copy link
Contributor

@anmolnar anmolnar left a 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,
Copy link
Contributor

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done pending QA

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.
+1
thank you @ravowlga123

please @phunt and @anmolnar take a look

Copy link
Contributor

@anmolnar anmolnar left a 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.

@anmolnar
Copy link
Contributor

anmolnar commented Jan 7, 2020

@ravowlga123 Awesome. Thanks.
@phunt Are u happy with the patch now?

@asfgit asfgit closed this in 590e3cb Jan 9, 2020
asfgit pushed a commit that referenced this pull request Jan 9, 2020
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>
junyoungKimGit pushed a commit to junyoungKimGit/zookeeper that referenced this pull request Feb 7, 2020
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
stickyhipp pushed a commit to stickyhipp/zookeeper that referenced this pull request Aug 19, 2020
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
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
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
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 3, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants