hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1511577 [19/23] - in /hbase/trunk: hbase-client/src/main/java/org/apache/hadoop/hbase/ hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/ hbase-client/src/main/java/org/apache/hadoop/hbase/client/ hbase-client/src/main/java/org/ap...
Date Thu, 08 Aug 2013 04:19:56 GMT
Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java Thu Aug  8 04:19:49 2013
@@ -30,6 +30,7 @@ import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.master.RegionPlan;
@@ -197,7 +198,8 @@ public class BalancerTestBase {
       }
       Bytes.putInt(start, 0, numRegions << 1);
       Bytes.putInt(end, 0, (numRegions << 1) + 1);
-      byte[] tableName = Bytes.toBytes("table" +  (numTables > 0 ? rand.nextInt(numTables) : i));
+      TableName tableName =
+          TableName.valueOf("table" + (numTables > 0 ? rand.nextInt(numTables) : i));
       HRegionInfo hri = new HRegionInfo(tableName, start, end, false, regionId++);
       regions.add(hri);
     }

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredNodeAssignmentHelper.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredNodeAssignmentHelper.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredNodeAssignmentHelper.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredNodeAssignmentHelper.java Thu Aug  8 04:19:49 2013
@@ -28,6 +28,7 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.SmallTests;
 import org.apache.hadoop.hbase.ServerName;
@@ -271,7 +272,7 @@ public class TestFavoredNodeAssignmentHe
     // create regions
     List<HRegionInfo> regions = new ArrayList<HRegionInfo>(regionCount);
     for (int i = 0; i < regionCount; i++) {
-      HRegionInfo region = new HRegionInfo(("foobar"+i).getBytes());
+      HRegionInfo region = new HRegionInfo(TableName.valueOf("foobar" + i));
       regions.add(region);
     }
     // place the regions
@@ -299,7 +300,7 @@ public class TestFavoredNodeAssignmentHe
     // create some regions
     List<HRegionInfo> regions = new ArrayList<HRegionInfo>(regionCount);
     for (int i = 0; i < regionCount; i++) {
-      HRegionInfo region = new HRegionInfo(("foobar" + i).getBytes());
+      HRegionInfo region = new HRegionInfo(TableName.valueOf("foobar" + i));
       regions.add(region);
     }
     // place those regions in primary RSs

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileLinkCleaner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileLinkCleaner.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileLinkCleaner.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileLinkCleaner.java Thu Aug  8 04:19:49 2013
@@ -27,16 +27,14 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.Server;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.SmallTests;
-import org.apache.hadoop.hbase.backup.HFileArchiver;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.io.HFileLink;
-import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.util.HFileArchiveUtil;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
@@ -60,13 +58,13 @@ public class TestHFileLinkCleaner {
     Path rootDir = FSUtils.getRootDir(conf);
     FileSystem fs = FileSystem.get(conf);
 
-    final String tableName = "test-table";
-    final String tableLinkName = "test-link";
+    final TableName tableName = TableName.valueOf("test-table");
+    final TableName tableLinkName = TableName.valueOf("test-link");
     final String hfileName = "1234567890";
     final String familyName = "cf";
 
-    HRegionInfo hri = new HRegionInfo(Bytes.toBytes(tableName));
-    HRegionInfo hriLink = new HRegionInfo(Bytes.toBytes(tableLinkName));
+    HRegionInfo hri = new HRegionInfo(tableName);
+    HRegionInfo hriLink = new HRegionInfo(tableLinkName);
 
     Path archiveDir = HFileArchiveUtil.getArchivePath(conf);
     Path archiveStoreDir = HFileArchiveUtil.getStoreArchivePath(conf,
@@ -103,7 +101,8 @@ public class TestHFileLinkCleaner {
     assertTrue(fs.exists(hfilePath));
 
     // Link backref can be removed
-    fs.rename(new Path(rootDir, tableLinkName), new Path(archiveDir, tableLinkName));
+    fs.rename(FSUtils.getTableDir(rootDir, tableLinkName),
+        FSUtils.getTableDir(archiveDir, tableLinkName));
     cleaner.chore();
     assertFalse("Link should be deleted", fs.exists(linkBackRef));
 
@@ -117,15 +116,15 @@ public class TestHFileLinkCleaner {
       Thread.sleep(ttl * 2);
       cleaner.chore();
     }
-    assertFalse("HFile should be deleted", fs.exists(new Path(archiveDir, tableName)));
-    assertFalse("Link should be deleted", fs.exists(new Path(archiveDir, tableLinkName)));
+    assertFalse("HFile should be deleted", fs.exists(FSUtils.getTableDir(archiveDir, tableName)));
+    assertFalse("Link should be deleted", fs.exists(FSUtils.getTableDir(archiveDir, tableLinkName)));
 
     cleaner.interrupt();
   }
 
-  private static Path getFamilyDirPath (final Path rootDir, final String table,
+  private static Path getFamilyDirPath (final Path rootDir, final TableName table,
     final String region, final String family) {
-    return new Path(new Path(new Path(rootDir, table), region), family);
+    return new Path(new Path(FSUtils.getTableDir(rootDir, table), region), family);
   }
 
   static class DummyServer implements Server {

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java Thu Aug  8 04:19:49 2013
@@ -33,6 +33,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.MediumTests;
@@ -42,6 +43,7 @@ import org.apache.hadoop.hbase.master.HM
 import org.apache.hadoop.hbase.master.snapshot.DisabledTableSnapshotHandler;
 import org.apache.hadoop.hbase.master.snapshot.SnapshotHFileCleaner;
 import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
+import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.DeleteSnapshotRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.IsSnapshotDoneRequest;
@@ -83,9 +85,9 @@ public class TestSnapshotFromMaster {
 
   // for hfile archiving test.
   private static Path archiveDir;
-  private static final String STRING_TABLE_NAME = "test";
   private static final byte[] TEST_FAM = Bytes.toBytes("fam");
-  private static final byte[] TABLE_NAME = Bytes.toBytes(STRING_TABLE_NAME);
+  private static final TableName TABLE_NAME =
+      TableName.valueOf("test");
   // refresh the cache every 1/2 second
   private static final long cacheRefreshPeriod = 500;
 
@@ -128,7 +130,7 @@ public class TestSnapshotFromMaster {
   @Before
   public void setup() throws Exception {
     UTIL.createTable(TABLE_NAME, TEST_FAM);
-    master.getSnapshotManagerForTesting().setSnapshotHandlerForTesting(STRING_TABLE_NAME, null);
+    master.getSnapshotManagerForTesting().setSnapshotHandlerForTesting(TABLE_NAME, null);
   }
 
   @After
@@ -160,6 +162,7 @@ public class TestSnapshotFromMaster {
   public void testIsDoneContract() throws Exception {
 
     IsSnapshotDoneRequest.Builder builder = IsSnapshotDoneRequest.newBuilder();
+
     String snapshotName = "asyncExpectedFailureTest";
 
     // check that we get an exception when looking up snapshot where one hasn't happened
@@ -168,7 +171,7 @@ public class TestSnapshotFromMaster {
 
     // and that we get the same issue, even if we specify a name
     SnapshotDescription desc = SnapshotDescription.newBuilder()
-      .setName(snapshotName).setTable(STRING_TABLE_NAME).build();
+      .setName(snapshotName).setTable(TABLE_NAME.getNameAsString()).build();
     builder.setSnapshot(desc);
     SnapshotTestingUtils.expectSnapshotDoneException(master, builder.build(),
       UnknownSnapshotException.class);
@@ -182,7 +185,7 @@ public class TestSnapshotFromMaster {
       .thenReturn(EnvironmentEdgeManager.currentTimeMillis());
 
     master.getSnapshotManagerForTesting()
-        .setSnapshotHandlerForTesting(STRING_TABLE_NAME, mockHandler);
+        .setSnapshotHandlerForTesting(TABLE_NAME, mockHandler);
 
     // if we do a lookup without a snapshot name, we should fail - you should always know your name
     builder = IsSnapshotDoneRequest.newBuilder();
@@ -322,7 +325,7 @@ public class TestSnapshotFromMaster {
       LOG.debug(file.getPath());
     }
     // get the archived files for the table
-    Collection<String> files = getArchivedHFiles(archiveDir, rootDir, fs, STRING_TABLE_NAME);
+    Collection<String> files = getArchivedHFiles(archiveDir, rootDir, fs, TABLE_NAME);
 
     // and make sure that there is a proper subset
     for (FileStatus file : snapshotHFiles) {
@@ -349,7 +352,7 @@ public class TestSnapshotFromMaster {
     LOG.info("After delete snapshot cleaners run File-System state");
     FSUtils.logFileSystemState(fs, rootDir, LOG);
 
-    files = getArchivedHFiles(archiveDir, rootDir, fs, STRING_TABLE_NAME);
+    files = getArchivedHFiles(archiveDir, rootDir, fs, TABLE_NAME);
     assertEquals("Still have some hfiles in the archive, when their snapshot has been deleted.", 0,
       files.size());
   }
@@ -359,8 +362,8 @@ public class TestSnapshotFromMaster {
    * @throws IOException on expected failure
    */
   private final Collection<String> getArchivedHFiles(Path archiveDir, Path rootDir,
-      FileSystem fs, String tableName) throws IOException {
-    Path tableArchive = new Path(archiveDir, tableName);
+      FileSystem fs, TableName tableName) throws IOException {
+    Path tableArchive = FSUtils.getTableDir(archiveDir, tableName);
     FileStatus[] archivedHFiles = SnapshotTestingUtils.listHFiles(fs, tableArchive);
     List<String> files = new ArrayList<String>(archivedHFiles.length);
     LOG.debug("Have archived hfiles: " + tableArchive);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestCreateTableHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestCreateTableHandler.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestCreateTableHandler.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestCreateTableHandler.java Thu Aug  8 04:19:49 2013
@@ -27,6 +27,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -67,9 +68,9 @@ public class TestCreateTableHandler {
   public void testCreateTableHandlerIfCalledTwoTimesAndFirstOneIsUnderProgress() throws Exception {
     final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
     final HMaster m = cluster.getMaster();
-    final HTableDescriptor desc = new HTableDescriptor(TABLENAME);
+    final HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(TABLENAME));
     desc.addFamily(new HColumnDescriptor(FAMILYNAME));
-    final HRegionInfo[] hRegionInfos = new HRegionInfo[] { new HRegionInfo(desc.getName(), null,
+    final HRegionInfo[] hRegionInfos = new HRegionInfo[] { new HRegionInfo(desc.getTableName(), null,
         null) };
     CustomCreateTableHandler handler = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
         desc, cluster.getConfiguration(), hRegionInfos, m);
@@ -89,15 +90,14 @@ public class TestCreateTableHandler {
     assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(TABLENAME));
 
   }
-
   @Test (timeout=60000)
   public void testMasterRestartAfterEnablingNodeIsCreated() throws Exception {
     byte[] tableName = Bytes.toBytes("testMasterRestartAfterEnablingNodeIsCreated");
     final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
     final HMaster m = cluster.getMaster();
-    final HTableDescriptor desc = new HTableDescriptor(tableName);
+    final HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName));
     desc.addFamily(new HColumnDescriptor(FAMILYNAME));
-    final HRegionInfo[] hRegionInfos = new HRegionInfo[] { new HRegionInfo(desc.getName(), null,
+    final HRegionInfo[] hRegionInfos = new HRegionInfo[] { new HRegionInfo(desc.getTableName(), null,
         null) };
     CustomCreateTableHandler handler = new CustomCreateTableHandler(m, m.getMasterFileSystem(),
         desc, cluster.getConfiguration(), hRegionInfos, m);
@@ -126,12 +126,12 @@ public class TestCreateTableHandler {
     }
 
     @Override
-    protected List<HRegionInfo> handleCreateHdfsRegions(Path tableRootDir, String tableName)
-        throws IOException {
+    protected List<HRegionInfo> handleCreateHdfsRegions(Path tableRootDir,
+        TableName tableName) throws IOException {
       if (throwException) {
         throw new IOException("Test throws exceptions.");
       }
       return super.handleCreateHdfsRegions(tableRootDir, tableName);
     }
   }
-}
\ No newline at end of file
+}

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestTableDeleteFamilyHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestTableDeleteFamilyHandler.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestTableDeleteFamilyHandler.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestTableDeleteFamilyHandler.java Thu Aug  8 04:19:49 2013
@@ -28,6 +28,7 @@ import java.io.IOException;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
@@ -35,6 +36,7 @@ import org.apache.hadoop.hbase.LargeTest
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.FSUtils;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -45,7 +47,8 @@ import org.junit.experimental.categories
 public class TestTableDeleteFamilyHandler {
 
   private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
-  private static final String TABLENAME = "column_family_handlers";
+  private static final TableName TABLENAME =
+      TableName.valueOf("column_family_handlers");
   private static final byte[][] FAMILIES = new byte[][] { Bytes.toBytes("cf1"),
       Bytes.toBytes("cf2"), Bytes.toBytes("cf3") };
 
@@ -61,12 +64,17 @@ public class TestTableDeleteFamilyHandle
     TEST_UTIL.startMiniCluster(2);
 
     // Create a table of three families. This will assign a region.
-    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES);
+    TEST_UTIL.createTable(TABLENAME, FAMILIES);
     HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
-
+    while(TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager()
+        .getRegionStates().getRegionsInTransition().size() > 0) {
+      Thread.sleep(100);
+    }
     // Create multiple regions in all the three column families
-    TEST_UTIL.createMultiRegions(t, FAMILIES[0]);
-
+    while(TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager()
+        .getRegionStates().getRegionsInTransition().size() > 0) {
+      Thread.sleep(100);
+    }
     // Load the table with data for all families
     TEST_UTIL.loadTable(t, FAMILIES);
 
@@ -77,7 +85,7 @@ public class TestTableDeleteFamilyHandle
 
   @AfterClass
   public static void afterAllTests() throws Exception {
-    TEST_UTIL.deleteTable(Bytes.toBytes(TABLENAME));
+    TEST_UTIL.deleteTable(TABLENAME);
     TEST_UTIL.shutdownMiniCluster();
   }
 
@@ -90,8 +98,7 @@ public class TestTableDeleteFamilyHandle
   public void deleteColumnFamilyWithMultipleRegions() throws Exception {
 
     HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
-    HTableDescriptor beforehtd = admin.getTableDescriptor(Bytes
-        .toBytes(TABLENAME));
+    HTableDescriptor beforehtd = admin.getTableDescriptor(TABLENAME);
 
     FileSystem fs = TEST_UTIL.getDFSCluster().getFileSystem();
 
@@ -107,8 +114,7 @@ public class TestTableDeleteFamilyHandle
     }
 
     // 3 - Check if table exists in FS
-    Path tableDir = new Path(TEST_UTIL.getDefaultRootDirPath().toString() + "/"
-        + TABLENAME);
+    Path tableDir = FSUtils.getTableDir(TEST_UTIL.getDefaultRootDirPath(), TABLENAME);
     assertTrue(fs.exists(tableDir));
 
     // 4 - Check if all the 3 column families exist in FS
@@ -120,7 +126,7 @@ public class TestTableDeleteFamilyHandle
         for (int j = 0; j < cf.length; j++) {
           if (cf[j].isDir() == true
               && cf[j].getPath().getName().startsWith(".") == false) {
-            assertTrue(cf[j].getPath().getName().equals("cf" + k));
+            assertEquals(cf[j].getPath().getName(), "cf" + k);
             k++;
           }
         }
@@ -129,11 +135,10 @@ public class TestTableDeleteFamilyHandle
 
     // TEST - Disable and delete the column family
     admin.disableTable(TABLENAME);
-    admin.deleteColumn(TABLENAME, "cf2");
+    admin.deleteColumn(TABLENAME.getName(), "cf2");
 
     // 5 - Check if only 2 column families exist in the descriptor
-    HTableDescriptor afterhtd = admin.getTableDescriptor(Bytes
-        .toBytes(TABLENAME));
+    HTableDescriptor afterhtd = admin.getTableDescriptor(TABLENAME);
     assertEquals(2, afterhtd.getColumnFamilies().length);
     HColumnDescriptor[] newFamilies = afterhtd.getColumnFamilies();
     assertTrue(newFamilies[0].getNameAsString().equals("cf1"));

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestTableDescriptorModification.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestTableDescriptorModification.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestTableDescriptorModification.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestTableDescriptorModification.java Thu Aug  8 04:19:49 2013
@@ -26,9 +26,8 @@ import static org.junit.Assert.assertTru
 import java.io.IOException;
 import java.util.Set;
 
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
@@ -37,6 +36,7 @@ import org.apache.hadoop.hbase.client.HB
 import org.apache.hadoop.hbase.master.MasterFileSystem;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSTableDescriptors;
+import org.apache.hadoop.hbase.util.FSUtils;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -50,7 +50,8 @@ import org.junit.experimental.categories
 public class TestTableDescriptorModification {
 
   private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
-  private static final byte[] TABLE_NAME = Bytes.toBytes("table");
+  private static final TableName TABLE_NAME =
+      TableName.valueOf("table");
   private static final byte[] FAMILY_0 = Bytes.toBytes("cf0");
   private static final byte[] FAMILY_1 = Bytes.toBytes("cf1");
 
@@ -133,8 +134,8 @@ public class TestTableDescriptorModifica
     }
   }
 
-  private void verifyTableDescriptor(final byte[] tableName, final byte[]... families)
-      throws IOException {
+  private void verifyTableDescriptor(final TableName tableName,
+                                     final byte[]... families) throws IOException {
     HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
 
     // Verify descriptor from master
@@ -143,15 +144,15 @@ public class TestTableDescriptorModifica
 
     // Verify descriptor from HDFS
     MasterFileSystem mfs = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem();
-    Path tableDir = HTableDescriptor.getTableDir(mfs.getRootDir(), tableName);
+    Path tableDir = FSUtils.getTableDir(mfs.getRootDir(), tableName);
     htd = FSTableDescriptors.getTableDescriptorFromFs(mfs.getFileSystem(), tableDir);
     verifyTableDescriptor(htd, tableName, families);
   }
 
   private void verifyTableDescriptor(final HTableDescriptor htd,
-      final byte[] tableName, final byte[]... families) {
+      final TableName tableName, final byte[]... families) {
     Set<byte[]> htdFamilies = htd.getFamiliesKeys();
-    assertTrue(Bytes.equals(tableName, htd.getName()));
+    assertEquals(tableName, htd.getTableName());
     assertEquals(families.length, htdFamilies.size());
     for (byte[] familyName: families) {
       assertTrue("Expected family " + Bytes.toString(familyName), htdFamilies.contains(familyName));

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotHFileCleaner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotHFileCleaner.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotHFileCleaner.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotHFileCleaner.java Thu Aug  8 04:19:49 2013
@@ -24,6 +24,7 @@ import java.io.IOException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -66,8 +67,7 @@ public class TestSnapshotHFileCleaner {
     // write an hfile to the snapshot directory
     String snapshotName = "snapshot";
     byte[] snapshot = Bytes.toBytes(snapshotName);
-    String table = "table";
-    byte[] tableName = Bytes.toBytes(table);
+    TableName tableName = TableName.valueOf("table");
     Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
     HRegionInfo mockRegion = new HRegionInfo(tableName);
     Path regionSnapshotDir = new Path(snapshotDir, mockRegion.getEncodedName());

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotManager.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotManager.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotManager.java Thu Aug  8 04:19:49 2013
@@ -26,6 +26,7 @@ import java.io.IOException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.SmallTests;
@@ -79,7 +80,7 @@ public class TestSnapshotManager {
 
   @Test
   public void testInProcess() throws KeeperException, IOException {
-    String tableName = "testTable";
+    TableName tableName = TableName.valueOf("testTable");
     SnapshotManager manager = getNewManager();
     TakeSnapshotHandler handler = Mockito.mock(TakeSnapshotHandler.class);
     assertFalse("Manager is in process when there is no current handler",

Added: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java?rev=1511577&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java (added)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java Thu Aug  8 04:19:49 2013
@@ -0,0 +1,230 @@
+/**
+ * Copyright The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.migration;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.Assert;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FileUtil;
+import org.apache.hadoop.fs.FsShell;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.MediumTests;
+import org.apache.hadoop.hbase.NamespaceDescriptor;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.Waiter;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.protobuf.generated.AdminProtos;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.hadoop.util.ToolRunner;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Test upgrade from no namespace in 0.94 to namespace directory structure.
+ * Mainly tests that tables are migrated and consistent. Also verifies
+ * that snapshots have been migrated correctly.
+ *
+ * Uses a tarball which is an image of an 0.94 hbase.rootdir.
+ *
+ * Contains tables with currentKeys as the stored keys:
+ * foo, ns1.foo, ns2.foo
+ *
+ * Contains snapshots with snapshot{num}Keys as the contents:
+ * snapshot1Keys, snapshot2Keys
+ *
+ */
+@Category(MediumTests.class)
+public class TestNamespaceUpgrade {
+  static final Log LOG = LogFactory.getLog(TestNamespaceUpgrade.class);
+  private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+  private final static String snapshot1Keys[] =
+      {"1","10","2","3","4","5","6","7","8","9"};
+  private final static String snapshot2Keys[] =
+      {"1","2","3","4","5","6","7","8","9"};
+  private final static String currentKeys[] =
+      {"1","2","3","4","5","6","7","8","9","A"};
+  private final static String tables[] = {"foo", "ns1.foo","ns.two.foo"};
+
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
+    // Start up our mini cluster on top of an 0.94 root.dir that has data from
+    // a 0.94 hbase run and see if we can migrate to 0.96
+    TEST_UTIL.startMiniZKCluster();
+    TEST_UTIL.startMiniDFSCluster(1);
+    Path testdir = TEST_UTIL.getDataTestDir("TestNamespaceUpgrade");
+    // Untar our test dir.
+    File untar = untar(new File(testdir.toString()));
+    // Now copy the untar up into hdfs so when we start hbase, we'll run from it.
+    Configuration conf = TEST_UTIL.getConfiguration();
+    FsShell shell = new FsShell(conf);
+    FileSystem fs = FileSystem.get(conf);
+    // find where hbase will root itself, so we can copy filesystem there
+    Path hbaseRootDir = TEST_UTIL.getDefaultRootDirPath();
+    if (!fs.isDirectory(hbaseRootDir.getParent())) {
+      // mkdir at first
+      fs.mkdirs(hbaseRootDir.getParent());
+    }
+    doFsCommand(shell,
+      new String [] {"-put", untar.toURI().toString(), hbaseRootDir.toString()});
+    // See whats in minihdfs.
+    doFsCommand(shell, new String [] {"-lsr", "/"});
+    Configuration toolConf = TEST_UTIL.getConfiguration();
+    conf.set(HConstants.HBASE_DIR, TEST_UTIL.getDefaultRootDirPath().toString());
+    ToolRunner.run(toolConf, new NamespaceUpgrade(), new String[]{"--upgrade"});
+
+    assertTrue(FSUtils.getVersion(fs, hbaseRootDir).equals(HConstants.FILE_SYSTEM_VERSION));
+    TEST_UTIL.startMiniHBaseCluster(1, 1);
+
+    for(String table: tables) {
+      int count = 0;
+      for(Result res: new HTable(TEST_UTIL.getConfiguration(), table).getScanner(new Scan())) {
+        assertEquals(currentKeys[count++], Bytes.toString(res.getRow()));
+      }
+      Assert.assertEquals(currentKeys.length, count);
+    }
+    assertEquals(2, TEST_UTIL.getHBaseAdmin().listNamespaceDescriptors().length);
+  }
+
+  private static File untar(final File testdir) throws IOException {
+    // Find the src data under src/test/data
+    final String datafile = "TestNamespaceUpgrade";
+    File srcTarFile = new File(
+      System.getProperty("project.build.testSourceDirectory", "src/test") +
+      File.separator + "data" + File.separator + datafile + ".tgz");
+    File homedir = new File(testdir.toString());
+    File tgtUntarDir = new File(homedir, "hbase");
+    if (tgtUntarDir.exists()) {
+      if (!FileUtil.fullyDelete(tgtUntarDir)) {
+        throw new IOException("Failed delete of " + tgtUntarDir.toString());
+      }
+    }
+    if (!srcTarFile.exists()) {
+      throw new IOException(srcTarFile+" does not exist");
+    }
+    LOG.info("Untarring " + srcTarFile + " into " + homedir.toString());
+    FileUtil.unTar(srcTarFile, homedir);
+    Assert.assertTrue(tgtUntarDir.exists());
+    return tgtUntarDir;
+  }
+
+  private static void doFsCommand(final FsShell shell, final String [] args)
+  throws Exception {
+    // Run the 'put' command.
+    int errcode = shell.run(args);
+    if (errcode != 0) throw new IOException("Failed put; errcode=" + errcode);
+  }
+
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+    TEST_UTIL.shutdownMiniCluster();
+  }
+
+  @Test
+  public void testSnapshots() throws IOException, InterruptedException {
+    String snapshots[][] = {snapshot1Keys, snapshot2Keys};
+    for(int i=1; i<=snapshots.length; i++) {
+      for(String table: tables) {
+        TEST_UTIL.getHBaseAdmin().cloneSnapshot(table+"_snapshot"+i, table+"_clone"+i);
+        FSUtils.logFileSystemState(FileSystem.get(TEST_UTIL.getConfiguration()),
+            FSUtils.getRootDir(TEST_UTIL.getConfiguration()),
+            LOG);
+        int count = 0;
+        for(Result res: new HTable(TEST_UTIL.getConfiguration(), table+"_clone"+i).getScanner(new
+            Scan())) {
+          assertEquals(snapshots[i-1][count++], Bytes.toString(res.getRow()));
+        }
+        Assert.assertEquals(table+"_snapshot"+i, snapshots[i-1].length, count);
+      }
+    }
+  }
+
+  @Test
+  public void testRenameUsingSnapshots() throws IOException, InterruptedException {
+    String newNS = "newNS";
+    TEST_UTIL.getHBaseAdmin().createNamespace(NamespaceDescriptor.create(newNS).build());
+    for(String table: tables) {
+      int count = 0;
+      for(Result res: new HTable(TEST_UTIL.getConfiguration(), table).getScanner(new
+          Scan())) {
+        assertEquals(currentKeys[count++], Bytes.toString(res.getRow()));
+      }
+      TEST_UTIL.getHBaseAdmin().snapshot(table+"_snapshot3", table);
+      final String newTableName =
+          newNS+ TableName.NAMESPACE_DELIM+table+"_clone3";
+      TEST_UTIL.getHBaseAdmin().cloneSnapshot(table+"_snapshot3", newTableName);
+      Thread.sleep(1000);
+      count = 0;
+      for(Result res: new HTable(TEST_UTIL.getConfiguration(), newTableName).getScanner(new
+          Scan())) {
+        assertEquals(currentKeys[count++], Bytes.toString(res.getRow()));
+      }
+      FSUtils.logFileSystemState(TEST_UTIL.getTestFileSystem(), TEST_UTIL.getDefaultRootDirPath()
+          , LOG);
+      Assert.assertEquals(newTableName, currentKeys.length, count);
+      TEST_UTIL.getHBaseAdmin().flush(newTableName);
+      TEST_UTIL.getHBaseAdmin().majorCompact(newTableName);
+      TEST_UTIL.waitFor(2000, new Waiter.Predicate<IOException>() {
+        @Override
+        public boolean evaluate() throws IOException {
+          try {
+            return TEST_UTIL.getHBaseAdmin().getCompactionState(newTableName) ==
+                AdminProtos.GetRegionInfoResponse.CompactionState.NONE;
+          } catch (InterruptedException e) {
+            throw new IOException(e);
+          }
+        }
+      });
+    }
+
+    String nextNS = "nextNS";
+    TEST_UTIL.getHBaseAdmin().createNamespace(NamespaceDescriptor.create(nextNS).build());
+    for(String table: tables) {
+      String srcTable = newNS+TableName.NAMESPACE_DELIM+table+"_clone3";
+      TEST_UTIL.getHBaseAdmin().snapshot(table+"_snapshot4", srcTable);
+      String newTableName = nextNS+TableName.NAMESPACE_DELIM+table+"_clone4";
+      TEST_UTIL.getHBaseAdmin().cloneSnapshot(table+"_snapshot4", newTableName);
+      FSUtils.logFileSystemState(TEST_UTIL.getTestFileSystem(), TEST_UTIL.getDefaultRootDirPath()
+          , LOG);
+      int count = 0;
+      for(Result res: new HTable(TEST_UTIL.getConfiguration(), newTableName).getScanner(new
+          Scan())) {
+        assertEquals(currentKeys[count++], Bytes.toString(res.getRow()));
+      }
+      Assert.assertEquals(newTableName, currentKeys.length, count);
+    }
+
+  }
+}
+

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java Thu Aug  8 04:19:49 2013
@@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.HColumnDe
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.io.compress.Compression;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
@@ -343,7 +344,7 @@ public class HFileReadWriteTest {
     columnDescriptor.setCompressionType(compression);
     columnDescriptor.setDataBlockEncoding(dataBlockEncoding);
     HRegionInfo regionInfo = new HRegionInfo();
-    HTableDescriptor htd = new HTableDescriptor(TABLE_NAME);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE_NAME));
     HRegion region = new HRegion(outputDir, null, fs, conf, regionInfo, htd, null);
     HStore store = new HStore(region, columnDescriptor, conf);
 

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java Thu Aug  8 04:19:49 2013
@@ -44,6 +44,7 @@ import org.apache.hadoop.hbase.MediumTes
 import org.apache.hadoop.hbase.MultithreadedTestUtil;
 import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext;
 import org.apache.hadoop.hbase.MultithreadedTestUtil.TestThread;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Append;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
@@ -192,14 +193,14 @@ public class TestAtomicOperation extends
   private void initHRegion (byte [] tableName, String callingMethod, int [] maxVersions,
     byte[] ... families)
   throws IOException {
-    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
     int i=0;
     for(byte [] family : families) {
       HColumnDescriptor hcd = new HColumnDescriptor(family);
       hcd.setMaxVersions(maxVersions != null ? maxVersions[i++] : 1);
       htd.addFamily(hcd);
     }
-    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
     Path path = new Path(DIR + callingMethod);
     if (fs.exists(path)) {
       if (!fs.delete(path, true)) {

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksRead.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksRead.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksRead.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksRead.java Thu Aug  8 04:19:49 2013
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.HRegionIn
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.MediumTests;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Put;
@@ -95,7 +96,7 @@ public class TestBlocksRead extends HBas
    */
   private HRegion initHRegion(byte[] tableName, String callingMethod,
       HBaseConfiguration conf, String family) throws IOException {
-    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
     HColumnDescriptor familyDesc;
     for (int i = 0; i < BLOOM_TYPE.length; i++) {
       BloomType bloomType = BLOOM_TYPE[i];
@@ -105,7 +106,7 @@ public class TestBlocksRead extends HBas
       htd.addFamily(familyDesc);
     }
 
-    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
     Path path = new Path(DIR + callingMethod);
     HRegion r = HRegion.createHRegion(info, path, conf, htd);
     blockCache = new CacheConfig(conf).getBlockCache();

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksScanned.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksScanned.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksScanned.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksScanned.java Thu Aug  8 04:19:49 2013
@@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.HColumnDe
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.SmallTests;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.io.compress.Compression;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -51,7 +52,7 @@ public class TestBlocksScanned extends H
      super.setUp();
 
      TEST_UTIL = new HBaseTestingUtility();
-     TESTTABLEDESC = new HTableDescriptor(TABLE);
+     TESTTABLEDESC = new HTableDescriptor(TableName.valueOf(TABLE));
 
      TESTTABLEDESC.addFamily(
          new HColumnDescriptor(FAMILY)

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java Thu Aug  8 04:19:49 2013
@@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.HRegionIn
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.MediumTests;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.fs.HFileSystem;
 import org.apache.hadoop.hbase.io.hfile.BlockCache;
 import org.apache.hadoop.hbase.io.hfile.BlockCacheKey;
@@ -152,7 +153,7 @@ public class TestCacheOnWriteInSchema {
     HColumnDescriptor hcd = new HColumnDescriptor(family);
     hcd.setBloomFilterType(BloomType.ROWCOL);
     cowType.modifyFamilySchema(hcd);
-    HTableDescriptor htd = new HTableDescriptor(table);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(table));
     htd.addFamily(hcd);
 
     // Create a store based on the schema
@@ -161,7 +162,7 @@ public class TestCacheOnWriteInSchema {
     Path logdir = new Path(DIR, logName);
     fs.delete(logdir, true);
 
-    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
     hlog = HLogFactory.createHLog(fs, basedir, logName, conf);
 
     region = new HRegion(basedir, hlog, fs, conf, info, htd, null);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestColumnSeeking.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestColumnSeeking.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestColumnSeeking.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestColumnSeeking.java Thu Aug  8 04:19:49 2013
@@ -52,14 +52,14 @@ public class TestColumnSeeking {
   public void testDuplicateVersions() throws IOException {
     String family = "Family";
     byte[] familyBytes = Bytes.toBytes("Family");
-    String table = "TestDuplicateVersions";
+    TableName table = TableName.valueOf("TestDuplicateVersions");
 
     HColumnDescriptor hcd =
         new HColumnDescriptor(familyBytes).setMaxVersions(1000);
     hcd.setMaxVersions(3);
     HTableDescriptor htd = new HTableDescriptor(table);
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(Bytes.toBytes(table), null, null, false);
+    HRegionInfo info = new HRegionInfo(table, null, null, false);
     HRegion region =
         HRegion.createHRegion(info, TEST_UTIL.getDataTestDir(), TEST_UTIL
             .getConfiguration(), htd);
@@ -166,14 +166,15 @@ public class TestColumnSeeking {
   public void testReseeking() throws IOException {
     String family = "Family";
     byte[] familyBytes = Bytes.toBytes("Family");
-    String table = "TestSingleVersions";
+    TableName table =
+        TableName.valueOf("TestSingleVersions");
 
     HTableDescriptor htd = new HTableDescriptor(table);
     HColumnDescriptor hcd = new HColumnDescriptor(family);
     hcd.setMaxVersions(3);
     htd.addFamily(hcd);
 
-    HRegionInfo info = new HRegionInfo(Bytes.toBytes(table), null, null, false);
+    HRegionInfo info = new HRegionInfo(table, null, null, false);
     HRegion region =
         HRegion.createHRegion(info, TEST_UTIL.getDataTestDir(), TEST_UTIL
             .getConfiguration(), htd);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionState.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionState.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionState.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionState.java Thu Aug  8 04:19:49 2013
@@ -28,13 +28,13 @@ import java.util.Random;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.LargeTests;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState;
-import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -123,7 +123,8 @@ public class TestCompactionState {
       final CompactionState expectedState, boolean singleFamily)
       throws IOException, InterruptedException {
     // Create a table with regions
-    byte [] table = Bytes.toBytes(tableName);
+    TableName table =
+        TableName.valueOf(tableName);
     byte [] family = Bytes.toBytes("family");
     byte [][] families =
       {family, Bytes.add(family, Bytes.toBytes("2")), Bytes.add(family, Bytes.toBytes("3"))};
@@ -139,24 +140,24 @@ public class TestCompactionState {
       HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
       if (expectedState == CompactionState.MINOR) {
         if (singleFamily) {
-          admin.compact(table, family);
+          admin.compact(table.getName(), family);
         } else {
-          admin.compact(table);
+          admin.compact(table.getName());
         }
       } else {
         if (singleFamily) {
-          admin.majorCompact(table, family);
+          admin.majorCompact(table.getName(), family);
         } else {
-          admin.majorCompact(table);
+          admin.majorCompact(table.getName());
         }
       }
       long curt = System.currentTimeMillis();
       long waitTime = 5000;
       long endt = curt + waitTime;
-      CompactionState state = admin.getCompactionState(table);
+      CompactionState state = admin.getCompactionState(table.getName());
       while (state == CompactionState.NONE && curt < endt) {
         Thread.sleep(10);
-        state = admin.getCompactionState(table);
+        state = admin.getCompactionState(table.getName());
         curt = System.currentTimeMillis();
       }
       // Now, should have the right compaction state,
@@ -168,10 +169,10 @@ public class TestCompactionState {
         }
       } else {
         // Wait until the compaction is done
-        state = admin.getCompactionState(table);
+        state = admin.getCompactionState(table.getName());
         while (state != CompactionState.NONE && curt < endt) {
           Thread.sleep(10);
-          state = admin.getCompactionState(table);
+          state = admin.getCompactionState(table.getName());
         }
         // Now, compaction should be done.
         assertEquals(CompactionState.NONE, state);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultCompactSelection.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultCompactSelection.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultCompactSelection.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultCompactSelection.java Thu Aug  8 04:19:49 2013
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.HConstant
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.SmallTests;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.io.hfile.CacheConfig;
 import org.apache.hadoop.hbase.io.hfile.NoOpDataBlockEncoder;
 import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
@@ -42,6 +43,7 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
 import org.apache.hadoop.hbase.regionserver.wal.HLogFactory;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.FSUtils;
 import org.junit.After;
 import org.junit.experimental.categories.Category;
 
@@ -87,14 +89,14 @@ public class TestDefaultCompactSelection
 
     fs.delete(logdir, true);
 
-    HTableDescriptor htd = new HTableDescriptor(Bytes.toBytes("table"));
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(Bytes.toBytes("table")));
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
 
     hlog = HLogFactory.createHLog(fs, basedir, logName, conf);
     region = HRegion.createHRegion(info, basedir, conf, htd);
     HRegion.closeHRegion(region);
-    Path tableDir = new Path(basedir, Bytes.toString(htd.getName()));
+    Path tableDir = FSUtils.getTableDir(basedir, htd.getTableName());
     region = new HRegion(tableDir, hlog, fs, conf, info, htd, null);
 
     store = new HStore(region, hcd, conf);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java Thu Aug  8 04:19:49 2013
@@ -34,6 +34,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Chore;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -87,7 +88,8 @@ public class TestEndToEndSplitTransactio
 
   @Test
   public void testMasterOpsWhileSplitting() throws Exception {
-    byte[] tableName = Bytes.toBytes("TestSplit");
+    TableName tableName =
+        TableName.valueOf("TestSplit");
     byte[] familyName = Bytes.toBytes("fam");
     HTable ht = TEST_UTIL.createTable(tableName, familyName);
     TEST_UTIL.loadTable(ht, familyName);
@@ -146,7 +148,7 @@ public class TestEndToEndSplitTransactio
    * attempt to locate the region and perform a get and scan
    * @return True if successful, False otherwise.
    */
-  private boolean test(HConnection con, byte[] tableName, byte[] row,
+  private boolean test(HConnection con, TableName tableName, byte[] row,
       HRegionServer server) {
     // not using HTable to avoid timeouts and retries
     try {
@@ -173,7 +175,8 @@ public class TestEndToEndSplitTransactio
   @Test
   public void testFromClientSideWhileSplitting() throws Throwable {
     LOG.info("Starting testFromClientSideWhileSplitting");
-    final byte[] TABLENAME = Bytes.toBytes("testFromClientSideWhileSplitting");
+    final TableName TABLENAME =
+        TableName.valueOf("testFromClientSideWhileSplitting");
     final byte[] FAMILY = Bytes.toBytes("family");
 
     //SplitTransaction will update the meta table by offlining the parent region, and adding info
@@ -206,13 +209,14 @@ public class TestEndToEndSplitTransactio
   static class RegionSplitter extends Thread {
     Throwable ex;
     HTable table;
-    byte[] tableName, family;
+    TableName tableName;
+    byte[] family;
     HBaseAdmin admin;
     HRegionServer rs;
 
     RegionSplitter(HTable table) throws IOException {
       this.table = table;
-      this.tableName = table.getTableName();
+      this.tableName = table.getName();
       this.family = table.getTableDescriptor().getFamiliesKeys().iterator().next();
       admin = TEST_UTIL.getHBaseAdmin();
       rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);
@@ -281,10 +285,10 @@ public class TestEndToEndSplitTransactio
    */
   static class RegionChecker extends Chore {
     Configuration conf;
-    byte[] tableName;
+    TableName tableName;
     Throwable ex;
 
-    RegionChecker(Configuration conf, Stoppable stopper, byte[] tableName) {
+    RegionChecker(Configuration conf, Stoppable stopper, TableName tableName) {
       super("RegionChecker", 10, stopper);
       this.conf = conf;
       this.tableName = tableName;
@@ -411,7 +415,7 @@ public class TestEndToEndSplitTransactio
     long start = System.currentTimeMillis();
     log("blocking until region is split:" +  Bytes.toStringBinary(regionName));
     HRegionInfo daughterA = null, daughterB = null;
-    HTable metaTable = new HTable(conf, HConstants.META_TABLE_NAME);
+    HTable metaTable = new HTable(conf, TableName.META_TABLE_NAME);
 
     try {
       while (System.currentTimeMillis() - start < timeout) {

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFSErrorsExposed.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFSErrorsExposed.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFSErrorsExposed.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFSErrorsExposed.java Thu Aug  8 04:19:49 2013
@@ -180,7 +180,7 @@ public class TestFSErrorsExposed {
       byte[] fam = Bytes.toBytes("fam");
 
       HBaseAdmin admin = new HBaseAdmin(util.getConfiguration());
-      HTableDescriptor desc = new HTableDescriptor(tableName);
+      HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName));
       desc.addFamily(new HColumnDescriptor(fam)
           .setMaxVersions(1)
           .setBlockCacheEnabled(false)

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java Thu Aug  8 04:19:49 2013
@@ -26,6 +26,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestCase;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -72,11 +73,11 @@ public class TestGetClosestAtOrBefore ex
     try {
     // Write rows for three tables 'A', 'B', and 'C'.
     for (char c = 'A'; c < 'D'; c++) {
-      HTableDescriptor htd = new HTableDescriptor("" + c);
+      HTableDescriptor htd = new HTableDescriptor(TableName.valueOf("" + c));
       final int last = 128;
       final int interval = 2;
       for (int i = 0; i <= last; i += interval) {
-        HRegionInfo hri = new HRegionInfo(htd.getName(),
+        HRegionInfo hri = new HRegionInfo(htd.getTableName(),
           i == 0? HConstants.EMPTY_BYTE_ARRAY: Bytes.toBytes((byte)i),
           i == last? HConstants.EMPTY_BYTE_ARRAY: Bytes.toBytes((byte)i + interval));
 
@@ -105,8 +106,9 @@ public class TestGetClosestAtOrBefore ex
     findRow(mr, 'C', 46, 46);
     findRow(mr, 'C', 43, 42);
     // Now delete 'C' and make sure I don't get entries from 'B'.
-    byte [] firstRowInC = HRegionInfo.createRegionName(Bytes.toBytes("" + 'C'),
-      HConstants.EMPTY_BYTE_ARRAY, HConstants.ZEROES, false);
+    byte [] firstRowInC = HRegionInfo.createRegionName(
+        TableName.valueOf("" + 'C'),
+        HConstants.EMPTY_BYTE_ARRAY, HConstants.ZEROES, false);
     Scan scan = new Scan(firstRowInC);
     s = mr.getScanner(scan);
     try {
@@ -151,10 +153,11 @@ public class TestGetClosestAtOrBefore ex
   private byte [] findRow(final HRegion mr, final char table,
     final int rowToFind, final int answer)
   throws IOException {
-    byte [] tableb = Bytes.toBytes("" + table);
+    TableName tableb = TableName.valueOf("" + table);
     // Find the row.
     byte [] tofindBytes = Bytes.toBytes((short)rowToFind);
-    byte [] metaKey = HRegionInfo.createRegionName(tableb, tofindBytes,
+    byte [] metaKey = HRegionInfo.createRegionName(
+        tableb, tofindBytes,
       HConstants.NINES, false);
     LOG.info("find=" + new String(metaKey));
     Result r = mr.getClosestRowBefore(metaKey);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java Thu Aug  8 04:19:49 2013
@@ -50,6 +50,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellComparator;
 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestCase;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -253,7 +254,8 @@ public class TestHRegion extends HBaseTe
 
   public void testSkipRecoveredEditsReplay() throws Exception {
     String method = "testSkipRecoveredEditsReplay";
-    byte[] tableName = Bytes.toBytes(method);
+    TableName tableName =
+        TableName.valueOf(method);
     byte[] family = Bytes.toBytes("family");
     this.region = initHRegion(tableName, method, conf, family);
     try {
@@ -303,7 +305,8 @@ public class TestHRegion extends HBaseTe
 
   public void testSkipRecoveredEditsReplaySomeIgnored() throws Exception {
     String method = "testSkipRecoveredEditsReplaySomeIgnored";
-    byte[] tableName = Bytes.toBytes(method);
+    TableName tableName =
+        TableName.valueOf(method);
     byte[] family = Bytes.toBytes("family");
     this.region = initHRegion(tableName, method, conf, family);
     try {
@@ -396,7 +399,8 @@ public class TestHRegion extends HBaseTe
   @Test
   public void testRecoveredEditsReplayCompaction() throws Exception {
     String method = "testRecoveredEditsReplayCompaction";
-    byte[] tableName = Bytes.toBytes(method);
+    TableName tableName =
+        TableName.valueOf(method);
     byte[] family = Bytes.toBytes("family");
     this.region = initHRegion(tableName, method, conf, family);
     try {
@@ -462,7 +466,7 @@ public class TestHRegion extends HBaseTe
       HTableDescriptor htd = region.getTableDesc();
       HRegionInfo info = region.getRegionInfo();
       region.close();
-      region = HRegion.openHRegion(conf, fs, regiondir.getParent().getParent(), info, htd, null);
+      region = HRegion.openHRegion(conf, fs, new Path(DIR+method),info, htd, null);
 
       //now check whether we have only one store file, the compacted one
       Collection<StoreFile> sfs = region.getStore(family).getStorefiles();
@@ -1698,7 +1702,7 @@ public class TestHRegion extends HBaseTe
   public void stestGet_Root() throws IOException {
     //Setting up region
     String method = this.getName();
-    this.region = initHRegion(HConstants.ROOT_TABLE_NAME,
+    this.region = initHRegion(TableName.ROOT_TABLE_NAME,
       method, conf, HConstants.CATALOG_FAMILY);
     try {
       //Add to memstore
@@ -3319,9 +3323,9 @@ public class TestHRegion extends HBaseTe
         .setMaxVersions(Integer.MAX_VALUE)
         .setBloomFilterType(BloomType.ROWCOL);
 
-    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
     Path path = new Path(DIR + "testBloomFilterSize");
     this.region = HRegion.createHRegion(info, path, conf, htd);
     try {
@@ -3378,9 +3382,9 @@ public class TestHRegion extends HBaseTe
     HColumnDescriptor hcd = new HColumnDescriptor(FAMILY)
         .setMaxVersions(Integer.MAX_VALUE)
         .setBloomFilterType(BloomType.ROWCOL);
-    HTableDescriptor htd = new HTableDescriptor(TABLE);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
     Path path = new Path(DIR + "testAllColumnsWithBloomFilter");
     this.region = HRegion.createHRegion(info, path, conf, htd);
     try {
@@ -3428,9 +3432,9 @@ public class TestHRegion extends HBaseTe
         .setMaxVersions(Integer.MAX_VALUE)
         .setBloomFilterType(BloomType.ROWCOL);
 
-    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
     Path path = new Path(DIR + "TestDeleteRowWithBloomFilter");
     this.region = HRegion.createHRegion(info, path, conf, htd);
     try {
@@ -3486,7 +3490,7 @@ public class TestHRegion extends HBaseTe
       ht.put(put);
 
       HRegion firstRegion = htu.getHBaseCluster().
-          getRegions(Bytes.toBytes(this.getName())).get(0);
+          getRegions(TableName.valueOf(this.getName())).get(0);
       firstRegion.flushcache();
       HDFSBlocksDistribution blocksDistribution1 =
           firstRegion.getHDFSBlocksDistribution();
@@ -3532,9 +3536,9 @@ public class TestHRegion extends HBaseTe
     try {
       FileSystem fs = Mockito.mock(FileSystem.class);
       Mockito.when(fs.exists((Path) Mockito.anyObject())).thenThrow(new IOException());
-      HTableDescriptor htd = new HTableDescriptor(tableName);
+      HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
       htd.addFamily(new HColumnDescriptor("cf"));
-      info = new HRegionInfo(htd.getName(), HConstants.EMPTY_BYTE_ARRAY,
+      info = new HRegionInfo(htd.getTableName(), HConstants.EMPTY_BYTE_ARRAY,
           HConstants.EMPTY_BYTE_ARRAY, false);
       Path path = new Path(DIR + "testStatusSettingToAbortIfAnyExceptionDuringRegionInitilization");
       region = HRegion.newHRegion(path, null, fs, conf, info, htd, null);
@@ -3564,10 +3568,10 @@ public class TestHRegion extends HBaseTe
     Path rootDir = new Path(DIR + "testRegionInfoFileCreation");
     Configuration conf = HBaseConfiguration.create(this.conf);
 
-    HTableDescriptor htd = new HTableDescriptor("testtb");
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf("testtb"));
     htd.addFamily(new HColumnDescriptor("cf"));
 
-    HRegionInfo hri = new HRegionInfo(htd.getName());
+    HRegionInfo hri = new HRegionInfo(htd.getTableName());
 
     // Create a region and skip the initialization (like CreateTableHandler)
     HRegion region = HRegion.createHRegion(hri, rootDir, conf, htd, null, false, true);
@@ -3909,12 +3913,12 @@ public class TestHRegion extends HBaseTe
       Durability mutationDurability, long timeout, boolean expectAppend,
       final boolean expectSync, final boolean expectSyncFromLogSyncer) throws Exception {
     method = method + "_" + tableDurability.name() + "_" + mutationDurability.name();
-    byte[] tableName = Bytes.toBytes(method);
+    TableName tableName = TableName.valueOf(method);
     byte[] family = Bytes.toBytes("family");
     Path logDir = new Path(new Path(DIR + method), "log");
     HLog hlog = HLogFactory.createHLog(fs, logDir, UUID.randomUUID().toString(), conf);
     final HLog log = spy(hlog);
-    this.region = initHRegion(tableName, HConstants.EMPTY_START_ROW,
+    this.region = initHRegion(tableName.getName(), HConstants.EMPTY_START_ROW,
       HConstants.EMPTY_END_ROW, method, conf, false,
       tableDurability, log, new byte[][] {family});
 
@@ -4060,6 +4064,20 @@ public class TestHRegion extends HBaseTe
    * @throws IOException
    * @return A region on which you must call {@link HRegion#closeHRegion(HRegion)} when done.
    */
+  public static HRegion initHRegion (TableName tableName, String callingMethod,
+      Configuration conf, byte [] ... families)
+    throws IOException{
+    return initHRegion(tableName.getName(), null, null, callingMethod, conf, false, families);
+  }
+
+  /**
+   * @param tableName
+   * @param callingMethod
+   * @param conf
+   * @param families
+   * @throws IOException
+   * @return A region on which you must call {@link HRegion#closeHRegion(HRegion)} when done.
+   */
   public static HRegion initHRegion (byte [] tableName, String callingMethod,
       Configuration conf, byte [] ... families)
     throws IOException{
@@ -4103,7 +4121,7 @@ public class TestHRegion extends HBaseTe
       String callingMethod, Configuration conf, boolean isReadOnly, Durability durability,
       HLog hlog, byte[]... families)
       throws IOException {
-    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
     htd.setReadOnly(isReadOnly);
     for(byte [] family : families) {
       HColumnDescriptor hcd = new HColumnDescriptor(family);
@@ -4112,7 +4130,7 @@ public class TestHRegion extends HBaseTe
       htd.addFamily(hcd);
     }
     htd.setDurability(durability);
-    HRegionInfo info = new HRegionInfo(htd.getName(), startKey, stopKey, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), startKey, stopKey, false);
     Path path = new Path(DIR + callingMethod);
     FileSystem fs = FileSystem.get(conf);
     if (fs.exists(path)) {

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionFileSystem.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionFileSystem.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionFileSystem.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionFileSystem.java Thu Aug  8 04:19:49 2013
@@ -27,8 +27,6 @@ import java.io.IOException;
 import java.net.URI;
 import java.util.Collection;
 
-import javax.management.RuntimeErrorException;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -38,17 +36,15 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.SmallTests;
-import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.util.Progressable;
 
 import org.junit.Test;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.experimental.categories.Category;
-import junit.framework.TestCase;
 
 @Category(SmallTests.class)
 public class TestHRegionFileSystem {
@@ -62,8 +58,9 @@ public class TestHRegionFileSystem {
     Configuration conf = TEST_UTIL.getConfiguration();
 
     // Create a Region
-    HRegionInfo hri = new HRegionInfo(Bytes.toBytes("TestTable"));
-    HRegionFileSystem regionFs = HRegionFileSystem.createRegionOnFileSystem(conf, fs, rootDir, hri);
+    HRegionInfo hri = new HRegionInfo(TableName.valueOf("TestTable"));
+    HRegionFileSystem regionFs = HRegionFileSystem.createRegionOnFileSystem(conf, fs,
+        FSUtils.getTableDir(rootDir, hri.getTableName()), hri);
 
     // Verify if the region is on disk
     Path regionDir = regionFs.getRegionDir();
@@ -74,11 +71,13 @@ public class TestHRegionFileSystem {
     assertEquals(hri, hriVerify);
 
     // Open the region
-    regionFs = HRegionFileSystem.openRegionFromFileSystem(conf, fs, rootDir, hri, false);
+    regionFs = HRegionFileSystem.openRegionFromFileSystem(conf, fs,
+        FSUtils.getTableDir(rootDir, hri.getTableName()), hri, false);
     assertEquals(regionDir, regionFs.getRegionDir());
 
     // Delete the region
-    HRegionFileSystem.deleteRegionFromFileSystem(conf, fs, rootDir, hri);
+    HRegionFileSystem.deleteRegionFromFileSystem(conf, fs,
+        FSUtils.getTableDir(rootDir, hri.getTableName()), hri);
     assertFalse("The region folder should be removed", fs.exists(regionDir));
 
     fs.delete(rootDir, true);
@@ -91,7 +90,7 @@ public class TestHRegionFileSystem {
     Configuration conf = TEST_UTIL.getConfiguration();
 
     // Create a Region
-    HRegionInfo hri = new HRegionInfo(Bytes.toBytes("TestTable"));
+    HRegionInfo hri = new HRegionInfo(TableName.valueOf("TestTable"));
     HRegionFileSystem regionFs = HRegionFileSystem.createRegionOnFileSystem(conf, fs, rootDir, hri);
     assertTrue(fs.exists(regionFs.getRegionDir()));
 
@@ -216,7 +215,7 @@ public class TestHRegionFileSystem {
 
     // Create a Region
     String familyName = "cf";
-    HRegionInfo hri = new HRegionInfo(Bytes.toBytes("TestTable"));
+    HRegionInfo hri = new HRegionInfo(TableName.valueOf("TestTable"));
     HRegionFileSystem regionFs = HRegionFileSystem.createRegionOnFileSystem(conf, fs, rootDir, hri);
 
     // New region, no store files

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java Thu Aug  8 04:19:49 2013
@@ -27,8 +27,8 @@ import static org.junit.Assert.fail;
 import java.io.IOException;
 
 import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.exceptions.DeserializationException;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -82,9 +82,9 @@ public class TestHRegionInfo {
   @Test
   public void testCreateHRegionInfoName() throws Exception {
     String tableName = "tablename";
-    final byte [] tn = Bytes.toBytes(tableName);
+    final TableName tn = TableName.valueOf(tableName);
     String startKey = "startkey";
-    final byte [] sk = Bytes.toBytes(startKey);
+    final byte[] sk = Bytes.toBytes(startKey);
     String id = "id";
 
     // old format region name
@@ -105,9 +105,9 @@ public class TestHRegionInfo {
   
   @Test
   public void testContainsRange() {
-    HTableDescriptor tableDesc = new HTableDescriptor("testtable");
+    HTableDescriptor tableDesc = new HTableDescriptor(TableName.valueOf("testtable"));
     HRegionInfo hri = new HRegionInfo(
-        tableDesc.getName(), Bytes.toBytes("a"), Bytes.toBytes("g"));
+        tableDesc.getTableName(), Bytes.toBytes("a"), Bytes.toBytes("g"));
     // Single row range at start of region
     assertTrue(hri.containsRange(Bytes.toBytes("a"), Bytes.toBytes("a")));
     // Fully contained range
@@ -133,11 +133,11 @@ public class TestHRegionInfo {
 
   @Test
   public void testLastRegionCompare() {
-    HTableDescriptor tableDesc = new HTableDescriptor("testtable");
+    HTableDescriptor tableDesc = new HTableDescriptor(TableName.valueOf("testtable"));
     HRegionInfo hrip = new HRegionInfo(
-        tableDesc.getName(), Bytes.toBytes("a"), new byte[0]);
+        tableDesc.getTableName(), Bytes.toBytes("a"), new byte[0]);
     HRegionInfo hric = new HRegionInfo(
-        tableDesc.getName(), Bytes.toBytes("a"), Bytes.toBytes("b"));
+        tableDesc.getTableName(), Bytes.toBytes("a"), Bytes.toBytes("b"));
     assertTrue(hrip.compareTo(hric) > 0);
   }
 
@@ -148,7 +148,7 @@ public class TestHRegionInfo {
 
   @Test
   public void testComparator() {
-    byte[] tablename = Bytes.toBytes("comparatorTablename");
+    TableName tablename = TableName.valueOf("comparatorTablename");
     byte[] empty = new byte[0];
     HRegionInfo older = new HRegionInfo(tablename, empty, empty, false, 0L); 
     HRegionInfo newer = new HRegionInfo(tablename, empty, empty, false, 1L); 

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java Thu Aug  8 04:19:49 2013
@@ -28,6 +28,7 @@ import org.apache.hadoop.hbase.HColumnDe
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
@@ -64,7 +65,7 @@ public class TestHRegionOnCluster {
       HMaster master = cluster.getMaster();
 
       // Create table
-      HTableDescriptor desc = new HTableDescriptor(TABLENAME);
+      HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(TABLENAME));
       desc.addFamily(new HColumnDescriptor(FAMILY));
       HBaseAdmin hbaseAdmin = TEST_UTIL.getHBaseAdmin();
       hbaseAdmin.createTable(desc);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java Thu Aug  8 04:19:49 2013
@@ -144,7 +144,7 @@ public class TestHRegionServerBulkLoad {
 
       // bulk load HFiles
       final HConnection conn = UTIL.getHBaseAdmin().getConnection();
-      byte[] tbl = Bytes.toBytes(tableName);
+      TableName tbl = TableName.valueOf(tableName);
       RegionServerCallable<Void> callable =
           new RegionServerCallable<Void>(conn, tbl, Bytes.toBytes("aaa")) {
         @Override
@@ -251,7 +251,7 @@ public class TestHRegionServerBulkLoad {
   private void setupTable(String table, int cfs) throws IOException {
     try {
       LOG.info("Creating table " + table);
-      HTableDescriptor htd = new HTableDescriptor(table);
+      HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(table));
       for (int i = 0; i < 10; i++) {
         htd.addFamily(new HColumnDescriptor(family(i)));
       }

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestJoinedScanners.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestJoinedScanners.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestJoinedScanners.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestJoinedScanners.java Thu Aug  8 04:19:49 2013
@@ -40,6 +40,7 @@ import org.apache.hadoop.hbase.HRegionIn
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.LargeTests;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
@@ -92,7 +93,7 @@ public class TestJoinedScanners {
       byte [][] families = {cf_essential, cf_joined};
 
       byte[] tableName = Bytes.toBytes(this.getClass().getSimpleName());
-      HTableDescriptor desc = new HTableDescriptor(tableName);
+      HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName));
       for(byte[] family : families) {
         HColumnDescriptor hcd = new HColumnDescriptor(family);
         hcd.setDataBlockEncoding(blockEncoding);
@@ -177,13 +178,13 @@ public class TestJoinedScanners {
   private static HRegion initHRegion(byte[] tableName, byte[] startKey, byte[] stopKey,
       String callingMethod, Configuration conf, byte[]... families)
       throws IOException {
-    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
     for(byte [] family : families) {
       HColumnDescriptor hcd = new HColumnDescriptor(family);
       hcd.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF);
       htd.addFamily(hcd);
     }
-    HRegionInfo info = new HRegionInfo(htd.getName(), startKey, stopKey, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), startKey, stopKey, false);
     Path path = new Path(DIR + callingMethod);
     FileSystem fs = FileSystem.get(conf);
     if (fs.exists(path)) {

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java Thu Aug  8 04:19:49 2013
@@ -35,7 +35,6 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.regionserver.ScanInfo;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.EnvironmentEdge;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
@@ -500,7 +499,7 @@ public class TestMemStore extends TestCa
     for (int k = start; k <= end; k++) {
       byte [] kk = Bytes.toBytes(k);
       byte [] row =
-        Bytes.toBytes(".META.,table," + Bytes.toString(kk) + ",1," + k);
+        Bytes.toBytes(TableName.META_TABLE_NAME+",table," + Bytes.toString(kk) + ",1," + k);
       KeyValue key = new KeyValue(row, CONTENTS, BASIC,
         System.currentTimeMillis(),
         Bytes.toBytes(CONTENTSTR + k));
@@ -517,7 +516,7 @@ public class TestMemStore extends TestCa
       System.out.println(kv);
       byte [] b = kv.getRow();
       // Hardcoded offsets into String
-      String str = Bytes.toString(b, 13, 4);
+      String str = Bytes.toString(b, TableName.META_TABLE_NAME.getName().length+7, 4);
       byte [] bb = Bytes.toBytes(index);
       String bbStr = Bytes.toString(bb);
       assertEquals(str, bbStr);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestParallelPut.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestParallelPut.java?rev=1511577&r1=1511576&r2=1511577&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestParallelPut.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestParallelPut.java Thu Aug  8 04:19:49 2013
@@ -19,50 +19,20 @@ package org.apache.hadoop.hbase.regionse
 
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
 import java.util.Random;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.*;
-import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HConstants.OperationStatusCode;
-import org.apache.hadoop.hbase.MultithreadedTestUtil.TestThread;
-import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.filter.BinaryComparator;
-import org.apache.hadoop.hbase.filter.ColumnCountGetFilter;
-import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
-import org.apache.hadoop.hbase.filter.Filter;
-import org.apache.hadoop.hbase.filter.FilterList;
-import org.apache.hadoop.hbase.filter.NullComparator;
-import org.apache.hadoop.hbase.filter.PrefixFilter;
-import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
-import org.apache.hadoop.hbase.regionserver.HRegion.RegionScannerImpl;
-import org.apache.hadoop.hbase.regionserver.wal.HLog;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper;
-import org.apache.hadoop.hbase.util.IncrementingEnvironmentEdge;
-import org.apache.hadoop.hbase.util.ManualEnvironmentEdge;
-import org.apache.hadoop.hbase.util.Pair;
-import org.apache.hadoop.hbase.util.PairOfSameType;
-import org.apache.hadoop.hbase.util.Threads;
-import org.junit.Test;
 
-import com.google.common.collect.Lists;
 import org.junit.experimental.categories.Category;
 
 
@@ -184,11 +154,11 @@ public class TestParallelPut extends HBa
   private void initHRegion(byte [] tableName, String callingMethod,
     Configuration conf, byte [] ... families)
   throws IOException{
-    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
     for(byte [] family : families) {
       htd.addFamily(new HColumnDescriptor(family));
     }
-    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
     Path path = new Path(DIR + callingMethod);
     if (fs.exists(path)) {
       if (!fs.delete(path, true)) {



Mime
View raw message