You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/11/17 02:47:41 UTC
svn commit: r1202996 - in /hbase/branches/0.89-fb/src:
main/java/org/apache/hadoop/hbase/util/RegionSplitter.java
test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java
Author: nspiegelberg
Date: Thu Nov 17 01:47:40 2011
New Revision: 1202996
URL: http://svn.apache.org/viewvc?rev=1202996&view=rev
Log:
Fix TestRegionSplitter: pass correct ZK client port
Summary: TestRegionSplitter currently uses a deprecated HTable constructor that
instantiates a new configuration and does not use the correct ZK client port as
a result.
Test Plan: mvn -Dtest=TestHRegionSplitter test
Reviewers: cgist
Reviewed By: cgist
CC: hbase-eng@lists, cgist
Differential Revision: 357250
Revert Plan: OK
Modified:
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java
hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java?rev=1202996&r1=1202995&r2=1202996&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java Thu Nov 17 01:47:40 2011
@@ -373,7 +373,7 @@ public class RegionSplitter {
if (conf.getBoolean("split.verify", true)) {
// NOTE: createTable is synchronous on the table, but not on the regions
- HTable table = new HTable(tableName);
+ HTable table = new HTable(conf, tableName);
int onlineRegions = 0;
while (onlineRegions < splitCount) {
onlineRegions = table.getRegionsInfo().size();
Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java?rev=1202996&r1=1202995&r2=1202996&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java Thu Nov 17 01:47:40 2011
@@ -22,7 +22,6 @@ package org.apache.hadoop.hbase.util;
import static org.junit.Assert.*;
import java.io.IOException;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -271,31 +270,20 @@ public class TestRegionSplitter {
* verifies that the region boundaries are the same as the expected region
* boundaries in expectedBounds.
*
- * @throws Various
- * junit assertions
+ * @throws Various junit assertions
*/
private void preSplitTableAndVerify(List<byte[]> expectedBounds,
String splitClass, String tableName) throws Exception {
final int numRegions = expectedBounds.size() - 1;
final Configuration conf = UTIL.getConfiguration();
conf.setInt("split.count", numRegions);
- SplitAlgorithm splitAlgo = RegionSplitter.newSplitAlgoInstance(conf, splitClass);
+ SplitAlgorithm splitAlgo = RegionSplitter.newSplitAlgoInstance(conf,
+ splitClass);
RegionSplitter.createPresplitTable(tableName, splitAlgo,
new String[] { CF_NAME }, conf);
verifyBounds(expectedBounds, tableName);
}
- private void rollingSplitAndVerify(String tableName, String splitClass,
- List<byte[]> expectedBounds) throws Exception {
- final Configuration conf = UTIL.getConfiguration();
-
- // Set this larger than the number of splits so RegionSplitter won't block
- conf.setInt("split.outstanding", 5);
- SplitAlgorithm splitAlgo = RegionSplitter.newSplitAlgoInstance(conf, splitClass);
- RegionSplitter.rollingSplit(tableName, splitAlgo, conf);
- verifyBounds(expectedBounds, tableName);
- }
-
private void verifyBounds(List<byte[]> expectedBounds, String tableName)
throws Exception {
// Get region boundaries from the cluster and verify their endpoints
@@ -341,16 +329,4 @@ public class TestRegionSplitter {
return -1;
}
- /**
- * Inserts some meaningless data into a CF so the regions can be split.
- */
- static void insertSomeData(String table) throws IOException {
- HTable hTable = new HTable(table);
- for (byte b = Byte.MIN_VALUE; b < Byte.MAX_VALUE; b++) {
- byte[] whateverBytes = new byte[] { b };
- Put p = new Put(whateverBytes);
- p.add(CF_NAME.getBytes(), whateverBytes, whateverBytes);
- hTable.put(p);
- }
- }
}