HBASE-62 Allow user add arbitrary key/value pairs to table and column descriptors; Remove an exception catch I'd left in place, remove unused imports

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@677603 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-07-17 15:00:36 +00:00
parent 6279d759c0
commit f656ae1923
2 changed files with 7 additions and 15 deletions

View File

@ -22,9 +22,7 @@ package org.apache.hadoop.hbase.util;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -43,7 +41,6 @@ import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.io.BatchUpdate; import org.apache.hadoop.hbase.io.BatchUpdate;
import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.HStore;
import org.apache.hadoop.hbase.regionserver.HStoreFile; import org.apache.hadoop.hbase.regionserver.HStoreFile;
import org.apache.hadoop.util.GenericOptionsParser; import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.Tool;
@ -82,18 +79,14 @@ import org.apache.hadoop.util.ToolRunner;
public class Migrate extends Configured implements Tool { public class Migrate extends Configured implements Tool {
private static final Log LOG = LogFactory.getLog(Migrate.class); private static final Log LOG = LogFactory.getLog(Migrate.class);
private static final String OLD_PREFIX = "hregion_";
private final HBaseConfiguration conf; private final HBaseConfiguration conf;
private FileSystem fs; private FileSystem fs;
// Gets set by migration methods if we are in readOnly mode. // Gets set by migration methods if we are in readOnly mode.
private boolean migrationNeeded = false; boolean migrationNeeded = false;
boolean readOnly = false;
private boolean readOnly = false;
private final Set<String> references = new HashSet<String>();
// Filesystem version of hbase 0.1.x. // Filesystem version of hbase 0.1.x.
private static final float HBASE_0_1_VERSION = 0.1f; private static final float HBASE_0_1_VERSION = 0.1f;
@ -183,12 +176,13 @@ public class Migrate extends Configured implements Tool {
LOG.info("No upgrade necessary."); LOG.info("No upgrade necessary.");
return 0; return 0;
} }
if (versionStr == null || Float.parseFloat(versionStr) < 0.1) { if (versionStr == null ||
Float.parseFloat(versionStr) < HBASE_0_1_VERSION) {
throw new IOException("Install 0.1.x of hbase and run its " + throw new IOException("Install 0.1.x of hbase and run its " +
"migration first"); "migration first");
} }
float version = Float.parseFloat(versionStr); float version = Float.parseFloat(versionStr);
if (version == 0.1f) { if (version == HBASE_0_1_VERSION) {
checkForUnrecoveredLogFiles(getRootDirFiles()); checkForUnrecoveredLogFiles(getRootDirFiles());
migrateToV5(); migrateToV5();
} else { } else {
@ -254,8 +248,6 @@ public class Migrate extends Configured implements Tool {
return true; return true;
} }
}); });
} catch (Exception e) {
LOG.error("", e);
} finally { } finally {
utils.shutdown(); utils.shutdown();
} }

View File

@ -49,7 +49,7 @@ public class TestMetaUtils extends HBaseClusterTestCase {
// Now assert columns were added and deleted. // Now assert columns were added and deleted.
this.cluster = new MiniHBaseCluster(this.conf, 1); this.cluster = new MiniHBaseCluster(this.conf, 1);
HTable t = new HTable(conf, editTable); HTable t = new HTable(conf, editTable);
HTableDescriptor htd = t.getMetadata(); HTableDescriptor htd = t.getTableDescriptor();
HColumnDescriptor hcd = htd.getFamily(newColumn); HColumnDescriptor hcd = htd.getFamily(newColumn);
assertTrue(hcd != null); assertTrue(hcd != null);
assertNull(htd.getFamily(Bytes.toBytes(oldColumn))); assertNull(htd.getFamily(Bytes.toBytes(oldColumn)));