Uh oh!
There was an error while loading. Please reload this page.
HBASE-23561 Look up of Region in Master by encoded region name is O(n) - #1193
Conversation
Apache-HBase
commented
Feb 21, 2020
💔 -1 overall
This message was automatically generated. |
wchevreuil
left a comment
There was a problem hiding this comment.
LGTM.
The test failure reported is not an actual UT failure, somehow the jenkins process didn't terminate properly. Triggered a rebuild, just in case, planning to merge this later today if we get a green.
Apache-HBase
commented
Feb 21, 2020
🎊 +1 overall
This message was automatically generated. |
wchevreuil
commented
Feb 21, 2020
Got a green, let me merge this PR. Thanks for the contribution, @mwkang ! |
saintstack
left a comment
There was a problem hiding this comment.
Thank you for working on this @mwkang It looks good. Only question is if the methods where we modify the two maps are sure to only have a single thread accessing them at at a time. I think they should be good because synchronize or locks are taken at a higher level by accessors IIRC. Might be worth a check.
@saintstack I think it looks okay. However, I am not sure only a single thread accessing them. And as you have already mentioned, If I want to synchronize two maps, I should use synchronize or locks. It was my mistake. I didn't think about it then. Should do I use synchronized or locks? |
I think the current code may have different values for the two maps. // ...privatefinalObjectregionsMapLock = newObject();
// ...RegionStateNodecreateRegionStateNode(RegionInforegionInfo) {
synchronized (regionsMapLock) {
RegionStateNodenode = regionsMap.computeIfAbsent(regionInfo.getRegionName(), key -> newRegionStateNod(regionInfo, regionInTransition));
encodedRegionsMap.putIfAbsent(node.getRegionInfo().getEncodedName(), node);
returnnode;
}
}Also there is a remove logic, it seems safe to use a synchronized. publicvoiddeleteRegion(finalRegionInforegionInfo) {
synchronized (regionsMapLock) {
RegionStateNoderemoveNode = regionsMap.remove(regionInfo.getRegionName());
encodedRegionsMap.remove(regionInfo.getEncodedName(), removeNode);
}
// ...
} |
apache#1193) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
apache#1193) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
apache#1193) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
apache#1193) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
#1193) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
apache#1193) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
#1193) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
This is my first PR using github.
If something is wrong. please let me know.