You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2018/10/12 23:22:20 UTC
[1/2] hbase git commit: Revert "HBASE-21242 [amv2] Miscellaneous
minor log and assign procedure create improvements;
ADDENDUM Fix TestHRegionInfo AND TestRegionInfoDisplay"
Repository: hbase
Updated Branches:
refs/heads/branch-2.1 7f3ca4643 -> 4d50f6db5
Revert "HBASE-21242 [amv2] Miscellaneous minor log and assign procedure create improvements; ADDENDUM Fix TestHRegionInfo AND TestRegionInfoDisplay"
This reverts commit 7f3ca4643d2a247b8665dd5e56271a2f52e60f2c.
Bad commit.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/26654437
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/26654437
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/26654437
Branch: refs/heads/branch-2.1
Commit: 266544370d020b33f0fa869a4a5737bc5d1ead23
Parents: 7f3ca46
Author: Michael Stack <st...@apache.org>
Authored: Fri Oct 12 16:15:57 2018 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Fri Oct 12 16:15:57 2018 -0700
----------------------------------------------------------------------
.../hadoop/hbase/client/TestRegionInfoDisplay.java | 13 +------------
.../hadoop/hbase/regionserver/TestHRegionInfo.java | 3 ---
2 files changed, 1 insertion(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/26654437/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
index 8390b40..1a6f2f7 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
@@ -34,8 +34,6 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;
-import static org.junit.Assert.assertTrue;
-
@Category({MasterTests.class, SmallTests.class})
public class TestRegionInfoDisplay {
@@ -94,16 +92,7 @@ public class TestRegionInfoDisplay {
origDesc.indexOf(Bytes.toStringBinary(startKey)) +
Bytes.toStringBinary(startKey).length());
assert(firstPart.equals(firstPartOrig));
- // The elapsed time may be different in the two Strings since they were calculated at different
- // times... so, don't include that portion when we compare. It starts with a '('.
- // Second part looks like this:
- // ",1539385518431.9d15487c60247dc3876b8b2a842929ed. state=OPEN,
- // ts=Fri Oct 12 16:05:18 PDT 2018 (PT0S ago), server=null"
- int indexOfElapsedTime = secondPart.indexOf("(");
- assertTrue(indexOfElapsedTime > 0);
- assertTrue(secondPart + " " + secondPartOrig,
- secondPart.substring(0, indexOfElapsedTime).equals(secondPartOrig.
- substring(0, indexOfElapsedTime)));
+ assert(secondPart.equals(secondPartOrig));
}
private void checkEquality(RegionInfo ri, Configuration conf) throws IOException {
http://git-wip-us.apache.org/repos/asf/hbase/blob/26654437/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
index 8239f01..50b675d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
@@ -296,7 +296,6 @@ public class TestHRegionInfo {
assertEquals(expectedHri, convertedHri);
}
-<<<<<<< Updated upstream
@Test
public void testRegionDetailsForDisplay() throws IOException {
byte[] startKey = new byte[] {0x01, 0x01, 0x02, 0x03};
@@ -363,7 +362,5 @@ public class TestHRegionInfo {
}
}
}
-=======
->>>>>>> Stashed changes
}
[2/2] hbase git commit: HBASE-21242 [amv2] Miscellaneous minor log
and assign procedure create improvements;
ADDENDUM Fix TestHRegionInfo AND TestRegionInfoDisplay
Posted by st...@apache.org.
HBASE-21242 [amv2] Miscellaneous minor log and assign procedure create improvements; ADDENDUM Fix TestHRegionInfo AND TestRegionInfoDisplay
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4d50f6db
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4d50f6db
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4d50f6db
Branch: refs/heads/branch-2.1
Commit: 4d50f6db5ac3e2d11ca4970b38b0dd6f030ced73
Parents: 2665443
Author: Michael Stack <st...@apache.org>
Authored: Fri Oct 12 16:22:10 2018 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Fri Oct 12 16:22:10 2018 -0700
----------------------------------------------------------------------
.../hbase/client/TestRegionInfoDisplay.java | 13 +++-
.../hbase/regionserver/TestHRegionInfo.java | 66 --------------------
2 files changed, 12 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/4d50f6db/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
index 1a6f2f7..8390b40 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
@@ -34,6 +34,8 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;
+import static org.junit.Assert.assertTrue;
+
@Category({MasterTests.class, SmallTests.class})
public class TestRegionInfoDisplay {
@@ -92,7 +94,16 @@ public class TestRegionInfoDisplay {
origDesc.indexOf(Bytes.toStringBinary(startKey)) +
Bytes.toStringBinary(startKey).length());
assert(firstPart.equals(firstPartOrig));
- assert(secondPart.equals(secondPartOrig));
+ // The elapsed time may be different in the two Strings since they were calculated at different
+ // times... so, don't include that portion when we compare. It starts with a '('.
+ // Second part looks like this:
+ // ",1539385518431.9d15487c60247dc3876b8b2a842929ed. state=OPEN,
+ // ts=Fri Oct 12 16:05:18 PDT 2018 (PT0S ago), server=null"
+ int indexOfElapsedTime = secondPart.indexOf("(");
+ assertTrue(indexOfElapsedTime > 0);
+ assertTrue(secondPart + " " + secondPartOrig,
+ secondPart.substring(0, indexOfElapsedTime).equals(secondPartOrig.
+ substring(0, indexOfElapsedTime)));
}
private void checkEquality(RegionInfo ri, Configuration conf) throws IOException {
http://git-wip-us.apache.org/repos/asf/hbase/blob/4d50f6db/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
index 50b675d..70166a0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
@@ -296,71 +296,5 @@ public class TestHRegionInfo {
assertEquals(expectedHri, convertedHri);
}
- @Test
- public void testRegionDetailsForDisplay() throws IOException {
- byte[] startKey = new byte[] {0x01, 0x01, 0x02, 0x03};
- byte[] endKey = new byte[] {0x01, 0x01, 0x02, 0x04};
- Configuration conf = new Configuration();
- conf.setBoolean("hbase.display.keys", false);
- HRegionInfo h = new HRegionInfo(TableName.valueOf(name.getMethodName()), startKey, endKey);
- checkEquality(h, conf);
- // check HRIs with non-default replicaId
- h = new HRegionInfo(TableName.valueOf(name.getMethodName()), startKey, endKey, false,
- System.currentTimeMillis(), 1);
- checkEquality(h, conf);
- Assert.assertArrayEquals(HRegionInfo.HIDDEN_END_KEY,
- HRegionInfo.getEndKeyForDisplay(h, conf));
- Assert.assertArrayEquals(HRegionInfo.HIDDEN_START_KEY,
- HRegionInfo.getStartKeyForDisplay(h, conf));
-
- RegionState state = RegionState.createForTesting(h, RegionState.State.OPEN);
- String descriptiveNameForDisplay =
- HRegionInfo.getDescriptiveNameFromRegionStateForDisplay(state, conf);
- checkDescriptiveNameEquality(descriptiveNameForDisplay,state.toDescriptiveString(), startKey);
-
- conf.setBoolean("hbase.display.keys", true);
- Assert.assertArrayEquals(endKey, HRegionInfo.getEndKeyForDisplay(h, conf));
- Assert.assertArrayEquals(startKey, HRegionInfo.getStartKeyForDisplay(h, conf));
- Assert.assertEquals(state.toDescriptiveString(),
- HRegionInfo.getDescriptiveNameFromRegionStateForDisplay(state, conf));
- }
-
- private void checkDescriptiveNameEquality(String descriptiveNameForDisplay, String origDesc,
- byte[] startKey) {
- // except for the "hidden-start-key" substring everything else should exactly match
- String firstPart = descriptiveNameForDisplay.substring(0,
- descriptiveNameForDisplay.indexOf(new String(HRegionInfo.HIDDEN_START_KEY)));
- String secondPart = descriptiveNameForDisplay.substring(
- descriptiveNameForDisplay.indexOf(new String(HRegionInfo.HIDDEN_START_KEY)) +
- HRegionInfo.HIDDEN_START_KEY.length);
- String firstPartOrig = origDesc.substring(0,
- origDesc.indexOf(Bytes.toStringBinary(startKey)));
- String secondPartOrig = origDesc.substring(
- origDesc.indexOf(Bytes.toStringBinary(startKey)) +
- Bytes.toStringBinary(startKey).length());
- assert(firstPart.equals(firstPartOrig));
- assert(secondPart.equals(secondPartOrig));
- }
-
- private void checkEquality(HRegionInfo h, Configuration conf) throws IOException {
- byte[] modifiedRegionName = HRegionInfo.getRegionNameForDisplay(h, conf);
- byte[][] modifiedRegionNameParts = HRegionInfo.parseRegionName(modifiedRegionName);
- byte[][] regionNameParts = HRegionInfo.parseRegionName(h.getRegionName());
-
- //same number of parts
- assert(modifiedRegionNameParts.length == regionNameParts.length);
-
- for (int i = 0; i < regionNameParts.length; i++) {
- // all parts should match except for [1] where in the modified one,
- // we should have "hidden_start_key"
- if (i != 1) {
- Assert.assertArrayEquals(regionNameParts[i], modifiedRegionNameParts[i]);
- } else {
- assertNotEquals(regionNameParts[i][0], modifiedRegionNameParts[i][0]);
- Assert.assertArrayEquals(modifiedRegionNameParts[1],
- HRegionInfo.getStartKeyForDisplay(h, conf));
- }
- }
- }
}