Author: stack
Date: Thu Jul 16 05:27:25 2009
New Revision: 794535
URL: http://svn.apache.org/viewvc?rev=794535&view=rev
Log:
HBASE-1215 allow that file rewrite may have happened before migration -- likely
the case when data is big
Modified:
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java
hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/MigrationTest.java
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java?rev=794535&r1=794534&r2=794535&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java
(original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Migrate.java Thu
Jul 16 05:27:25 2009
@@ -184,9 +184,9 @@
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 @@
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 @@
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.
Modified:
hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/MigrationTest.java
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/MigrationTest.java?rev=794535&r1=794534&r2=794535&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/MigrationTest.java
(original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/util/MigrationTest.java
Thu Jul 16 05:27:25 2009
@@ -61,7 +61,6 @@
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();