hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1135385 [3/4] - in /hbase/trunk: ./ src/main/java/org/apache/hadoop/hbase/ src/main/java/org/apache/hadoop/hbase/catalog/ src/main/java/org/apache/hadoop/hbase/client/ src/main/java/org/apache/hadoop/hbase/io/ src/main/java/org/apache/hado...
Date Tue, 14 Jun 2011 05:40:35 GMT
Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestSerialization.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestSerialization.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestSerialization.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestSerialization.java Tue Jun 14 05:40:32 2011
@@ -103,8 +103,8 @@ public class TestSerialization {
     HRegionInfo deserializedHri =
       (HRegionInfo)Writables.getWritable(hrib, new HRegionInfo());
     assertEquals(hri.getEncodedName(), deserializedHri.getEncodedName());
-    assertEquals(hri.getTableDesc().getFamilies().size(),
-      deserializedHri.getTableDesc().getFamilies().size());
+    //assertEquals(hri.getTableDesc().getFamilies().size(),
+    //  deserializedHri.getTableDesc().getFamilies().size());
   }
 
   @Test public void testRegionInfos() throws Exception {
@@ -126,7 +126,7 @@ public class TestSerialization {
     for (int i = 0; i < families.length; i++) {
       htd.addFamily(new HColumnDescriptor(families[i]));
     }
-    return new HRegionInfo(htd, HConstants.EMPTY_START_ROW,
+    return new HRegionInfo(htd.getName(), HConstants.EMPTY_START_ROW,
       HConstants.EMPTY_END_ROW);
   }
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java Tue Jun 14 05:40:32 2011
@@ -36,7 +36,7 @@ public class TimestampTestBase extends H
   private static final long T1 = 100L;
   private static final long T2 = 200L;
 
-  private static final byte [] FAMILY_NAME = Bytes.toBytes("colfamily1");
+  private static final byte [] FAMILY_NAME = Bytes.toBytes("colfamily11");
   private static final byte [] QUALIFIER_NAME = Bytes.toBytes("contents");
 
   private static final byte [] ROW = Bytes.toBytes("row");
@@ -272,4 +272,4 @@ public class TimestampTestBase extends H
   public static Result get(final Incommon loader) throws IOException {
     return loader.get(new Get(ROW));
   }
-}
\ No newline at end of file
+}

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java Tue Jun 14 05:40:32 2011
@@ -181,7 +181,7 @@ public class TestFromClientSide {
      for (Map.Entry<HRegionInfo, HServerAddress> e: loadedRegions.entrySet()) {
        HRegionInfo hri = e.getKey();
        assertTrue(HConnectionManager.isRegionCached(conf,
-           hri.getTableDesc().getName(), hri.getStartKey()));
+           hri.getTableName(), hri.getStartKey()));
      }
 
      // delete the temp file

Added: hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMetaMigration.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMetaMigration.java?rev=1135385&view=auto
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMetaMigration.java (added)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMetaMigration.java Tue Jun 14 05:40:32 2011
@@ -0,0 +1,155 @@
+/**
+ * Copyright 2010 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.client;
+
+import junit.framework.AssertionFailedError;
+import org.apache.hadoop.hbase.catalog.CatalogTracker;
+import org.apache.hadoop.hbase.migration.HRegionInfo090x;
+
+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.hbase.catalog.MetaEditor;
+import org.apache.hadoop.hbase.catalog.MetaReader;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.apache.hadoop.hbase.util.Writables;
+
+import java.util.List;
+
+public class TestMetaMigration {
+  final Log LOG = LogFactory.getLog(getClass());
+  private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+  private static MiniHBaseCluster miniHBaseCluster = null;
+
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
+    miniHBaseCluster = TEST_UTIL.startMiniCluster(1);
+  }
+
+  /**
+   * @throws java.lang.Exception
+   */
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+    TEST_UTIL.shutdownMiniCluster();
+  }
+
+  @Test
+  public void testHRegionInfoForMigration() throws Exception {
+    LOG.info("Starting testHRegionInfoForMigration");
+    HTableDescriptor htd = new HTableDescriptor("testMetaMigration");
+    htd.addFamily(new HColumnDescriptor("family"));
+    HRegionInfo090x hrim = new HRegionInfo090x(htd, HConstants.EMPTY_START_ROW,
+        HConstants.EMPTY_END_ROW);
+    LOG.info("INFO 1 = " + hrim);
+    byte[] bytes = Writables.getBytes(hrim);
+    LOG.info(" BYtes.toString = " + Bytes.toString(bytes));
+    LOG.info(" HTD bytes = " + Bytes.toString(Writables.getBytes(hrim.getTableDesc())));
+    HRegionInfo090x info = Writables.getHRegionInfoForMigration(bytes);
+    LOG.info("info = " + info);
+    LOG.info("END testHRegionInfoForMigration");
+
+  }
+
+  @Test
+  public void testMetaUpdatedFlagInROOT() throws Exception {
+    LOG.info("Starting testMetaUpdatedFlagInROOT");
+    boolean metaUpdated = miniHBaseCluster.getMaster().isMetaHRIUpdated();
+    assertEquals(true, metaUpdated);
+    LOG.info("END testMetaUpdatedFlagInROOT");
+  }
+
+  @Test
+  public void testUpdatesOnMetaWithLegacyHRI() throws Exception {
+    LOG.info("Starting testMetaWithLegacyHRI");
+    final byte[] FAMILY = Bytes.toBytes("family");
+    HTableDescriptor htd = new HTableDescriptor("testMetaMigration");
+    HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
+      htd.addFamily(hcd);
+    Configuration conf = TEST_UTIL.getConfiguration();
+    TEST_UTIL.createMultiRegionsWithLegacyHRI(conf, htd, FAMILY,
+        new byte[][]{
+            HConstants.EMPTY_START_ROW,
+            Bytes.toBytes("region_a"),
+            Bytes.toBytes("region_b")});
+    CatalogTracker ct = miniHBaseCluster.getMaster().getCatalogTracker();
+    // just for this test set it to false.
+    MetaEditor.updateRootWithMetaMigrationStatus(ct, false);
+    MetaReader.fullScanMetaAndPrint(ct);
+    LOG.info("MEta Print completed.testUpdatesOnMetaWithLegacyHRI");
+
+    List<HTableDescriptor> htds = MetaEditor.updateMetaWithNewRegionInfo(
+          TEST_UTIL.getHBaseCluster().getMaster());
+    assertEquals(3, htds.size());
+    // Assert that the flag in ROOT is updated to reflect the correct status
+    boolean metaUpdated = miniHBaseCluster.getMaster().isMetaHRIUpdated();
+    assertEquals(true, metaUpdated);
+    LOG.info("END testMetaWithLegacyHRI");
+
+  }
+
+  //@Test
+  public void dtestUpdatesOnMetaWithNewHRI() throws Exception {
+    LOG.info("Starting testMetaWithLegacyHRI");
+    final byte[] FAMILY = Bytes.toBytes("family");
+    HTableDescriptor htd = new HTableDescriptor("testMetaMigration");
+    HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
+      htd.addFamily(hcd);
+    Configuration conf = TEST_UTIL.getConfiguration();
+    TEST_UTIL.createMultiRegionsWithNewHRI(conf, htd, FAMILY,
+        new byte[][]{
+            HConstants.EMPTY_START_ROW,
+            Bytes.toBytes("region_a"),
+            Bytes.toBytes("region_b")});
+    List<HTableDescriptor> htds = MetaEditor.updateMetaWithNewRegionInfo(
+          TEST_UTIL.getHBaseCluster().getMaster());
+    assertEquals(3, htds.size());
+  }
+
+
+
+
+  public static void assertEquals(int expected,
+                               int actual) {
+    if (expected != actual) {
+      throw new AssertionFailedError("expected:<" +
+      expected + "> but was:<" +
+      actual + ">");
+    }
+  }
+
+  public static void assertEquals(boolean expected,
+                               boolean actual) {
+    if (expected != actual) {
+      throw new AssertionFailedError("expected:<" +
+      expected + "> but was:<" +
+      actual + ">");
+    }
+  }
+
+
+
+}

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java Tue Jun 14 05:40:32 2011
@@ -118,6 +118,7 @@ public class TestMultipleTimestamps {
 
   @Test
   public void testReseeksWithMultipleColumnOneTimestamp() throws IOException {
+    LOG.info("testReseeksWithMultipleColumnOneTimestamp");
     byte [] TABLE = Bytes.toBytes("testReseeksWithMultiple" +
     "ColumnOneTimestamps");
     byte [] FAMILY = Bytes.toBytes("event_log");
@@ -155,6 +156,8 @@ public class TestMultipleTimestamps {
   @Test
   public void testReseeksWithMultipleColumnMultipleTimestamp() throws
   IOException {
+    LOG.info("testReseeksWithMultipleColumnMultipleTimestamp");
+
     byte [] TABLE = Bytes.toBytes("testReseeksWithMultiple" +
     "ColumnMiltipleTimestamps");
     byte [] FAMILY = Bytes.toBytes("event_log");
@@ -197,6 +200,7 @@ public class TestMultipleTimestamps {
 
   @Test
   public void testReseeksWithMultipleFiles() throws IOException {
+    LOG.info("testReseeksWithMultipleFiles");
     byte [] TABLE = Bytes.toBytes("testReseeksWithMultipleFiles");
     byte [] FAMILY = Bytes.toBytes("event_log");
     byte [][] FAMILIES = new byte[][] { FAMILY };
@@ -262,8 +266,12 @@ public class TestMultipleTimestamps {
   }
 
   public void testWithVersionDeletes(boolean flushTables) throws IOException {
+    LOG.info("testWithVersionDeletes_"+
+        (flushTables ? "flush" : "noflush"));
+
     byte [] TABLE = Bytes.toBytes("testWithVersionDeletes_" +
         (flushTables ? "flush" : "noflush"));
+
     byte [] FAMILY = Bytes.toBytes("event_log");
     byte [][] FAMILIES = new byte[][] { FAMILY };
 
@@ -292,6 +300,8 @@ public class TestMultipleTimestamps {
 
   @Test
   public void testWithMultipleVersionDeletes() throws IOException {
+    LOG.info("testWithMultipleVersionDeletes");
+
     byte [] TABLE = Bytes.toBytes("testWithMultipleVersionDeletes");
     byte [] FAMILY = Bytes.toBytes("event_log");
     byte [][] FAMILIES = new byte[][] { FAMILY };

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestScannerTimeout.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestScannerTimeout.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestScannerTimeout.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestScannerTimeout.java Tue Jun 14 05:40:32 2011
@@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.catalog.MetaReader;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.AfterClass;
@@ -89,6 +90,7 @@ public class TestScannerTimeout {
    */
   @Test
   public void test2481() throws Exception {
+    LOG.info("START ************ test2481");
     Scan scan = new Scan();
     HTable table =
       new HTable(new Configuration(TEST_UTIL.getConfiguration()), TABLE_NAME);
@@ -109,6 +111,7 @@ public class TestScannerTimeout {
       return;
     }
     fail("We should be timing out");
+    LOG.info("END ************ test2481");
   }
 
   /**
@@ -118,6 +121,7 @@ public class TestScannerTimeout {
    */
   @Test
   public void test2772() throws Exception {
+    LOG.info("START************ test2772");
     HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLE_NAME);
     Scan scan = new Scan();
     // Set a very high timeout, we want to test what happens when a RS
@@ -134,6 +138,8 @@ public class TestScannerTimeout {
     Result[] results = r.next(NB_ROWS);
     assertEquals(NB_ROWS, results.length);
     r.close();
+    LOG.info("END ************ test2772");
+
   }
   
   /**
@@ -143,14 +149,24 @@ public class TestScannerTimeout {
    */
   @Test
   public void test3686a() throws Exception {
+    LOG.info("START ************ TEST3686A---1");
     HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLE_NAME);
+    LOG.info("START ************ TEST3686A---1111");
+
     Scan scan = new Scan();
     scan.setCaching(SCANNER_CACHING);
-    
+    LOG.info("************ TEST3686A");
+    MetaReader.fullScanMetaAndPrint(TEST_UTIL.getHBaseCluster().getMaster().getCatalogTracker());
     HTable table = new HTable(TABLE_NAME);
+    LOG.info("START ************ TEST3686A---22");
+
     ResultScanner r = table.getScanner(scan);
+    LOG.info("START ************ TEST3686A---33");
+
     int count = 1;
     r.next();
+    LOG.info("START ************ TEST3686A---44");
+
     // Kill after one call to next(), which got 5 rows.
     rs.abort("die!");
     while(r.next() != null) {
@@ -158,6 +174,7 @@ public class TestScannerTimeout {
     }
     assertEquals(NB_ROWS, count);
     r.close();
+    LOG.info("************ END TEST3686A");
   }
   
   /**
@@ -168,6 +185,7 @@ public class TestScannerTimeout {
    */
   @Test
   public void test3686b() throws Exception {
+    LOG.info("START ************ test3686b");
     HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLE_NAME);
     Scan scan = new Scan();
     scan.setCaching(SCANNER_CACHING);
@@ -189,5 +207,7 @@ public class TestScannerTimeout {
     }
     assertEquals(NB_ROWS, count);
     r.close();
+    LOG.info("END ************ END test3686b");
+
   }
 }
\ No newline at end of file

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestTimestamp.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestTimestamp.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestTimestamp.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestTimestamp.java Tue Jun 14 05:40:32 2011
@@ -31,7 +31,7 @@ import org.apache.hadoop.hbase.Timestamp
  * run against an HRegion and against an HTable: i.e. both local and remote.
  */
 public class TestTimestamp extends HBaseClusterTestCase {
-  public static String COLUMN_NAME = "colfamily1";
+  public static String COLUMN_NAME = "colfamily11";
 
   /** constructor */
   public TestTimestamp() {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java Tue Jun 14 05:40:32 2011
@@ -180,7 +180,8 @@ public class TestCoprocessorInterface ex
 
   HRegion reopenRegion(final HRegion closedRegion, Class<?> implClass)
       throws IOException {
-    HRegion r = new HRegion(closedRegion.getRegionDir(), closedRegion.getLog(),
+    //HRegionInfo info = new HRegionInfo(tableName, null, null, false);
+    HRegion r = new HRegion(closedRegion.getTableDir(), closedRegion.getLog(),
         closedRegion.getFilesystem(), closedRegion.getConf(),
         closedRegion.getRegionInfo(), null);
     r.initialize();
@@ -211,9 +212,9 @@ public class TestCoprocessorInterface ex
     for(byte [] family : families) {
       htd.addFamily(new HColumnDescriptor(family));
     }
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(tableName, null, null, false);
     Path path = new Path(DIR + callingMethod);
-    HRegion r = HRegion.createHRegion(info, path, conf);
+    HRegion r = HRegion.createHRegion(info, path, conf, htd);
 
     // this following piece is a hack.
     RegionCoprocessorHost host = new RegionCoprocessorHost(r, null, conf);

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java Tue Jun 14 05:40:32 2011
@@ -256,7 +256,7 @@ public class TestRegionObserverInterface
     try {
       for (JVMClusterUtil.RegionServerThread t : cluster.getRegionServerThreads()) {
         for (HRegionInfo r : t.getRegionServer().getOnlineRegions()) {
-          if (!Arrays.equals(r.getTableDesc().getName(), tableName)) {
+          if (!Arrays.equals(r.getTableName(), tableName)) {
             continue;
           }
           RegionCoprocessorHost cph = t.getRegionServer().getOnlineRegion(r.getRegionName()).

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java Tue Jun 14 05:40:32 2011
@@ -91,9 +91,9 @@ public class TestRegionObserverStacking 
     for(byte [] family : families) {
       htd.addFamily(new HColumnDescriptor(family));
     }
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
     Path path = new Path(DIR + callingMethod);
-    HRegion r = HRegion.createHRegion(info, path, conf);
+    HRegion r = HRegion.createHRegion(info, path, conf, htd);
     // this following piece is a hack. currently a coprocessorHost
     // is secretly loaded at OpenRegionHandler. we don't really
     // start a region server here, so just manually create cphost

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java Tue Jun 14 05:40:32 2011
@@ -138,7 +138,12 @@ public class TestWALObserver {
    */
   @Test
   public void testWALObserverWriteToWAL() throws Exception {
+
     HRegionInfo hri = createBasic3FamilyHRegionInfo(Bytes.toString(TEST_TABLE));
+    final HTableDescriptor htd = createBasic3FamilyHTD(Bytes.toString(TEST_TABLE));
+    HRegion region2 = HRegion.createHRegion(hri,
+            hbaseRootDir, this.conf, htd);
+
     Path basedir = new Path(this.hbaseRootDir, Bytes.toString(TEST_TABLE));
     deleteDir(basedir);
     fs.mkdirs(new Path(basedir, hri.getEncodedName()));
@@ -190,7 +195,7 @@ public class TestWALObserver {
 
     // it's where WAL write cp should occur.
     long now = EnvironmentEdgeManager.currentTimeMillis();
-    log.append(hri, hri.getTableDesc().getName(), edit, now);
+    log.append(hri, hri.getTableName(), edit, now, htd);
 
     // the edit shall have been change now by the coprocessor.
     foundFamily0 = false;
@@ -221,16 +226,25 @@ public class TestWALObserver {
    * Test WAL replay behavior with WALObserver.
    */
   @Test
-  public void testWALObserverReplay() throws Exception {
+  public void testWALCoprocessorReplay() throws Exception {
     // WAL replay is handled at HRegion::replayRecoveredEdits(), which is
     // ultimately called by HRegion::initialize()
     byte[] tableName = Bytes.toBytes("testWALCoprocessorReplay");
+    final HTableDescriptor htd = getBasic3FamilyHTableDescriptor(Bytes.toString(tableName));
+    //final HRegionInfo hri = createBasic3FamilyHRegionInfo(Bytes.toString(tableName));
+    //final HRegionInfo hri1 = createBasic3FamilyHRegionInfo(Bytes.toString(tableName));
+    final HRegionInfo hri = new HRegionInfo(tableName, null, null);
 
-    final HRegionInfo hri = createBasic3FamilyHRegionInfo(Bytes.toString(tableName));
     final Path basedir = new Path(this.hbaseRootDir, Bytes.toString(tableName));
     deleteDir(basedir);
     fs.mkdirs(new Path(basedir, hri.getEncodedName()));
 
+    final Configuration newConf = HBaseConfiguration.create(this.conf);
+
+    HRegion region2 = HRegion.createHRegion(hri,
+        hbaseRootDir, newConf,htd);
+
+
     //HLog wal = new HLog(this.fs, this.dir, this.oldLogDir, this.conf);
     HLog wal = createWAL(this.conf);
     //Put p = creatPutWith2Families(TEST_ROW);
@@ -238,40 +252,46 @@ public class TestWALObserver {
     long now = EnvironmentEdgeManager.currentTimeMillis();
     //addFamilyMapToWALEdit(p.getFamilyMap(), edit);
     final int countPerFamily = 1000;
-    for (HColumnDescriptor hcd: hri.getTableDesc().getFamilies()) {
+    //for (HColumnDescriptor hcd: hri.getTableDesc().getFamilies()) {
+    for (HColumnDescriptor hcd: htd.getFamilies()) {
+          //addWALEdits(tableName, hri, TEST_ROW, hcd.getName(), countPerFamily,
+          //EnvironmentEdgeManager.getDelegate(), wal);
       addWALEdits(tableName, hri, TEST_ROW, hcd.getName(), countPerFamily,
-          EnvironmentEdgeManager.getDelegate(), wal);
+      EnvironmentEdgeManager.getDelegate(), wal, htd);
     }
-    wal.append(hri, tableName, edit, now);
+    wal.append(hri, tableName, edit, now, htd);
     // sync to fs.
     wal.sync();
 
-    final Configuration newConf = HBaseConfiguration.create(this.conf);
     User user = HBaseTestingUtility.getDifferentUser(newConf,
         ".replay.wal.secondtime");
     user.runAs(new PrivilegedExceptionAction() {
       public Object run() throws Exception {
-        runWALSplit(newConf);
+        Path p = runWALSplit(newConf);
+        LOG.info("WALSplit path == " + p);
         FileSystem newFS = FileSystem.get(newConf);
         // Make a new wal for new region open.
         HLog wal2 = createWAL(newConf);
-        HRegion region2 = new HRegion(basedir, wal2, FileSystem.get(newConf),
+        Path tableDir =
+        HTableDescriptor.getTableDir(hbaseRootDir, hri.getTableName());
+        HRegion region = new HRegion(tableDir, wal2, FileSystem.get(newConf),
           newConf, hri, TEST_UTIL.getHBaseCluster().getRegionServer(0));
-        long seqid2 = region2.initialize();
 
+        long seqid2 = region.initialize();
         SampleRegionWALObserver cp2 =
-          (SampleRegionWALObserver)region2.getCoprocessorHost().findCoprocessor(
+          (SampleRegionWALObserver)region.getCoprocessorHost().findCoprocessor(
               SampleRegionWALObserver.class.getName());
         // TODO: asserting here is problematic.
         assertNotNull(cp2);
         assertTrue(cp2.isPreWALRestoreCalled());
         assertTrue(cp2.isPostWALRestoreCalled());
-        region2.close();
+        region.close();
         wal2.closeAndDelete();
         return null;
       }
     });
   }
+
   /**
    * Test to see CP loaded successfully or not. There is a duplication
    * at TestHLog, but the purpose of that one is to see whether the loaded
@@ -301,7 +321,7 @@ public class TestWALObserver {
       HColumnDescriptor a = new HColumnDescriptor(TEST_FAMILY[i]);
       htd.addFamily(a);
     }
-    return new HRegionInfo(htd, null, null, false);
+    return new HRegionInfo(htd.getName(), null, null, false);
   }
 
   /*
@@ -356,7 +376,7 @@ public class TestWALObserver {
   }
   private void addWALEdits (final byte [] tableName, final HRegionInfo hri,
       final byte [] rowName, final byte [] family,
-      final int count, EnvironmentEdge ee, final HLog wal)
+      final int count, EnvironmentEdge ee, final HLog wal, final HTableDescriptor htd)
   throws IOException {
     String familyStr = Bytes.toString(family);
     for (int j = 0; j < count; j++) {
@@ -365,8 +385,30 @@ public class TestWALObserver {
       WALEdit edit = new WALEdit();
       edit.add(new KeyValue(rowName, family, qualifierBytes,
         ee.currentTimeMillis(), columnBytes));
-      wal.append(hri, tableName, edit, ee.currentTimeMillis());
+      wal.append(hri, tableName, edit, ee.currentTimeMillis(), htd);
     }
   }
+  private HTableDescriptor getBasic3FamilyHTableDescriptor(
+      final String tableName) {
+    HTableDescriptor htd = new HTableDescriptor(tableName);
+
+    for (int i = 0; i < TEST_FAMILY.length; i++ ) {
+      HColumnDescriptor a = new HColumnDescriptor(TEST_FAMILY[i]);
+      htd.addFamily(a);
+    }
+    return htd;
+  }
+
+  private HTableDescriptor createBasic3FamilyHTD(final String tableName) {
+    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HColumnDescriptor a = new HColumnDescriptor(Bytes.toBytes("a"));
+    htd.addFamily(a);
+    HColumnDescriptor b = new HColumnDescriptor(Bytes.toBytes("b"));
+    htd.addFamily(b);
+    HColumnDescriptor c = new HColumnDescriptor(Bytes.toBytes("c"));
+    htd.addFamily(c);
+    return htd;
+  }
+
 }
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java Tue Jun 14 05:40:32 2011
@@ -33,9 +33,9 @@ public class TestColumnPrefixFilter {
     String family = "Family";
     HTableDescriptor htd = new HTableDescriptor("TestColumnPrefixFilter");
     htd.addFamily(new HColumnDescriptor(family));
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
     HRegion region = HRegion.createHRegion(info, HBaseTestingUtility.
-        getTestDir(), TEST_UTIL.getConfiguration());
+        getTestDir(), TEST_UTIL.getConfiguration(), htd);
 
     List<String> rows = generateRandomWords(100, "row");
     List<String> columns = generateRandomWords(10000, "column");
@@ -89,9 +89,9 @@ public class TestColumnPrefixFilter {
     String family = "Family";
     HTableDescriptor htd = new HTableDescriptor("TestColumnPrefixFilter");
     htd.addFamily(new HColumnDescriptor(family));
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
     HRegion region = HRegion.createHRegion(info, HBaseTestingUtility.
-        getTestDir(), TEST_UTIL.getConfiguration());
+        getTestDir(), TEST_UTIL.getConfiguration(), htd);
 
     List<String> rows = generateRandomWords(100, "row");
     List<String> columns = generateRandomWords(10000, "column");

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestDependentColumnFilter.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestDependentColumnFilter.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestDependentColumnFilter.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestDependentColumnFilter.java Tue Jun 14 05:40:32 2011
@@ -75,8 +75,9 @@ public class TestDependentColumnFilter e
     HTableDescriptor htd = new HTableDescriptor(getName());
     htd.addFamily(new HColumnDescriptor(FAMILIES[0]));
     htd.addFamily(new HColumnDescriptor(FAMILIES[1]));
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
-    this.region = HRegion.createHRegion(info, testUtil.getTestDir(), testUtil.getConfiguration());
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    this.region = HRegion.createHRegion(info, testUtil.getTestDir(),
+        testUtil.getConfiguration(), htd);
     addData();
   }
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestFilter.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestFilter.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestFilter.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/filter/TestFilter.java Tue Jun 14 05:40:32 2011
@@ -92,8 +92,8 @@ public class TestFilter extends HBaseTes
     HTableDescriptor htd = new HTableDescriptor(getName());
     htd.addFamily(new HColumnDescriptor(FAMILIES[0]));
     htd.addFamily(new HColumnDescriptor(FAMILIES[1]));
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
-    this.region = HRegion.createHRegion(info, this.testDir, this.conf);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+    this.region = HRegion.createHRegion(info, this.testDir, this.conf, htd);
 
     // Insert first half
     for(byte [] ROW : ROWS_ONE) {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java Tue Jun 14 05:40:32 2011
@@ -116,9 +116,14 @@ public class TestCatalogJanitor {
    */
   class MockMasterServices implements MasterServices {
     private final MasterFileSystem mfs;
+    private final AssignmentManager asm;
 
     MockMasterServices(final Server server) throws IOException {
       this.mfs = new MasterFileSystem(server, null);
+      HTableDescriptor htd = new HTableDescriptor("table");
+      htd.addFamily(new HColumnDescriptor("family"));
+      this.asm = Mockito.mock(AssignmentManager.class);
+      Mockito.when(asm.getTableDescriptor("table")).thenReturn(htd);
     }
 
     @Override
@@ -128,7 +133,7 @@ public class TestCatalogJanitor {
 
     @Override
     public AssignmentManager getAssignmentManager() {
-      return null;
+      return this.asm;
     }
 
     @Override
@@ -219,11 +224,14 @@ public class TestCatalogJanitor {
     HTableDescriptor htd = new HTableDescriptor("table");
     htd.addFamily(new HColumnDescriptor("family"));
     HRegionInfo parent =
-      new HRegionInfo(htd, Bytes.toBytes("aaa"), Bytes.toBytes("eee"));
+      new HRegionInfo(htd.getName(), Bytes.toBytes("aaa"),
+          Bytes.toBytes("eee"));
     HRegionInfo splita =
-      new HRegionInfo(htd, Bytes.toBytes("aaa"), Bytes.toBytes("ccc"));
+      new HRegionInfo(htd.getName(), Bytes.toBytes("aaa"),
+          Bytes.toBytes("ccc"));
     HRegionInfo splitb =
-      new HRegionInfo(htd, Bytes.toBytes("ccc"), Bytes.toBytes("eee"));
+      new HRegionInfo(htd.getName(), Bytes.toBytes("ccc"),
+          Bytes.toBytes("eee"));
     // Test that when both daughter regions are in place, that we do not
     // remove the parent.
     List<KeyValue> kvs = new ArrayList<KeyValue>();

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java Tue Jun 14 05:40:32 2011
@@ -301,7 +301,7 @@ public class TestDistributedLogSplitting
     HTable ht = TEST_UTIL.createTable(table, family);
     int numRegions = TEST_UTIL.createMultiRegions(conf, ht, family, nrs);
     assertEquals(nrs, numRegions);
-    LOG.info("Waiting for no more RIT\n");
+      LOG.info("Waiting for no more RIT\n");
     blockUntilNoRIT(zkw, master);
     // disable-enable cycle to get rid of table's dead regions left behind
     // by createMultiRegions
@@ -353,6 +353,7 @@ public class TestDistributedLogSplitting
       int num_edits, int edit_size) throws IOException {
 
     byte[] table = Bytes.toBytes(tname);
+    HTableDescriptor htd = new HTableDescriptor(tname);
     byte[] value = new byte[edit_size];
     for (int i = 0; i < edit_size; i++) {
       value[i] = (byte)('a' + (i % 26));
@@ -369,7 +370,7 @@ public class TestDistributedLogSplitting
           System.currentTimeMillis(), value));
       // LOG.info("Region " + i + ": " + e);
       j++;
-      log.append(hris.get(j % n), table, e, System.currentTimeMillis());
+      log.append(hris.get(j % n), table, e, System.currentTimeMillis(), htd);
       counts[j % n] += 1;
       // if ((i % 8096) == 0) {
         // log.sync();

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLoadBalancer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLoadBalancer.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLoadBalancer.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLoadBalancer.java Tue Jun 14 05:40:32 2011
@@ -486,7 +486,7 @@ public class TestLoadBalancer {
       Bytes.putInt(start, 0, numRegions << 1);
       Bytes.putInt(end, 0, (numRegions << 1) + 1);
       HRegionInfo hri = new HRegionInfo(
-          new HTableDescriptor(Bytes.toBytes("table" + i)), start, end,
+          Bytes.toBytes("table" + i), start, end,
           false, regionId++);
       regions.add(hri);
     }

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java Tue Jun 14 05:40:32 2011
@@ -31,18 +31,14 @@ import java.util.TreeSet;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.Abortable;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.MiniHBaseCluster;
-import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.executor.RegionTransitionData;
 import org.apache.hadoop.hbase.executor.EventHandler.EventType;
 import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
 import org.apache.hadoop.hbase.master.LoadBalancer.RegionPlan;
+import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.JVMClusterUtil;
@@ -262,12 +258,21 @@ public class TestMasterFailover {
     byte [] enabledTable = Bytes.toBytes("enabledTable");
     HTableDescriptor htdEnabled = new HTableDescriptor(enabledTable);
     htdEnabled.addFamily(new HColumnDescriptor(FAMILY));
+
+    FileSystem filesystem = FileSystem.get(conf);
+    Path rootdir = filesystem.makeQualified(
+        new Path(conf.get(HConstants.HBASE_DIR)));
+    HRegionInfo hriEnabled = new HRegionInfo(htdEnabled.getName(), null, null);
+    HRegion.createHRegion(hriEnabled, rootdir, conf, htdEnabled);
+
     List<HRegionInfo> enabledRegions = TEST_UTIL.createMultiRegionsInMeta(
         TEST_UTIL.getConfiguration(), htdEnabled, SPLIT_KEYS);
 
     byte [] disabledTable = Bytes.toBytes("disabledTable");
     HTableDescriptor htdDisabled = new HTableDescriptor(disabledTable);
     htdDisabled.addFamily(new HColumnDescriptor(FAMILY));
+    HRegionInfo hriDisabled = new HRegionInfo(htdDisabled.getName(), null, null);
+    HRegion.createHRegion(hriDisabled, rootdir, conf, htdDisabled);
     List<HRegionInfo> disabledRegions = TEST_UTIL.createMultiRegionsInMeta(
         TEST_UTIL.getConfiguration(), htdDisabled, SPLIT_KEYS);
 
@@ -566,12 +571,23 @@ public class TestMasterFailover {
     byte [] enabledTable = Bytes.toBytes("enabledTable");
     HTableDescriptor htdEnabled = new HTableDescriptor(enabledTable);
     htdEnabled.addFamily(new HColumnDescriptor(FAMILY));
+    FileSystem filesystem = FileSystem.get(conf);
+    Path rootdir = filesystem.makeQualified(
+           new Path(conf.get(HConstants.HBASE_DIR)));
+
+    HRegionInfo hriEnabled = new HRegionInfo(htdEnabled.getName(),
+        null, null);
+    HRegion.createHRegion(hriEnabled, rootdir, conf, htdEnabled);
+
     List<HRegionInfo> enabledRegions = TEST_UTIL.createMultiRegionsInMeta(
         TEST_UTIL.getConfiguration(), htdEnabled, SPLIT_KEYS);
 
     byte [] disabledTable = Bytes.toBytes("disabledTable");
     HTableDescriptor htdDisabled = new HTableDescriptor(disabledTable);
     htdDisabled.addFamily(new HColumnDescriptor(FAMILY));
+    HRegionInfo hriDisabled = new HRegionInfo(htdDisabled.getName(), null, null);
+    HRegion.createHRegion(hriDisabled, rootdir, conf, htdDisabled);
+
     List<HRegionInfo> disabledRegions = TEST_UTIL.createMultiRegionsInMeta(
         TEST_UTIL.getConfiguration(), htdDisabled, SPLIT_KEYS);
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java Tue Jun 14 05:40:32 2011
@@ -25,14 +25,12 @@ import java.util.List;
 import java.util.NavigableMap;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.master.ServerManager;
+import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
 import org.apache.hbase.tmpl.master.MasterStatusTmpl;
@@ -56,11 +54,20 @@ public class TestMasterStatusServlet {
     new ServerName("fakehost", 12345, 1234567890);
   static final HTableDescriptor FAKE_TABLE =
     new HTableDescriptor("mytable");
-  static final HRegionInfo FAKE_REGION =
-    new HRegionInfo(FAKE_TABLE, Bytes.toBytes("a"), Bytes.toBytes("b"));
-  
+  static final HRegionInfo FAKE_HRI =
+      new HRegionInfo(FAKE_TABLE.getName(), Bytes.toBytes("a"), Bytes.toBytes("b"));
+
+ // static final HRegionInfo FAKE_REGION = null;
+
   @Before
   public void setupBasicMocks() {
+    try {
+       HRegion.createHRegion(FAKE_HRI, HBaseTestingUtility.getTestDir(),
+          HBaseConfiguration.create(), FAKE_TABLE);
+    } catch(IOException ioe) {
+
+    }
+
     conf = HBaseConfiguration.create();
     
     master = Mockito.mock(HMaster.class);
@@ -77,7 +84,7 @@ public class TestMasterStatusServlet {
     NavigableMap<String, RegionState> regionsInTransition =
       Maps.newTreeMap();
     regionsInTransition.put("r1",
-        new RegionState(FAKE_REGION, RegionState.State.CLOSING, 12345L, FAKE_HOST));        
+        new RegionState(FAKE_HRI, RegionState.State.CLOSING, 12345L, FAKE_HOST));
     Mockito.doReturn(regionsInTransition).when(am).getRegionsInTransition();
     Mockito.doReturn(am).when(master).getAssignmentManager();
     

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestColumnSeeking.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestColumnSeeking.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestColumnSeeking.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestColumnSeeking.java Tue Jun 14 05:40:32 2011
@@ -68,10 +68,10 @@ public class TestColumnSeeking {
             HColumnDescriptor.DEFAULT_BLOOMFILTER);
     HTableDescriptor htd = new HTableDescriptor(table);
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(Bytes.toBytes(table), null, null, false);
     HRegion region =
         HRegion.createHRegion(info, HBaseTestingUtility.getTestDir(), TEST_UTIL
-            .getConfiguration());
+            .getConfiguration(), htd);
 
     List<String> rows = generateRandomWords(10, "row");
     List<String> allColumns = generateRandomWords(10, "column");
@@ -172,10 +172,11 @@ public class TestColumnSeeking {
 
     HTableDescriptor htd = new HTableDescriptor(table);
     htd.addFamily(new HColumnDescriptor(family));
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+
+    HRegionInfo info = new HRegionInfo(Bytes.toBytes(table), null, null, false);
     HRegion region =
         HRegion.createHRegion(info, HBaseTestingUtility.getTestDir(), TEST_UTIL
-            .getConfiguration());
+            .getConfiguration(), htd);
 
     List<String> rows = generateRandomWords(10, "row");
     List<String> allColumns = generateRandomWords(100, "column");

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactSelection.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactSelection.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactSelection.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactSelection.java Tue Jun 14 05:40:32 2011
@@ -82,9 +82,12 @@ public class TestCompactSelection extend
 
     HTableDescriptor htd = new HTableDescriptor(Bytes.toBytes("table"));
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
+
     HLog hlog = new HLog(fs, logdir, oldLogDir, conf);
-    HRegion region = new HRegion(basedir, hlog, fs, conf, info, null);
+    HRegion.createHRegion(info, basedir, conf, htd);
+    Path tableDir = new Path(basedir, Bytes.toString(htd.getName()));
+    HRegion region = new HRegion(tableDir, hlog, fs, conf, info, null);
 
     store = new Store(basedir, region, hcd, fs, conf);
     TEST_FILE = StoreFile.getRandomFilename(fs, store.getHomedir());

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java Tue Jun 14 05:40:32 2011
@@ -72,17 +72,17 @@ public class TestGetClosestAtOrBefore ex
     Path rootdir = filesystem.makeQualified(new Path(conf.get(HConstants.HBASE_DIR)));
     filesystem.mkdirs(rootdir);
     // Up flush size else we bind up when we use default catalog flush of 16k.
-    HRegionInfo.FIRST_META_REGIONINFO.getTableDesc().
-      setMemStoreFlushSize(64 * 1024 * 1024);
+    HTableDescriptor.META_TABLEDESC.setMemStoreFlushSize(64 * 1024 * 1024);
+
     HRegion mr = HRegion.createHRegion(HRegionInfo.FIRST_META_REGIONINFO,
-      rootdir, this.conf);
+      rootdir, this.conf, HTableDescriptor.META_TABLEDESC);
     // Write rows for three tables 'A', 'B', and 'C'.
     for (char c = 'A'; c < 'D'; c++) {
       HTableDescriptor htd = new HTableDescriptor("" + c);
       final int last = 128;
       final int interval = 2;
       for (int i = 0; i <= last; i += interval) {
-        HRegionInfo hri = new HRegionInfo(htd,
+        HRegionInfo hri = new HRegionInfo(htd.getName(),
           i == 0? HConstants.EMPTY_BYTE_ARRAY: Bytes.toBytes((byte)i),
           i == last? HConstants.EMPTY_BYTE_ARRAY: Bytes.toBytes((byte)i + interval));
         Put put = new Put(hri.getRegionName());

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java Tue Jun 14 05:40:32 2011
@@ -2794,9 +2794,9 @@ public class TestHRegion extends HBaseTe
     
     HTableDescriptor htd = new HTableDescriptor(tableName);
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
     Path path = new Path(DIR + "testBloomFilterSize");
-    region = HRegion.createHRegion(info, path, conf);
+    region = HRegion.createHRegion(info, path, conf, htd);
     
     int num_unique_rows = 10;
     int duplicate_multiplier =2;
@@ -2852,9 +2852,9 @@ public class TestHRegion extends HBaseTe
         HColumnDescriptor.DEFAULT_REPLICATION_SCOPE);
     HTableDescriptor htd = new HTableDescriptor(TABLE);
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
     Path path = new Path(DIR + "testAllColumnsWithBloomFilter");
-    region = HRegion.createHRegion(info, path, conf);
+    region = HRegion.createHRegion(info, path, conf, htd);
 
     // For row:0, col:0: insert versions 1 through 5.
     byte row[] = Bytes.toBytes("row:" + 0);
@@ -2897,9 +2897,9 @@ public class TestHRegion extends HBaseTe
 
     HTableDescriptor htd = new HTableDescriptor(tableName);
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
     Path path = new Path(DIR + "TestDeleteRowWithBloomFilter");
-    region = HRegion.createHRegion(info, path, conf);
+    region = HRegion.createHRegion(info, path, conf, htd);
 
     // Insert some data
     byte row[] = Bytes.toBytes("row1");
@@ -3033,14 +3033,14 @@ public class TestHRegion extends HBaseTe
     for(byte [] family : families) {
       htd.addFamily(new HColumnDescriptor(family));
     }
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
     Path path = new Path(DIR + callingMethod);
     if (fs.exists(path)) {
       if (!fs.delete(path, true)) {
         throw new IOException("Failed delete of " + path);
       }
     }
-    region = HRegion.createHRegion(info, path, conf);
+    region = HRegion.createHRegion(info, path, conf, htd);
   }
 
   /**

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java Tue Jun 14 05:40:32 2011
@@ -56,7 +56,7 @@ public class TestHRegionInfo {
   public void testContainsRange() {
     HTableDescriptor tableDesc = new HTableDescriptor("testtable");
     HRegionInfo hri = new HRegionInfo(
-        tableDesc, Bytes.toBytes("a"), Bytes.toBytes("g"));
+        tableDesc.getName(), 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

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java Tue Jun 14 05:40:32 2011
@@ -82,8 +82,8 @@ public class TestRSStatusServlet {
   public void testWithRegions() throws IOException {
     HTableDescriptor htd = new HTableDescriptor("mytable");
     List<HRegionInfo> regions = Lists.newArrayList(
-        new HRegionInfo(htd, Bytes.toBytes("a"), Bytes.toBytes("d")),
-        new HRegionInfo(htd, Bytes.toBytes("d"), Bytes.toBytes("z"))
+        new HRegionInfo(htd.getName(), Bytes.toBytes("a"), Bytes.toBytes("d")),
+        new HRegionInfo(htd.getName(), Bytes.toBytes("d"), Bytes.toBytes("z"))
         );
     Mockito.doReturn(regions).when(rs).getOnlineRegions();
     

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestResettingCounters.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestResettingCounters.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestResettingCounters.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestResettingCounters.java Tue Jun 14 05:40:32 2011
@@ -61,7 +61,7 @@ public class TestResettingCounters {
     HTableDescriptor htd = new HTableDescriptor(table);
     for (byte [] family : families) htd.addFamily(new HColumnDescriptor(family));
 
-    HRegionInfo hri = new HRegionInfo(htd, null, null, false);
+    HRegionInfo hri = new HRegionInfo(htd.getName(), null, null, false);
     String testDir = HBaseTestingUtility.getTestDir() + "/TestResettingCounters/";
     Path path = new Path(testDir);
     if (fs.exists(path)) {
@@ -69,7 +69,7 @@ public class TestResettingCounters {
         throw new IOException("Failed delete of " + path);
       }
     }
-    HRegion region = HRegion.createHRegion(hri, path, conf);
+    HRegion region = HRegion.createHRegion(hri, path, conf, htd);
 
     Increment odd = new Increment(rows[0]);
     Increment even = new Increment(rows[0]);

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java Tue Jun 14 05:40:32 2011
@@ -72,7 +72,7 @@ public class TestScanner extends HBaseTe
   }
   /** HRegionInfo for root region */
   public static final HRegionInfo REGION_INFO =
-    new HRegionInfo(TESTTABLEDESC, HConstants.EMPTY_BYTE_ARRAY,
+    new HRegionInfo(TESTTABLEDESC.getName(), HConstants.EMPTY_BYTE_ARRAY,
     HConstants.EMPTY_BYTE_ARRAY);
 
   private static final byte [] ROW_KEY = REGION_INFO.getRegionName();
@@ -101,7 +101,7 @@ public class TestScanner extends HBaseTe
     byte [] startrow = Bytes.toBytes("bbb");
     byte [] stoprow = Bytes.toBytes("ccc");
     try {
-      this.r = createNewHRegion(REGION_INFO.getTableDesc(), null, null);
+      this.r = createNewHRegion(TESTTABLEDESC, null, null);
       addContent(this.r, HConstants.CATALOG_FAMILY);
       List<KeyValue> results = new ArrayList<KeyValue>();
       // Do simple test of getting one row only first.
@@ -175,7 +175,7 @@ public class TestScanner extends HBaseTe
 
   public void testFilters() throws IOException {
     try {
-      this.r = createNewHRegion(REGION_INFO.getTableDesc(), null, null);
+      this.r = createNewHRegion(TESTTABLEDESC, null, null);
       addContent(this.r, HConstants.CATALOG_FAMILY);
       byte [] prefix = Bytes.toBytes("ab");
       Filter newFilter = new PrefixFilter(prefix);
@@ -203,7 +203,7 @@ public class TestScanner extends HBaseTe
    */
   public void testRaceBetweenClientAndTimeout() throws Exception {
     try {
-      this.r = createNewHRegion(REGION_INFO.getTableDesc(), null, null);
+      this.r = createNewHRegion(TESTTABLEDESC, null, null);
       addContent(this.r, HConstants.CATALOG_FAMILY);
       Scan scan = new Scan();
       InternalScanner s = r.getScanner(scan);
@@ -352,7 +352,7 @@ public class TestScanner extends HBaseTe
     assertEquals(0, info.getStartKey().length);
     assertEquals(0, info.getEndKey().length);
     assertEquals(0, Bytes.compareTo(info.getRegionName(), REGION_INFO.getRegionName()));
-    assertEquals(0, info.getTableDesc().compareTo(REGION_INFO.getTableDesc()));
+    //assertEquals(0, info.getTableDesc().compareTo(REGION_INFO.getTableDesc()));
   }
 
   /** Use a scanner to get the region info and then validate the results */
@@ -448,7 +448,7 @@ public class TestScanner extends HBaseTe
    * @throws Exception
    */
   public void testScanAndSyncFlush() throws Exception {
-    this.r = createNewHRegion(REGION_INFO.getTableDesc(), null, null);
+    this.r = createNewHRegion(TESTTABLEDESC, null, null);
     HRegionIncommon hri = new HRegionIncommon(r);
     try {
         LOG.info("Added: " + addContent(hri, Bytes.toString(HConstants.CATALOG_FAMILY),
@@ -472,7 +472,7 @@ public class TestScanner extends HBaseTe
    * @throws Exception
    */
   public void testScanAndRealConcurrentFlush() throws Exception {
-    this.r = createNewHRegion(REGION_INFO.getTableDesc(), null, null);
+    this.r = createNewHRegion(TESTTABLEDESC, null, null);
     HRegionIncommon hri = new HRegionIncommon(r);
     try {
         LOG.info("Added: " + addContent(hri, Bytes.toString(HConstants.CATALOG_FAMILY),

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java Tue Jun 14 05:40:32 2011
@@ -153,8 +153,8 @@ public class TestSplitTransaction {
     int daughtersRowCount = 0;
     for (HRegion r: daughters) {
       // Open so can count its content.
-      HRegion openRegion = HRegion.openHRegion(r.getRegionInfo(),
-        r.getLog(), r.getConf());
+      HRegion openRegion = HRegion.openHRegion(this.testdir, r.getRegionInfo(),
+         r.getLog(), r.getConf());
       try {
         int count = countRows(openRegion);
         assertTrue(count > 0 && count != rowcount);
@@ -208,8 +208,8 @@ public class TestSplitTransaction {
     int daughtersRowCount = 0;
     for (HRegion r: daughters) {
       // Open so can count its content.
-      HRegion openRegion = HRegion.openHRegion(r.getRegionInfo(),
-        r.getLog(), r.getConf());
+      HRegion openRegion = HRegion.openHRegion(this.testdir, r.getRegionInfo(),
+         r.getLog(), r.getConf());
       try {
         int count = countRows(openRegion);
         assertTrue(count > 0 && count != rowcount);
@@ -252,7 +252,8 @@ public class TestSplitTransaction {
     HTableDescriptor htd = new HTableDescriptor("table");
     HColumnDescriptor hcd = new HColumnDescriptor(CF);
     htd.addFamily(hcd);
-    HRegionInfo hri = new HRegionInfo(htd, STARTROW, ENDROW);
-    return HRegion.openHRegion(hri, wal, TEST_UTIL.getConfiguration());
+    HRegionInfo hri = new HRegionInfo(htd.getName(), STARTROW, ENDROW);
+    HRegion.createHRegion(hri, testdir, TEST_UTIL.getConfiguration(), htd);
+    return HRegion.openHRegion(testdir, hri, wal, TEST_UTIL.getConfiguration());
   }
 }
\ No newline at end of file

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java Tue Jun 14 05:40:32 2011
@@ -127,7 +127,7 @@ public class TestStore extends TestCase 
 
     HTableDescriptor htd = new HTableDescriptor(table);
     htd.addFamily(hcd);
-    HRegionInfo info = new HRegionInfo(htd, null, null, false);
+    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
     HLog hlog = new HLog(fs, logdir, oldLogDir, conf);
     HRegion region = new HRegion(basedir, hlog, fs, conf, info, null);
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java Tue Jun 14 05:40:32 2011
@@ -69,10 +69,6 @@ public class TestWideScanner extends HBa
   }
 
   /** HRegionInfo for root region */
-  public static final HRegionInfo REGION_INFO =
-    new HRegionInfo(TESTTABLEDESC, HConstants.EMPTY_BYTE_ARRAY,
-    HConstants.EMPTY_BYTE_ARRAY);
-
   MiniDFSCluster cluster = null;
   HRegion r;
 
@@ -107,7 +103,7 @@ public class TestWideScanner extends HBa
   public void testWideScanBatching() throws IOException {
     final int batch = 256;
     try {
-      this.r = createNewHRegion(REGION_INFO.getTableDesc(), null, null);
+      this.r = createNewHRegion(TESTTABLEDESC, null, null);
       int inserted = addWideContent(this.r);
       List<KeyValue> results = new ArrayList<KeyValue>();
       Scan scan = new Scan();

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java Tue Jun 14 05:40:32 2011
@@ -233,11 +233,17 @@ public class TestOpenRegionHandler {
     HTableDescriptor htd =
       new HTableDescriptor("testOpenRegionHandlerYankingRegionFromUnderIt");
     final HRegionInfo hri =
-      new HRegionInfo(htd, HConstants.EMPTY_END_ROW, HConstants.EMPTY_END_ROW);
+      new HRegionInfo(htd.getName(), HConstants.EMPTY_END_ROW,
+          HConstants.EMPTY_END_ROW);
+    HRegion region =
+         HRegion.createHRegion(hri, HBaseTestingUtility.getTestDir(), HTU
+            .getConfiguration(), htd);
     OpenRegionHandler handler = new OpenRegionHandler(server, rss, hri) {
       HRegion openRegion() {
         // Open region first, then remove znode as though it'd been hijacked.
-        HRegion region = super.openRegion();
+        //HRegion region = super.openRegion();
+        HRegion region = super.openRegion(HBaseTestingUtility.getTestDir());
+
         // Don't actually open region BUT remove the znode as though it'd
         // been hijacked on us.
         ZooKeeperWatcher zkw = this.server.getZooKeeper();
@@ -258,4 +264,4 @@ public class TestOpenRegionHandler {
     // post OPENING; again will expect it to come back w/o NPE or exception.
     handler.process();
   }
-}
\ No newline at end of file
+}

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java Tue Jun 14 05:40:32 2011
@@ -38,11 +38,7 @@ import org.apache.hadoop.fs.FSDataOutput
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.regionserver.wal.HLog.Reader;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSUtils;
@@ -145,11 +141,14 @@ public class TestHLog  {
     Path tabledir = new Path(hbaseDir, getName());
     fs.mkdirs(tabledir);
     for(int i = 0; i < howmany; i++) {
-      infos[i] = new HRegionInfo(new HTableDescriptor(tableName),
+      infos[i] = new HRegionInfo(tableName,
                 Bytes.toBytes("" + i), Bytes.toBytes("" + (i+1)), false);
       fs.mkdirs(new Path(tabledir, infos[i].getEncodedName()));
       LOG.info("allo " + new Path(tabledir, infos[i].getEncodedName()).toString());
     }
+    HTableDescriptor htd = new HTableDescriptor(tableName);
+    htd.addFamily(new HColumnDescriptor("column"));
+
     // Add edits for three regions.
     try {
       for (int ii = 0; ii < howmany; ii++) {
@@ -164,7 +163,7 @@ public class TestHLog  {
                 System.currentTimeMillis(), column));
             LOG.info("Region " + i + ": " + edit);
             log.append(infos[i], tableName, edit,
-              System.currentTimeMillis());
+              System.currentTimeMillis(), htd);
           }
         }
         log.rollWriter();
@@ -206,13 +205,15 @@ public class TestHLog  {
     HLog wal = new HLog(fs, subdir, oldLogDir, conf);
     final int total = 20;
 
-    HRegionInfo info = new HRegionInfo(new HTableDescriptor(bytes),
+    HRegionInfo info = new HRegionInfo(bytes,
                 null,null, false);
+    HTableDescriptor htd = new HTableDescriptor();
+    htd.addFamily(new HColumnDescriptor(bytes));
 
     for (int i = 0; i < total; i++) {
       WALEdit kvs = new WALEdit();
       kvs.add(new KeyValue(Bytes.toBytes(i), bytes, bytes));
-      wal.append(info, bytes, kvs, System.currentTimeMillis());
+      wal.append(info, bytes, kvs, System.currentTimeMillis(), htd);
     }
     // Now call sync and try reading.  Opening a Reader before you sync just
     // gives you EOFE.
@@ -230,7 +231,7 @@ public class TestHLog  {
     for (int i = 0; i < total; i++) {
       WALEdit kvs = new WALEdit();
       kvs.add(new KeyValue(Bytes.toBytes(i), bytes, bytes));
-      wal.append(info, bytes, kvs, System.currentTimeMillis());
+      wal.append(info, bytes, kvs, System.currentTimeMillis(), htd);
     }
     reader = HLog.getReader(fs, walPath, conf);
     count = 0;
@@ -249,7 +250,7 @@ public class TestHLog  {
     for (int i = 0; i < total; i++) {
       WALEdit kvs = new WALEdit();
       kvs.add(new KeyValue(Bytes.toBytes(i), bytes, value));
-      wal.append(info, bytes, kvs, System.currentTimeMillis());
+      wal.append(info, bytes, kvs, System.currentTimeMillis(), htd);
     }
     // Now I should have written out lots of blocks.  Sync then read.
     wal.sync();
@@ -334,17 +335,19 @@ public class TestHLog  {
   @Test
   public void testAppendClose() throws Exception {
     byte [] tableName = Bytes.toBytes(getName());
-    HRegionInfo regioninfo = new HRegionInfo(new HTableDescriptor(tableName),
-        HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW, false);
+    HRegionInfo regioninfo = new HRegionInfo(tableName,
+             HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW, false);
     Path subdir = new Path(dir, "hlogdir");
     Path archdir = new Path(dir, "hlogdir_archive");
     HLog wal = new HLog(fs, subdir, archdir, conf);
     final int total = 20;
+    HTableDescriptor htd = new HTableDescriptor();
+    htd.addFamily(new HColumnDescriptor(tableName));
 
     for (int i = 0; i < total; i++) {
       WALEdit kvs = new WALEdit();
       kvs.add(new KeyValue(Bytes.toBytes(i), tableName, tableName));
-      wal.append(regioninfo, tableName, kvs, System.currentTimeMillis());
+      wal.append(regioninfo, tableName, kvs, System.currentTimeMillis(), htd);
     }
     // Now call sync to send the data to HDFS datanodes
     wal.sync();
@@ -460,11 +463,15 @@ public class TestHLog  {
             Bytes.toBytes(Integer.toString(i)),
           timestamp, new byte[] { (byte)(i + '0') }));
       }
-      HRegionInfo info = new HRegionInfo(new HTableDescriptor(tableName),
+      HRegionInfo info = new HRegionInfo(tableName,
         row,Bytes.toBytes(Bytes.toString(row) + "1"), false);
-      log.append(info, tableName, cols, System.currentTimeMillis());
+      HTableDescriptor htd = new HTableDescriptor();
+      htd.addFamily(new HColumnDescriptor("column"));
+
+      log.append(info, tableName, cols, System.currentTimeMillis(), htd);
       long logSeqId = log.startCacheFlush();
-      log.completeCacheFlush(info.getEncodedNameAsBytes(), tableName, logSeqId, info.isMetaRegion());
+      log.completeCacheFlush(info.getEncodedNameAsBytes(), tableName, logSeqId,
+          info.isMetaRegion());
       log.close();
       Path filename = log.computeFilename();
       log = null;
@@ -528,9 +535,11 @@ public class TestHLog  {
           Bytes.toBytes(Integer.toString(i)),
           timestamp, new byte[] { (byte)(i + '0') }));
       }
-      HRegionInfo hri = new HRegionInfo(new HTableDescriptor(tableName),
+      HRegionInfo hri = new HRegionInfo(tableName,
           HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW);
-      log.append(hri, tableName, cols, System.currentTimeMillis());
+      HTableDescriptor htd = new HTableDescriptor();
+      htd.addFamily(new HColumnDescriptor("column"));
+      log.append(hri, tableName, cols, System.currentTimeMillis(), htd);
       long logSeqId = log.startCacheFlush();
       log.completeCacheFlush(hri.getEncodedNameAsBytes(), tableName, logSeqId, false);
       log.close();
@@ -587,14 +596,17 @@ public class TestHLog  {
     DumbWALObserver visitor = new DumbWALObserver();
     log.registerWALActionsListener(visitor);
     long timestamp = System.currentTimeMillis();
-    HRegionInfo hri = new HRegionInfo(new HTableDescriptor(tableName),
+    HTableDescriptor htd = new HTableDescriptor();
+    htd.addFamily(new HColumnDescriptor("column"));
+
+    HRegionInfo hri = new HRegionInfo(tableName,
         HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW);
     for (int i = 0; i < COL_COUNT; i++) {
       WALEdit cols = new WALEdit();
       cols.add(new KeyValue(row, Bytes.toBytes("column"),
           Bytes.toBytes(Integer.toString(i)),
           timestamp, new byte[]{(byte) (i + '0')}));
-      log.append(hri, tableName, cols, System.currentTimeMillis());
+      log.append(hri, tableName, cols, System.currentTimeMillis(), htd);
     }
     assertEquals(COL_COUNT, visitor.increments);
     log.unregisterWALActionsListener(visitor);
@@ -602,7 +614,7 @@ public class TestHLog  {
     cols.add(new KeyValue(row, Bytes.toBytes("column"),
         Bytes.toBytes(Integer.toString(11)),
         timestamp, new byte[]{(byte) (11 + '0')}));
-    log.append(hri, tableName, cols, System.currentTimeMillis());
+    log.append(hri, tableName, cols, System.currentTimeMillis(), htd);
     assertEquals(COL_COUNT, visitor.increments);
   }
 
@@ -613,9 +625,9 @@ public class TestHLog  {
     final byte [] tableName2 = Bytes.toBytes("testLogCleaning2");
 
     HLog log = new HLog(fs, dir, oldLogDir, conf);
-    HRegionInfo hri = new HRegionInfo(new HTableDescriptor(tableName),
+    HRegionInfo hri = new HRegionInfo(tableName,
         HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW);
-    HRegionInfo hri2 = new HRegionInfo(new HTableDescriptor(tableName2),
+    HRegionInfo hri2 = new HRegionInfo(tableName2,
         HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW);
 
     // Add a single edit and make sure that rolling won't remove the file
@@ -667,12 +679,15 @@ public class TestHLog  {
 
   private void addEdits(HLog log, HRegionInfo hri, byte [] tableName,
                         int times) throws IOException {
+    HTableDescriptor htd = new HTableDescriptor();
+    htd.addFamily(new HColumnDescriptor("row"));
+
     final byte [] row = Bytes.toBytes("row");
     for (int i = 0; i < times; i++) {
       long timestamp = System.currentTimeMillis();
       WALEdit cols = new WALEdit();
       cols.add(new KeyValue(row, row, row, timestamp, row));
-      log.append(hri, tableName, cols, timestamp);
+      log.append(hri, tableName, cols, timestamp, htd);
     }
   }
 
@@ -686,6 +701,12 @@ public class TestHLog  {
     }
 
     @Override
+    public void visitLogEntryBeforeWrite(HTableDescriptor htd, HLogKey logKey, WALEdit logEdit) {
+      //To change body of implemented methods use File | Settings | File Templates.
+      increments++;
+    }
+
+    @Override
     public void logRolled(Path newFile) {
       // TODO Auto-generated method stub
       

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALObserver.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALObserver.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALObserver.java Tue Jun 14 05:40:32 2011
@@ -27,11 +27,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.After;
 import org.junit.Before;
@@ -88,16 +84,19 @@ public class TestWALObserver {
     list.add(observer);
     DummyWALObserver laterobserver = new DummyWALObserver();
     HLog hlog = new HLog(fs, logDir, oldLogDir, conf, list, null);
-    HRegionInfo hri = new HRegionInfo(new HTableDescriptor(SOME_BYTES),
-        SOME_BYTES, SOME_BYTES, false);
+    HRegionInfo hri = new HRegionInfo(SOME_BYTES,
+             SOME_BYTES, SOME_BYTES, false);
 
     for (int i = 0; i < 20; i++) {
       byte[] b = Bytes.toBytes(i+"");
       KeyValue kv = new KeyValue(b,b,b);
       WALEdit edit = new WALEdit();
       edit.add(kv);
+      HTableDescriptor htd = new HTableDescriptor();
+      htd.addFamily(new HColumnDescriptor(b));
+
       HLogKey key = new HLogKey(b,b, 0, 0);
-      hlog.append(hri, key, edit);
+      hlog.append(hri, key, edit, htd);
       if (i == 10) {
         hlog.registerWALActionsListener(laterobserver);
       }
@@ -114,6 +113,7 @@ public class TestWALObserver {
     assertEquals(2, observer.closedCount);
   }
 
+
   /**
    * Just counts when methods are called
    */
@@ -142,5 +142,10 @@ public class TestWALObserver {
     public void logCloseRequested() {
       closedCount++;
     }
+
+    public void visitLogEntryBeforeWrite(HTableDescriptor htd, HLogKey logKey, WALEdit logEdit) {
+      //To change body of implemented methods use File | Settings | File Templates.
+    }
+
   }
 }
\ No newline at end of file

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java Tue Jun 14 05:40:32 2011
@@ -133,14 +133,19 @@ public class TestWALReplay {
     deleteDir(basedir);
     fs.mkdirs(new Path(basedir, hri.getEncodedName()));
 
+    HTableDescriptor htd = createBasic3FamilyHTD(tableNameStr);
+    HRegion region2 = HRegion.createHRegion(hri,
+        hbaseRootDir, this.conf, htd);
+
     final byte [] tableName = Bytes.toBytes(tableNameStr);
     final byte [] rowName = tableName;
 
     HLog wal1 = createWAL(this.conf);
     // Add 1k to each family.
     final int countPerFamily = 1000;
-    for (HColumnDescriptor hcd: hri.getTableDesc().getFamilies()) {
-      addWALEdits(tableName, hri, rowName, hcd.getName(), countPerFamily, ee, wal1);
+    for (HColumnDescriptor hcd: htd.getFamilies()) {
+      addWALEdits(tableName, hri, rowName, hcd.getName(), countPerFamily, ee,
+          wal1, htd);
     }
     wal1.close();
     runWALSplit(this.conf);
@@ -149,8 +154,9 @@ public class TestWALReplay {
     // Up the sequenceid so that these edits are after the ones added above.
     wal2.setSequenceNumber(wal1.getSequenceNumber());
     // Add 1k to each family.
-    for (HColumnDescriptor hcd: hri.getTableDesc().getFamilies()) {
-      addWALEdits(tableName, hri, rowName, hcd.getName(), countPerFamily, ee, wal2);
+    for (HColumnDescriptor hcd: htd.getFamilies()) {
+      addWALEdits(tableName, hri, rowName, hcd.getName(), countPerFamily,
+          ee, wal2, htd);
     }
     wal2.close();
     runWALSplit(this.conf);
@@ -187,11 +193,14 @@ public class TestWALReplay {
     final HRegionInfo hri = createBasic3FamilyHRegionInfo(tableNameStr);
     final Path basedir = new Path(this.hbaseRootDir, tableNameStr);
     deleteDir(basedir);
+    HTableDescriptor htd = createBasic3FamilyHTD(tableNameStr);
+    HRegion region2 = HRegion.createHRegion(hri,
+        hbaseRootDir, this.conf, htd);
     HLog wal = createWAL(this.conf);
     HRegion region = HRegion.openHRegion(hri, wal, this.conf);
     Path f =  new Path(basedir, "hfile");
     HFile.Writer writer = new HFile.Writer(this.fs, f);
-    byte [] family = hri.getTableDesc().getFamilies().iterator().next().getName();
+    byte [] family = htd.getFamilies().iterator().next().getName();
     byte [] row = Bytes.toBytes(tableNameStr);
     writer.append(new KeyValue(row, family, family, row));
     writer.close();
@@ -240,6 +249,9 @@ public class TestWALReplay {
     deleteDir(basedir);
     final byte[] rowName = Bytes.toBytes(tableNameStr);
     final int countPerFamily = 10;
+    final HTableDescriptor htd = createBasic3FamilyHTD(tableNameStr);
+    HRegion region3 = HRegion.createHRegion(hri,
+            hbaseRootDir, this.conf, htd);
 
     // Write countPerFamily edits into the three families.  Do a flush on one
     // of the families during the load of edits so its seqid is not same as
@@ -250,7 +262,7 @@ public class TestWALReplay {
     // HRegionServer usually does this. It knows the largest seqid across all regions.
     wal.setSequenceNumber(seqid);
     boolean first = true;
-    for (HColumnDescriptor hcd: hri.getTableDesc().getFamilies()) {
+    for (HColumnDescriptor hcd: htd.getFamilies()) {
       addRegionEdits(rowName, hcd.getName(), countPerFamily, this.ee, region, "x");
       if (first ) {
         // If first, so we have at least one family w/ different seqid to rest.
@@ -261,7 +273,7 @@ public class TestWALReplay {
     // Now assert edits made it in.
     final Get g = new Get(rowName);
     Result result = region.get(g, null);
-    assertEquals(countPerFamily * hri.getTableDesc().getFamilies().size(),
+    assertEquals(countPerFamily * htd.getFamilies().size(),
       result.size());
     // Now close the region, split the log, reopen the region and assert that
     // replay of log has no effect, that our seqids are calculated correctly so
@@ -285,7 +297,7 @@ public class TestWALReplay {
     // Next test.  Add more edits, then 'crash' this region by stealing its wal
     // out from under it and assert that replay of the log adds the edits back
     // correctly when region is opened again.
-    for (HColumnDescriptor hcd: hri.getTableDesc().getFamilies()) {
+    for (HColumnDescriptor hcd: htd.getFamilies()) {
       addRegionEdits(rowName, hcd.getName(), countPerFamily, this.ee, region2, "y");
     }
     // Get count of edits.
@@ -319,7 +331,7 @@ public class TestWALReplay {
         Result result3 = region3.get(g, null);
         // Assert that count of cells is same as before crash.
         assertEquals(result2.size(), result3.size());
-        assertEquals(hri.getTableDesc().getFamilies().size() * countPerFamily,
+        assertEquals(htd.getFamilies().size() * countPerFamily,
           countOfRestoredEdits.get());
 
         // I can't close wal1.  Its been appropriated when we split.
@@ -342,6 +354,10 @@ public class TestWALReplay {
     final Path basedir = new Path(hbaseRootDir, tableNameStr);
     deleteDir(basedir);
     fs.mkdirs(new Path(basedir, hri.getEncodedName()));
+    final HTableDescriptor htd = createBasic3FamilyHTD(tableNameStr);
+    HRegion region2 = HRegion.createHRegion(hri,
+            hbaseRootDir, this.conf, htd);
+
     final HLog wal = createWAL(this.conf);
     final byte[] tableName = Bytes.toBytes(tableNameStr);
     final byte[] rowName = tableName;
@@ -349,8 +365,9 @@ public class TestWALReplay {
 
     // Add 1k to each family.
     final int countPerFamily = 1000;
-    for (HColumnDescriptor hcd: hri.getTableDesc().getFamilies()) {
-      addWALEdits(tableName, hri, rowName, hcd.getName(), countPerFamily, ee, wal);
+    for (HColumnDescriptor hcd: htd.getFamilies()) {
+      addWALEdits(tableName, hri, rowName, hcd.getName(), countPerFamily,
+          ee, wal, htd);
     }
 
     // Add a cache flush, shouldn't have any effect
@@ -362,14 +379,14 @@ public class TestWALReplay {
     long now = ee.currentTimeMillis();
     edit.add(new KeyValue(rowName, Bytes.toBytes("another family"), rowName,
       now, rowName));
-    wal.append(hri, tableName, edit, now);
+    wal.append(hri, tableName, edit, now, htd);
 
     // Delete the c family to verify deletes make it over.
     edit = new WALEdit();
     now = ee.currentTimeMillis();
     edit.add(new KeyValue(rowName, Bytes.toBytes("c"), null, now,
       KeyValue.Type.DeleteFamily));
-    wal.append(hri, tableName, edit, now);
+    wal.append(hri, tableName, edit, now, htd);
 
     // Sync.
     wal.sync();
@@ -411,7 +428,7 @@ public class TestWALReplay {
           Get get = new Get(rowName);
           Result result = region.get(get, -1);
           // Make sure we only see the good edits
-          assertEquals(countPerFamily * (hri.getTableDesc().getFamilies().size() - 1),
+          assertEquals(countPerFamily * (htd.getFamilies().size() - 1),
             result.size());
           region.close();
         } finally {
@@ -441,7 +458,7 @@ public class TestWALReplay {
 
   private void addWALEdits (final byte [] tableName, final HRegionInfo hri,
       final byte [] rowName, final byte [] family,
-      final int count, EnvironmentEdge ee, final HLog wal)
+      final int count, EnvironmentEdge ee, final HLog wal, final HTableDescriptor htd)
   throws IOException {
     String familyStr = Bytes.toString(family);
     for (int j = 0; j < count; j++) {
@@ -450,7 +467,7 @@ public class TestWALReplay {
       WALEdit edit = new WALEdit();
       edit.add(new KeyValue(rowName, family, qualifierBytes,
         ee.currentTimeMillis(), columnBytes));
-      wal.append(hri, tableName, edit, ee.currentTimeMillis());
+      wal.append(hri, tableName, edit, ee.currentTimeMillis(), htd);
     }
   }
 
@@ -471,17 +488,9 @@ public class TestWALReplay {
    * column families named 'a','b', and 'c'.
    * @param tableName Name of table to use when we create HTableDescriptor.
    */
-  private HRegionInfo createBasic3FamilyHRegionInfo(final String tableName) {
-    HTableDescriptor htd = new HTableDescriptor(tableName);
-    HColumnDescriptor a = new HColumnDescriptor(Bytes.toBytes("a"));
-    htd.addFamily(a);
-    HColumnDescriptor b = new HColumnDescriptor(Bytes.toBytes("b"));
-    htd.addFamily(b);
-    HColumnDescriptor c = new HColumnDescriptor(Bytes.toBytes("c"));
-    htd.addFamily(c);
-    return new HRegionInfo(htd, null, null, false);
-  }
-
+   private HRegionInfo createBasic3FamilyHRegionInfo(final String tableName) {
+    return new HRegionInfo(Bytes.toBytes(tableName), null, null, false);
+   }
 
   /*
    * Run the split.  Verify only single split file made.
@@ -514,4 +523,15 @@ public class TestWALReplay {
     HBaseTestingUtility.setMaxRecoveryErrorCount(wal.getOutputStream(), 1);
     return wal;
   }
+
+  private HTableDescriptor createBasic3FamilyHTD(final String tableName) {
+    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HColumnDescriptor a = new HColumnDescriptor(Bytes.toBytes("a"));
+    htd.addFamily(a);
+    HColumnDescriptor b = new HColumnDescriptor(Bytes.toBytes("b"));
+    htd.addFamily(b);
+    HColumnDescriptor c = new HColumnDescriptor(Bytes.toBytes("c"));
+    htd.addFamily(c);
+    return htd;
+  }
 }
\ No newline at end of file

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java Tue Jun 14 05:40:32 2011
@@ -125,7 +125,7 @@ public class TestReplicationSourceManage
     col.setScope(HConstants.REPLICATION_SCOPE_LOCAL);
     htd.addFamily(col);
 
-    hri = new HRegionInfo(htd, r1, r2);
+    hri = new HRegionInfo(htd.getName(), r1, r2);
 
 
   }
@@ -162,7 +162,8 @@ public class TestReplicationSourceManage
       URLEncoder.encode("regionserver:60020", "UTF8"));
 
     manager.init();
-
+    HTableDescriptor htd = new HTableDescriptor();
+    htd.addFamily(new HColumnDescriptor(f1));
     // Testing normal log rolling every 20
     for(long i = 1; i < 101; i++) {
       if(i > 1 && i % 20 == 0) {
@@ -171,7 +172,7 @@ public class TestReplicationSourceManage
       LOG.info(i);
       HLogKey key = new HLogKey(hri.getRegionName(),
         test, seq++, System.currentTimeMillis());
-      hlog.append(hri, key, edit);
+      hlog.append(hri, key, edit, htd);
     }
 
     // Simulate a rapid insert that's followed
@@ -184,7 +185,7 @@ public class TestReplicationSourceManage
     for (int i = 0; i < 3; i++) {
       HLogKey key = new HLogKey(hri.getRegionName(),
         test, seq++, System.currentTimeMillis());
-      hlog.append(hri, key, edit);
+      hlog.append(hri, key, edit, htd);
     }
 
     assertEquals(6, manager.getHLogs().size());
@@ -196,7 +197,7 @@ public class TestReplicationSourceManage
 
     HLogKey key = new HLogKey(hri.getRegionName(),
           test, seq++, System.currentTimeMillis());
-    hlog.append(hri, key, edit);
+    hlog.append(hri, key, edit, htd);
 
     assertEquals(1, manager.getHLogs().size());
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableRegionModel.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableRegionModel.java?rev=1135385&r1=1135384&r2=1135385&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableRegionModel.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableRegionModel.java Tue Jun 14 05:40:32 2011
@@ -88,7 +88,7 @@ public class TestTableRegionModel extend
   public void testGetName() {
     TableRegionModel model = buildTestModel();
     String modelName = model.getName();
-    HRegionInfo hri = new HRegionInfo(new HTableDescriptor(TABLE),
+    HRegionInfo hri = new HRegionInfo(Bytes.toBytes(TABLE),
       START_KEY, END_KEY, false, ID);
     assertEquals(modelName, hri.getRegionNameAsString());
   }
@@ -103,4 +103,4 @@ public class TestTableRegionModel extend
   public void testFromXML() throws Exception {
     checkModel(fromXML(AS_XML));
   }
-}
\ No newline at end of file
+}



Mime
View raw message