HBASE-1215 allow that file rewrite may have happened before migration -- likely the case when data is big
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@794535 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
525d1f985d
commit
64311a2922
|
@ -184,9 +184,9 @@ public class Migrate extends Configured implements Tool {
|
|||
if (version == HBASE_0_1_VERSION ||
|
||||
Integer.valueOf(versionStr).intValue() < PREVIOUS_VERSION) {
|
||||
String msg = "Cannot upgrade from " + versionStr + " to " +
|
||||
HConstants.FILE_SYSTEM_VERSION + " you must install an earlier hbase, run " +
|
||||
"the upgrade tool, reinstall this version and run this utility again." +
|
||||
MIGRATION_LINK;
|
||||
HConstants.FILE_SYSTEM_VERSION + " you must install an earlier hbase, run " +
|
||||
"the upgrade tool, reinstall this version and run this utility again." +
|
||||
MIGRATION_LINK;
|
||||
System.out.println(msg);
|
||||
throw new IOException(msg);
|
||||
}
|
||||
|
@ -217,13 +217,26 @@ public class Migrate extends Configured implements Tool {
|
|||
Path hbaseRootDir = new Path(conf.get(HConstants.HBASE_DIR));
|
||||
boolean pre020 = FSUtils.isPre020FileLayout(fs, hbaseRootDir);
|
||||
if (pre020) {
|
||||
LOG.info("Checking pre020 filesystem is major compacted");
|
||||
if (!FSUtils.isMajorCompactedPre020(fs, hbaseRootDir)) {
|
||||
String msg = "All tables must be major compacted before migration." +
|
||||
MIGRATION_LINK;
|
||||
System.out.println(msg);
|
||||
throw new IOException(msg);
|
||||
}
|
||||
// TODO: Rewrite regions.
|
||||
rewrite(fs, hbaseRootDir);
|
||||
}
|
||||
LOG.info("Checking filesystem is major compacted");
|
||||
// Below check is good for both making sure that we are major compacted
|
||||
// but will also fail if not all dirs were rewritten.
|
||||
if (!FSUtils.isMajorCompacted(fs, hbaseRootDir)) {
|
||||
LOG.info("Checking filesystem is major compacted");
|
||||
if (!FSUtils.isMajorCompacted(fs, hbaseRootDir)) {
|
||||
String msg = "All tables must be major compacted before migration." +
|
||||
MIGRATION_LINK;
|
||||
System.out.println(msg);
|
||||
throw new IOException(msg);
|
||||
}
|
||||
}
|
||||
// TOOD: Verify all has been brought over from old to new layout.
|
||||
final MetaUtils utils = new MetaUtils(this.conf);
|
||||
|
@ -269,6 +282,15 @@ set to control the master's address (not mandatory).
|
|||
utils.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Rewrite all under hbase root dir.
|
||||
* @param fs
|
||||
* @param hbaseRootDir
|
||||
*/
|
||||
private void rewrite(final FileSystem fs, final Path hbaseRootDir) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable blockcaching on catalog tables.
|
||||
|
|
|
@ -61,7 +61,6 @@ public class MigrationTest extends HBaseTestCase {
|
|||
FileSystem fs = FileSystem.get(this.conf);
|
||||
Path hbasedir = loadTestData(fs, rootdir);
|
||||
assertTrue(fs.exists(hbasedir));
|
||||
listPaths(fs, hbasedir, -1);
|
||||
Migrate migrator = new Migrate(this.conf);
|
||||
Path qualified = fs.makeQualified(hbasedir);
|
||||
String uri = qualified.toString();
|
||||
|
|
Loading…
Reference in New Issue