saintstack commented on a change in pull request #917: HBASE-23383 [hbck2]
`fixHoles` should queue assignment procedures for any regions its fixing
URL: https://github.com/apache/hbase/pull/917#discussion_r364951164
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetaFixer.java
##########
@@ -244,4 +301,47 @@ static boolean isOverlap(RegionInfo ri, Pair<RegionInfo,
RegionInfo> pair) {
}
return ri.isOverlap(pair.getFirst()) || ri.isOverlap(pair.getSecond());
}
+
+ /**
+ * A union over {@link L} and {@link R}.
+ */
+ private static class Either<L, R> {
+ private final L left;
+ private final R right;
+
+ public static <L, R> Either<L, R> ofLeft(L left) {
+ return new Either<>(left, null);
+ }
+
+ public static <L, R> Either<L, R> ofRight(R right) {
+ return new Either<>(null, right);
+ }
+
+ Either(L left, R right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ public boolean hasLeft() {
+ return left != null;
+ }
+
+ public L getLeft() {
+ if (!hasLeft()) {
+ throw new IllegalStateException("Either contains no left.");
+ }
+ return left;
+ }
+
+ public boolean hasRight() {
+ return right != null;
+ }
+
+ public R getRight() {
+ if (!hasRight()) {
+ throw new IllegalStateException("Either contains no right.");
+ }
+ return right;
+ }
+ }
}
Review comment:
Fancy. As long as unit tests still pass.... (I think the unit test was
pretty involved IIRC)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services