You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jm...@apache.org on 2013/04/02 20:50:30 UTC
svn commit: r1463664 - in /hbase/trunk/hbase-server/src:
main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java
Author: jmhsieh
Date: Tue Apr 2 18:50:30 2013
New Revision: 1463664
URL: http://svn.apache.org/r1463664
Log:
HBASE-8192 Logic error causes infinite loop in HRegion.bulkLoadHFiles(List) (Chenghao Jiang)
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1463664&r1=1463663&r2=1463664&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Tue Apr 2 18:50:30 2013
@@ -3215,7 +3215,6 @@ public class HRegion implements HeapSize
IOException ioe = new org.apache.hadoop.hbase.exceptions.DoNotRetryIOException(
"No such column family " + Bytes.toStringBinary(familyName));
ioes.add(ioe);
- failures.add(p);
} else {
try {
store.assertBulkLoadHFileOk(new Path(path));
@@ -3229,6 +3228,13 @@ public class HRegion implements HeapSize
}
}
+ // validation failed because of some sort of IO problem.
+ if (ioes.size() != 0) {
+ IOException e = MultipleIOException.createIOException(ioes);
+ LOG.error("There were one or more IO errors when checking if the bulk load is ok.", e);
+ throw e;
+ }
+
// validation failed, bail out before doing anything permanent.
if (failures.size() != 0) {
StringBuilder list = new StringBuilder();
@@ -3242,13 +3248,6 @@ public class HRegion implements HeapSize
return false;
}
- // validation failed because of some sort of IO problem.
- if (ioes.size() != 0) {
- IOException e = MultipleIOException.createIOException(ioes);
- LOG.error("There were one or more IO errors when checking if the bulk load is ok.", e);
- throw e;
- }
-
for (Pair<byte[], String> p : familyPaths) {
byte[] familyName = p.getFirst();
String path = p.getSecond();
Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java?rev=1463664&r1=1463663&r2=1463664&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java Tue Apr 2 18:50:30 2013
@@ -160,6 +160,49 @@ public class TestLoadIncrementalHFiles {
assertEquals(expectedRows, util.countRows(table));
}
+ /**
+ * Test loading into a column family that does not exist.
+ */
+ @Test
+ public void testNonexistentColumnFamilyLoad() throws Exception {
+ String testName = "testNonexistentColumnFamilyLoad";
+ byte[][][] hfileRanges = new byte[][][] {
+ new byte[][]{ Bytes.toBytes("aaa"), Bytes.toBytes("ccc") },
+ new byte[][]{ Bytes.toBytes("ddd"), Bytes.toBytes("ooo") },
+ };
+
+ Path dir = util.getDataTestDirOnTestFS(testName);
+ FileSystem fs = util.getTestFileSystem();
+ dir = dir.makeQualified(fs);
+ Path familyDir = new Path(dir, Bytes.toString(FAMILY));
+
+ int hfileIdx = 0;
+ for (byte[][] range : hfileRanges) {
+ byte[] from = range[0];
+ byte[] to = range[1];
+ createHFile(util.getConfiguration(), fs, new Path(familyDir, "hfile_"
+ + hfileIdx++), FAMILY, QUALIFIER, from, to, 1000);
+ }
+
+ final byte[] TABLE = Bytes.toBytes("mytable_"+testName);
+
+ HBaseAdmin admin = new HBaseAdmin(util.getConfiguration());
+ HTableDescriptor htd = new HTableDescriptor(TABLE);
+ admin.createTable(htd, SPLIT_KEYS);
+
+ HTable table = new HTable(util.getConfiguration(), TABLE);
+ util.waitTableEnabled(TABLE);
+ LoadIncrementalHFiles loader = new LoadIncrementalHFiles(util.getConfiguration(), false);
+ try {
+ loader.doBulkLoad(dir, table);
+ assertTrue("Loading into table with non-existent family should have failed", false);
+ } catch (Exception e) {
+ assertTrue("IOException expected", e instanceof IOException);
+ }
+ table.close();
+ admin.close();
+ }
+
private void verifyAssignedSequenceNumber(String testName,
byte[][][] hfileRanges, boolean nonZero) throws Exception {
Path dir = util.getDataTestDir(testName);