-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
HBASE-24195 : Admin.getRegionServers() should return live servers exc… #1523
Conversation
…luding decom RS optionally
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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 useful. +1 (non-binding) after comments are addressed.
waitForServerDecom(serverToDecommission, true); | ||
|
||
Assert.assertEquals(2, ADMIN.getRegionServers(true).size()); | ||
|
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.
Add Assert.assertEquals(3, ADMIN.getRegionServers(false).size());
for paranoid reviewers (cough cough me).
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.
Sure, definitely
ADMIN.recommissionRegionServer(serverToDecommission, Collections.emptyList()); | ||
|
||
Assert.assertEquals(3, ADMIN.getRegionServers(true).size()); | ||
waitForServerDecom(serverToDecommission, false); |
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 wait for decommission this server in the end?
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 was thinking the assertion Assert.assertEquals(3, ADMIN.getRegionServers(true).size());
should have made sure all RS are fine now. I understand in case that is not enough, you explicitly make sure the mini cluster is ready for other test cases. OK, good.
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 wait for decommission this server in the end?
Actually, we are waiting for server to be recommissioned (maybe method name not correct, last arg determines). Let me change the order.
return allServers; | ||
} | ||
List<ServerName> decommissionedRegionServers = listDecommissionedRegionServers(); | ||
if (CollectionUtils.isNotEmpty(decommissionedRegionServers)) { |
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.
if (CollectionUtils.isNotEmpty(decommissionedRegionServers)) {
allServers = new ArrayList<>(allServers);
allServers.removeIf(decommissionedRegionServers::contains);
return Collections.unmodifiableList(allServers);
}
return allServers;
to
return allServers.stream()
.filter(s -> !decommissionedRegionServers.contains(s))
.collect(ImmutableList.toImmutableList());
I think this will save one time full copy (previous code copy twice, and this copies just once). Need to confirm.
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.
The reason behind copy (new ArrayList<>(allServers)
) was making allServers
unmodifiable list. So ImmutableList.toImmutableList()
seems to be solving our problem.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
Show resolved
Hide resolved
#1523) Signed-off-by: Mingliang Liu <liuml07@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
#1523) Signed-off-by: Mingliang Liu <liuml07@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
apache#1523) Signed-off-by: Mingliang Liu <liuml07@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
…luding decom RS optionally