HBASE-5472 LoadIncrementalHFiles loops forever if the target table misses a CF -- REVERT. BROKE BUILD

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1471137 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-04-23 20:52:16 +00:00
parent e34b0e5723
commit 9b36388597
2 changed files with 18 additions and 49 deletions

View File

@ -220,26 +220,6 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
Deque<LoadQueueItem> queue = new LinkedList<LoadQueueItem>(); Deque<LoadQueueItem> queue = new LinkedList<LoadQueueItem>();
try { try {
discoverLoadQueue(queue, hfofDir); discoverLoadQueue(queue, hfofDir);
// check whether there is invalid family name in HFiles to be bulkloaded
Collection<HColumnDescriptor> families = table.getTableDescriptor().getFamilies();
ArrayList<String> familyNames = new ArrayList<String>();
for (HColumnDescriptor family : families) {
familyNames.add(family.getNameAsString());
}
ArrayList<String> unmatchedFamilies = new ArrayList<String>();
for (LoadQueueItem lqi : queue) {
String familyNameInHFile = Bytes.toString(lqi.family);
if (!familyNames.contains(familyNameInHFile)) {
unmatchedFamilies.add(familyNameInHFile);
}
}
if (unmatchedFamilies.size() > 0) {
String msg = "Unmatched family names found: unmatched family names in HFiles to be bulkloaded: "
+ unmatchedFamilies + "; valid family names of table "
+ Bytes.toString(table.getTableName()) + " are: " + familyNames;
LOG.error(msg);
throw new IOException(msg);
}
int count = 0; int count = 0;
if (queue.isEmpty()) { if (queue.isEmpty()) {

View File

@ -53,7 +53,6 @@ import org.junit.experimental.categories.Category;
public class TestLoadIncrementalHFiles { public class TestLoadIncrementalHFiles {
private static final byte[] QUALIFIER = Bytes.toBytes("myqual"); private static final byte[] QUALIFIER = Bytes.toBytes("myqual");
private static final byte[] FAMILY = Bytes.toBytes("myfam"); private static final byte[] FAMILY = Bytes.toBytes("myfam");
private static final String EXPECTED_MSG_FOR_NON_EXISTING_FAMILY = "invalid family name found";
private static final byte[][] SPLIT_KEYS = new byte[][] { private static final byte[][] SPLIT_KEYS = new byte[][] {
Bytes.toBytes("ddd"), Bytes.toBytes("ddd"),
@ -189,11 +188,6 @@ public class TestLoadIncrementalHFiles {
HBaseAdmin admin = new HBaseAdmin(util.getConfiguration()); HBaseAdmin admin = new HBaseAdmin(util.getConfiguration());
HTableDescriptor htd = new HTableDescriptor(TABLE); HTableDescriptor htd = new HTableDescriptor(TABLE);
// set real family name to upper case in purpose to simulate the case that
// family name in HFiles is invalid
HColumnDescriptor family =
new HColumnDescriptor(Bytes.toBytes(new String(FAMILY).toUpperCase()));
htd.addFamily(family);
admin.createTable(htd, SPLIT_KEYS); admin.createTable(htd, SPLIT_KEYS);
HTable table = new HTable(util.getConfiguration(), TABLE); HTable table = new HTable(util.getConfiguration(), TABLE);
@ -204,11 +198,6 @@ public class TestLoadIncrementalHFiles {
assertTrue("Loading into table with non-existent family should have failed", false); assertTrue("Loading into table with non-existent family should have failed", false);
} catch (Exception e) { } catch (Exception e) {
assertTrue("IOException expected", e instanceof IOException); assertTrue("IOException expected", e instanceof IOException);
// further check whether the exception message is correct
String errMsg = e.getMessage();
assertTrue("Incorrect exception message, expected message: ["
+ EXPECTED_MSG_FOR_NON_EXISTING_FAMILY + "], current message: [" + errMsg + "]",
errMsg.contains(EXPECTED_MSG_FOR_NON_EXISTING_FAMILY));
} }
table.close(); table.close();
admin.close(); admin.close();