hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r985377 - in /hbase/branches/0.90_master_rewrite/src: main/java/org/apache/hadoop/hbase/ main/java/org/apache/hadoop/hbase/client/ main/java/org/apache/hadoop/hbase/master/ main/java/org/apache/hadoop/hbase/regionserver/ main/java/org/apach...
Date Fri, 13 Aug 2010 21:49:32 GMT
Author: stack
Date: Fri Aug 13 21:49:31 2010
New Revision: 985377

URL: http://svn.apache.org/viewvc?rev=985377&view=rev
Log:
Added CompactionRequester interface.  Made the FlushRequester look same.
Made method names same too.

Renamed RegionServerController as RegionServer. Moved some of its methods to
new Interface named OnlineRegions, added a getFlushRequester.  Removed a few
other methods -- the open of an a region method; its no needed any more because
I made this custom open hregion use an old static open region that was over
in HRegion.


Added:
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactionRequestor.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/OnlineRegions.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java
Removed:
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerController.java
Modified:
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/Server.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/FlushRequester.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseMetaHandler.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRootHandler.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenMetaHandler.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRootHandler.java
    hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
    hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
    hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
    hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java Fri Aug 13 21:49:31 2010
@@ -103,8 +103,7 @@ public class HRegionInfo extends Version
       // old format region name. ROOT and first META region also 
       // use this format.EncodedName is the JenkinsHash value.
       int hashVal = Math.abs(JenkinsHash.getInstance().hash(regionName,
-                                                            regionName.length,
-                                                            0));
+        regionName.length, 0));
       encodedName = String.valueOf(hashVal);
     }
     return encodedName;

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/Server.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/Server.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/Server.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/Server.java Fri Aug 13 21:49:31 2010
@@ -45,6 +45,9 @@ public interface Server extends Abortabl
 
   /**
    * Gets the unique server name for this server.
+   * If a RegionServer, it returns a concatenation of hostname, port and
+   * startcode formatted as <code>&lt;hostname> ',' &lt;port> ',' &lt;startcode></code>.
+   * If the master, it returns <code>&lt;hostname> ':' &lt;port>'.
    * @return unique server name
    */
   public String getServerName();

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Fri Aug 13 21:49:31 2010
@@ -896,8 +896,7 @@ public class HConnectionManager {
      * Delete a cached location, if it satisfies the table name and row
      * requirements.
      */
-    void deleteCachedLocation(final byte [] tableName,
-                                      final byte [] row) {
+    void deleteCachedLocation(final byte [] tableName, final byte [] row) {
       synchronized (this.cachedRegionLocations) {
         SoftValueSortedMap<byte [], HRegionLocation> tableLocations =
             getTableLocations(tableName);

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Fri Aug 13 21:49:31 2010
@@ -311,7 +311,7 @@ implements HMasterInterface, HMasterRegi
           int count = this.serverManager.numServers();
           if (count != countOfServersStillRunning) {
             countOfServersStillRunning = count;
-            LOG.info("Regionservers still running; " +
+            LOG.info("Regionserver(s) still running: " +
               countOfServersStillRunning);
           }
         }
@@ -750,7 +750,8 @@ implements HMasterInterface, HMasterRegi
   }
 
   @Override
-  public void stop(String why) {
+  public void stop(final String why) {
+    LOG.info(why);
     this.stopped = true;
   }
 

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java Fri Aug 13 21:49:31 2010
@@ -285,8 +285,6 @@ public class ServerManager {
     }
     if (this.clusterShutdown) {
       if (quiescedServers.get() >= availableServers.get()) {
-        // If the only servers we know about are meta servers, then we can
-        // proceed with shutdown
         this.master.stop("All user tables quiesced. Proceeding with shutdown");
         notifyOnlineServers();
       } else if (!this.master.isStopped()) {

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java Fri Aug 13 21:49:31 2010
@@ -40,7 +40,7 @@ import java.util.concurrent.locks.Reentr
 /**
  * Compact region on request and then run split if appropriate
  */
-public class CompactSplitThread extends Thread {
+public class CompactSplitThread extends Thread implements CompactionRequestor {
   static final Log LOG = LogFactory.getLog(CompactSplitThread.class);
 
   private HTable root = null;
@@ -110,13 +110,9 @@ public class CompactSplitThread extends 
     LOG.info(getName() + " exiting");
   }
 
-  /**
-   * @param r HRegion store belongs to
-   * @param why Why compaction requested -- used in debug messages
-   */
-  public synchronized void compactionRequested(final HRegion r,
+  public synchronized void requestCompaction(final HRegion r,
       final String why) {
-    compactionRequested(r, false, why);
+    requestCompaction(r, false, why);
   }
 
   /**
@@ -124,7 +120,7 @@ public class CompactSplitThread extends 
    * @param force Whether next compaction should be major
    * @param why Why compaction requested -- used in debug messages
    */
-  public synchronized void compactionRequested(final HRegion r,
+  public synchronized void requestCompaction(final HRegion r,
       final boolean force, final String why) {
     if (this.server.isStopped()) {
       return;
@@ -177,7 +173,7 @@ public class CompactSplitThread extends 
     oldRegionInfo.setOffline(true);
     oldRegionInfo.setSplit(true);
     // Inform the HRegionServer that the parent HRegion is no-longer online.
-    this.server.removeFromOnlineRegions(oldRegionInfo);
+    this.server.removeFromOnlineRegions(oldRegionInfo.getEncodedName());
 
     Put put = new Put(oldRegionInfo.getRegionName());
     put.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,

Added: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactionRequestor.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactionRequestor.java?rev=985377&view=auto
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactionRequestor.java (added)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/CompactionRequestor.java Fri Aug 13 21:49:31 2010
@@ -0,0 +1,28 @@
+/**
+ * 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.regionserver;
+
+public interface CompactionRequestor {
+  /**
+   * @param r Region to compact
+   * @param why Why compaction was requested -- used in debug messages
+   */
+  public void requestCompaction(final HRegion r, final String why);
+}
\ No newline at end of file

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/FlushRequester.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/FlushRequester.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/FlushRequester.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/FlushRequester.java Fri Aug 13 21:49:31 2010
@@ -21,10 +21,7 @@
 package org.apache.hadoop.hbase.regionserver;
 
 /**
- * Implementors of this interface want to be notified when an HRegion
- * determines that a cache flush is needed. A FlushRequester (or null)
- * must be passed to the HRegion constructor so it knows who to call when it
- * has a filled memstore.
+ * Request a flush.
  */
 public interface FlushRequester {
   /**
@@ -32,5 +29,5 @@ public interface FlushRequester {
    *
    * @param region the HRegion requesting the cache flush
    */
-  void request(HRegion region);
+  void requestFlush(HRegion region);
 }
\ No newline at end of file

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Fri Aug 13 21:49:31 2010
@@ -214,7 +214,7 @@ public class HRegion implements HeapSize
 
   final long memstoreFlushSize;
   private volatile long lastFlushTime;
-  final FlushRequester flushListener;
+  final FlushRequester flushRequester;
   private final long blockingMemStoreSize;
   final long threadWakeFrequency;
   // Used to guard splits and closes
@@ -244,7 +244,7 @@ public class HRegion implements HeapSize
     this.tableDir = null;
     this.blockingMemStoreSize = 0L;
     this.conf = null;
-    this.flushListener = null;
+    this.flushRequester = null;
     this.fs = null;
     this.memstoreFlushSize = 0L;
     this.log = null;
@@ -272,22 +272,19 @@ public class HRegion implements HeapSize
    * @param conf is global configuration settings.
    * @param regionInfo - HRegionInfo that describes the region
    * is new), then read them from the supplied path.
-   * @param flushListener an object that implements CacheFlushListener or null
-   * making progress to master -- otherwise master might think region deploy
-   * failed.  Can be null.
+   * @param flushRequester an object that implements {@link FlushRequester} or null
    *
    * @see HRegion#newHRegion(Path, HLog, FileSystem, Configuration, org.apache.hadoop.hbase.HRegionInfo, FlushRequester)
-
    */
   public HRegion(Path tableDir, HLog log, FileSystem fs, Configuration conf,
-      HRegionInfo regionInfo, FlushRequester flushListener) {
+      HRegionInfo regionInfo, FlushRequester flushRequester) {
     this.tableDir = tableDir;
     this.comparator = regionInfo.getComparator();
     this.log = log;
     this.fs = fs;
     this.conf = conf;
     this.regionInfo = regionInfo;
-    this.flushListener = flushListener;
+    this.flushRequester = flushRequester;
     this.threadWakeFrequency = conf.getLong(HConstants.THREAD_WAKE_FREQUENCY,
         10 * 1000);
     String encodedNameStr = this.regionInfo.getEncodedName();
@@ -1803,7 +1800,7 @@ public class HRegion implements HeapSize
   }
 
   private void requestFlush() {
-    if (this.flushListener == null) {
+    if (this.flushRequester == null) {
       return;
     }
     synchronized (writestate) {
@@ -1813,7 +1810,7 @@ public class HRegion implements HeapSize
       writestate.flushRequested = true;
     }
     // Make request outside of synchronize block; HBASE-818.
-    this.flushListener.request(this);
+    this.flushRequester.requestFlush(this);
     if (LOG.isDebugEnabled()) {
       LOG.debug("Flush requested on " + this);
     }
@@ -2508,20 +2505,41 @@ public class HRegion implements HeapSize
   }
 
   /**
-   * Convenience method to open a HRegion outside of an HRegionServer context.
+   * Open a Region.
    * @param info Info for region to be opened.
    * @param rootDir Root directory for HBase instance
-   * @param log HLog for region to use. This method will call
+   * @param wal HLog for region to use. This method will call
+   * HLog#setSequenceNumber(long) passing the result of the call to
+   * HRegion#getMinSequenceId() to ensure the log id is properly kept
+   * up.  HRegionStore does this every time it opens a new region.
+   * @param conf
+   * @return new HRegion
+   *
+   * @throws IOException
+   */
+  public static HRegion openHRegion(final HRegionInfo info, final HLog wal,
+      final Configuration conf)
+  throws IOException {
+    return openHRegion(info, wal, conf, null, null);
+  }
+
+  /**
+   * Open a Region.
+   * @param info Info for region to be opened.
+   * @param wal HLog for region to use. This method will call
    * HLog#setSequenceNumber(long) passing the result of the call to
    * HRegion#getMinSequenceId() to ensure the log id is properly kept
    * up.  HRegionStore does this every time it opens a new region.
    * @param conf
+   * @param flusher An interface we can request flushes against.
+   * @param reporter An interface we can report progress against.
    * @return new HRegion
    *
    * @throws IOException
    */
-  public static HRegion openHRegion(final HRegionInfo info, final Path rootDir,
-    final HLog log, final Configuration conf)
+  public static HRegion openHRegion(final HRegionInfo info, final HLog wal,
+    final Configuration conf, final FlushRequester flusher,
+    final Progressable reporter)
   throws IOException {
     if (LOG.isDebugEnabled()) {
       LOG.debug("Opening region: " + info);
@@ -2529,12 +2547,13 @@ public class HRegion implements HeapSize
     if (info == null) {
       throw new NullPointerException("Passed region info is null");
     }
-    HRegion r = HRegion.newHRegion(
-        HTableDescriptor.getTableDir(rootDir, info.getTableDesc().getName()),
-        log, FileSystem.get(conf), conf, info, null);
-    long seqid = r.initialize();
-    if (log != null) {
-      log.setSequenceNumber(seqid);
+    Path dir = HTableDescriptor.getTableDir(FSUtils.getRootDir(conf),
+      info.getTableDesc().getName());
+    HRegion r = HRegion.newHRegion(dir, wal, FileSystem.get(conf), conf, info,
+      flusher);
+    long seqid = r.initialize(reporter);
+    if (wal != null) {
+      wal.setSequenceNumber(seqid);
     }
     return r;
   }

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Fri Aug 13 21:49:31 2010
@@ -58,13 +58,14 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Chore;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HConstants.OperationStatusCode;
 import org.apache.hadoop.hbase.HMsg;
+import org.apache.hadoop.hbase.HMsg.Type;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.HServerAddress;
 import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.HServerLoad;
-import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.LocalHBaseCluster;
 import org.apache.hadoop.hbase.MasterAddressTracker;
@@ -74,8 +75,6 @@ import org.apache.hadoop.hbase.Stoppable
 import org.apache.hadoop.hbase.UnknownRowLockException;
 import org.apache.hadoop.hbase.UnknownScannerException;
 import org.apache.hadoop.hbase.YouAreDeadException;
-import org.apache.hadoop.hbase.HConstants.OperationStatusCode;
-import org.apache.hadoop.hbase.HMsg.Type;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
@@ -115,7 +114,6 @@ import org.apache.hadoop.hbase.zookeeper
 import org.apache.hadoop.io.MapWritable;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.net.DNS;
-import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.zookeeper.KeeperException;
 
@@ -124,7 +122,7 @@ import org.apache.zookeeper.KeeperExcept
  * the HMaster. There are many HRegionServers in a single HBase deployment.
  */
 public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
-    Runnable, RegionServerController {
+    Runnable, RegionServer {
   public static final Log LOG = LogFactory.getLog(HRegionServer.class);
   private static final HMsg REPORT_EXITING = new HMsg(Type.MSG_REPORT_EXITING);
   private static final HMsg REPORT_QUIESCED = new HMsg(Type.MSG_REPORT_QUIESCED);
@@ -159,7 +157,8 @@ public class HRegionServer implements HR
    * Map of regions currently being served by this region server. Key is the
    * encoded region name.
    */
-  protected final Map<String, HRegion> onlineRegions = new ConcurrentHashMap<String, HRegion>();
+  protected final Map<String, HRegion> onlineRegions =
+    new ConcurrentHashMap<String, HRegion>();
 
   protected final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
   private final LinkedBlockingQueue<HMsg> outboundMsgs = new LinkedBlockingQueue<HMsg>();
@@ -876,7 +875,7 @@ public class HRegionServer implements HR
         try {
           if (r != null && r.isMajorCompaction()) {
             // Queue a compaction. Will recognize if major is needed.
-            this.instance.compactSplitThread.compactionRequested(r, getName()
+            this.instance.compactSplitThread.requestCompaction(r, getName()
                 + " requests major compaction");
           }
         } catch (IOException e) {
@@ -1074,7 +1073,7 @@ public class HRegionServer implements HR
   }
 
   /** @return the HLog */
-  public HLog getLog() {
+  public HLog getWAL() {
     return this.hlog;
   }
 
@@ -1287,7 +1286,7 @@ public class HRegionServer implements HR
                 region.flushcache();
                 region.shouldSplit(true);
                 // force a compaction; split will be side-effect.
-                compactSplitThread.compactionRequested(region, e.msg.getType()
+                compactSplitThread.requestCompaction(region, e.msg.getType()
                     .name());
                 break;
 
@@ -1295,7 +1294,7 @@ public class HRegionServer implements HR
               case MSG_REGION_COMPACT:
                 // Compact a region
                 region = getRegion(info.getRegionName());
-                compactSplitThread.compactionRequested(region, e.msg
+                compactSplitThread.requestCompaction(region, e.msg
                     .isType(Type.MSG_REGION_MAJOR_COMPACT), e.msg.getType()
                     .name());
                 break;
@@ -1352,34 +1351,6 @@ public class HRegionServer implements HR
     }
   }
 
-  /*
-   * @param regionInfo RegionInfo for the Region we're to instantiate and
-   * initialize.
-   *
-   * @param wal Set into here the regions' seqid.
-   *
-   * @param reporter periodic callback
-   *
-   * @return
-   *
-   * @throws IOException
-   */
-  public HRegion instantiateRegion(final HRegionInfo regionInfo,
-      final HLog wal, Progressable reporter) throws IOException {
-    Path dir = HTableDescriptor.getTableDir(rootDir, regionInfo.getTableDesc()
-        .getName());
-    HRegion r = HRegion.newHRegion(dir, this.hlog, this.fs, conf, regionInfo,
-        this.cacheFlusher);
-    long seqid = r.initialize(reporter);
-    // If a wal and its seqid is < that of new region, use new regions seqid.
-    if (wal != null) {
-      if (seqid > wal.getSequenceNumber()) {
-        wal.setSequenceNumber(seqid);
-      }
-    }
-    return r;
-  }
-
   /** Called either when the master tells us to restart or from stop() */
   ArrayList<HRegion> closeAllRegions() {
     ArrayList<HRegion> regionsToClose = new ArrayList<HRegion>();
@@ -1400,12 +1371,8 @@ public class HRegionServer implements HR
       }
     }
     for (HRegion region : regionsToClose) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("closing region " + Bytes.toString(region.getRegionName()));
-      }
       try {
-        new CloseRegionHandler(this, region.getRegionInfo(), abortRequested)
-            .execute();
+        new CloseRegionHandler(this, region.getRegionInfo(), abortRequested).execute();
       } catch (Throwable e) {
         cleanup(e, "Error closing " + Bytes.toString(region.getRegionName()));
       }
@@ -1998,7 +1965,7 @@ public class HRegionServer implements HR
     // force a compaction, split will be side-effect
     // TODO: flush/compact/split refactor will make it trivial to do this
     // sync/async (and won't require us to do a compaction to split!)
-    compactSplitThread.compactionRequested(region, "User-triggered split");
+    compactSplitThread.requestCompaction(region, "User-triggered split");
   }
 
   @Override
@@ -2007,7 +1974,7 @@ public class HRegionServer implements HR
     HRegion region = getRegion(regionInfo.getRegionName());
     region.flushcache();
     region.shouldSplit(true);
-    compactSplitThread.compactionRequested(region, major, "User-triggered "
+    compactSplitThread.requestCompaction(region, major, "User-triggered "
         + (major ? "major " : "") + "compaction");
   }
 
@@ -2070,20 +2037,12 @@ public class HRegionServer implements HR
     }
   }
 
-  /**
-   * This method removes HRegion corresponding to hri from the Map of
-   * onlineRegions.
-   *
-   * @param hri
-   *          the HRegionInfo corresponding to the HRegion to-be-removed.
-   * @return the removed HRegion, or null if the HRegion was not in
-   *         onlineRegions.
-   */
-  public HRegion removeFromOnlineRegions(HRegionInfo hri) {
+  @Override
+  public HRegion removeFromOnlineRegions(final String encodedName) {
     this.lock.writeLock().lock();
     HRegion toReturn = null;
     try {
-      toReturn = onlineRegions.remove(Bytes.mapKey(hri.getRegionName()));
+      toReturn = onlineRegions.remove(encodedName);
     } finally {
       this.lock.writeLock().unlock();
     }
@@ -2111,12 +2070,8 @@ public class HRegionServer implements HR
     return sortedRegions;
   }
 
-  /**
-   * @param regionName
-   * @return HRegion for the passed encoded <code>regionName</code> or null if
-   *         named region is not member of the online regions.
-   */
-  public HRegion getOnlineRegion(final String encodedRegionName) {
+  @Override
+  public HRegion getFromOnlineRegions(final String encodedRegionName) {
     return onlineRegions.get(encodedRegionName);
   }
 
@@ -2126,7 +2081,7 @@ public class HRegionServer implements HR
    *         named region is not member of the online regions.
    */
   public HRegion getOnlineRegion(final byte[] regionName) {
-    return getOnlineRegion(HRegionInfo.encodeRegionName(regionName));
+    return getFromOnlineRegions(HRegionInfo.encodeRegionName(regionName));
   }
 
   /** @return the request count */
@@ -2489,8 +2444,8 @@ public class HRegionServer implements HR
   }
 
   @Override
-  public CompactSplitThread getCompactSplitThread() {
-    return compactSplitThread;
+  public CompactionRequestor getCompactionRequester() {
+    return this.compactSplitThread;
   }
 
   @Override

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java Fri Aug 13 21:49:31 2010
@@ -79,7 +79,7 @@ class LogRoller extends Thread implement
       rollLock.lock(); // FindBugs UL_UNRELEASED_LOCK_EXCEPTION_PATH
       try {
         this.lastrolltime = now;
-        byte [][] regionsToFlush = server.getLog().rollWriter();
+        byte [][] regionsToFlush = server.getWAL().rollWriter();
         if (regionsToFlush != null) {
           for (byte [] r: regionsToFlush) scheduleFlush(r);
         }
@@ -116,7 +116,7 @@ class LogRoller extends Thread implement
     if (r != null) {
       requester = this.server.getFlushRequester();
       if (requester != null) {
-        requester.request(r);
+        requester.requestFlush(r);
         scheduled = true;
       }
     }

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java Fri Aug 13 21:49:31 2010
@@ -164,7 +164,7 @@ class MemStoreFlusher extends Thread imp
     LOG.info(getName() + " exiting");
   }
 
-  public void request(HRegion r) {
+  public void requestFlush(HRegion r) {
     synchronized (regionsInQueue) {
       if (!regionsInQueue.containsKey(r)) {
         // This entry has no delay so it will be added at the top of the flush
@@ -212,7 +212,7 @@ class MemStoreFlusher extends Thread imp
           LOG.warn("Region " + region.getRegionNameAsString() + " has too many " +
             "store files; delaying flush up to " + this.blockingWaitTime + "ms");
         }
-        this.server.compactSplitThread.compactionRequested(region, getName());
+        this.server.compactSplitThread.requestCompaction(region, getName());
         // Put back on the queue.  Have it come back out of the queue
         // after a delay of this.blockingWaitTime / 100 ms.
         this.flushQueue.add(fqe.requeue(this.blockingWaitTime / 100));
@@ -247,7 +247,7 @@ class MemStoreFlusher extends Thread imp
     }
     try {
       if (region.flushcache()) {
-        server.compactSplitThread.compactionRequested(region, getName());
+        server.compactSplitThread.requestCompaction(region, getName());
       }
     } catch (DroppedSnapshotException ex) {
       // Cache flush can fail in a few places. If it fails in a critical
@@ -325,7 +325,7 @@ class MemStoreFlusher extends Thread imp
       regionsToCompact.add(biggestMemStoreRegion);
     }
     for (HRegion region : regionsToCompact) {
-      server.compactSplitThread.compactionRequested(region, getName());
+      server.compactSplitThread.requestCompaction(region, getName());
     }
   }
 

Added: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/OnlineRegions.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/OnlineRegions.java?rev=985377&view=auto
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/OnlineRegions.java (added)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/OnlineRegions.java Fri Aug 13 21:49:31 2010
@@ -0,0 +1,47 @@
+/**
+ * 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.regionserver;
+
+/**
+ * Interface to Map of online regions.  In the  Map, the key is the region's
+ * encoded name and the value is an {@link HRegion} instance.
+ */
+interface OnlineRegions {
+  /**
+   * Add to online regions.
+   * @param r
+   */
+  public void addToOnlineRegions(final HRegion r);
+
+  /**
+   * This method removes HRegion corresponding to hri from the Map of onlineRegions.
+   *
+   * @param encodedRegionName
+   * @return the removed HRegion, or null if the HRegion was not in onlineRegions.
+   */
+  public HRegion removeFromOnlineRegions(String encodedRegionName);
+
+  /**
+   * @param encodedRegionName
+   * @return HRegion for the passed encoded <code>encodedRegionName</code> or
+   * null if named region is not member of the online regions.
+   */
+  public HRegion getFromOnlineRegions(String encodedRegionName);
+}
\ No newline at end of file

Added: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java?rev=985377&view=auto
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java (added)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServer.java Fri Aug 13 21:49:31 2010
@@ -0,0 +1,47 @@
+/**
+ * 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.regionserver;
+
+import org.apache.hadoop.hbase.HServerInfo;
+import org.apache.hadoop.hbase.Server;
+import org.apache.hadoop.hbase.regionserver.wal.HLog;
+
+/**
+ * Interface implemented by {@link HRegionServer}
+ */
+public interface RegionServer extends Server, OnlineRegions {
+  public HLog getWAL();
+
+  /**
+   * @return Implementation of {@link CompactionRequestor} or null.
+   */
+  public CompactionRequestor getCompactionRequester();
+  
+  /**
+   * @return Implementation of {@link FlushRequester} or null.
+   */
+  public FlushRequester getFlushRequester();
+
+  /**
+   * Return data structure that has Server address and startcode.
+   * @return The HServerInfo for this RegionServer.
+   */
+  public HServerInfo getServerInfo();
+}
\ No newline at end of file

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java Fri Aug 13 21:49:31 2010
@@ -59,5 +59,4 @@ interface StoreFlusher {
    * @throws IOException
    */
   boolean commit() throws IOException;
-
 }

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseMetaHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseMetaHandler.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseMetaHandler.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseMetaHandler.java Fri Aug 13 21:49:31 2010
@@ -20,7 +20,7 @@
 package org.apache.hadoop.hbase.regionserver.handler;
 
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.regionserver.RegionServerController;
+import org.apache.hadoop.hbase.regionserver.RegionServer;
 
 /**
  * Handles closing of the root region on a region server.
@@ -28,7 +28,7 @@ import org.apache.hadoop.hbase.regionser
  * This is executed after receiving an CLOSE RPC from the master for root.
  */
 public class CloseMetaHandler extends CloseRegionHandler {
-  public CloseMetaHandler(RegionServerController server,
+  public CloseMetaHandler(RegionServer server,
       HRegionInfo regionInfo) {
     super(server, regionInfo, false, EventType.M2RS_CLOSE_META);
   }

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRegionHandler.java Fri Aug 13 21:49:31 2010
@@ -26,7 +26,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.executor.EventHandler;
 import org.apache.hadoop.hbase.regionserver.HRegion;
-import org.apache.hadoop.hbase.regionserver.RegionServerController;
+import org.apache.hadoop.hbase.regionserver.RegionServer;
 import org.apache.hadoop.hbase.zookeeper.ZKAssign;
 import org.apache.zookeeper.KeeperException;
 
@@ -38,23 +38,23 @@ import org.apache.zookeeper.KeeperExcept
 public class CloseRegionHandler extends EventHandler {
   private static final Log LOG = LogFactory.getLog(CloseRegionHandler.class);
 
-  private final RegionServerController server;
+  private final RegionServer server;
 
   private final HRegionInfo regionInfo;
 
   private final boolean abort;
 
-  public CloseRegionHandler(RegionServerController server,
+  public CloseRegionHandler(RegionServer server,
       HRegionInfo regionInfo) {
     this(server, regionInfo, false);
   }
 
-  public CloseRegionHandler(RegionServerController server,
+  public CloseRegionHandler(RegionServer server,
       HRegionInfo regionInfo, boolean abort) {
     this(server, regionInfo, abort, EventType.M2RS_CLOSE_REGION);
   }
 
-  protected CloseRegionHandler(RegionServerController server,
+  protected CloseRegionHandler(RegionServer server,
       HRegionInfo regionInfo, boolean abort, EventType eventType) {
     super(server, eventType);
     this.server = server;
@@ -68,17 +68,13 @@ public class CloseRegionHandler extends 
 
   @Override
   public void process() {
-    LOG.debug("Processing close region of " +
-        regionInfo.getRegionNameAsString());
-
-    String regionName = regionInfo.getEncodedName();
-
+    String name = regionInfo.getRegionNameAsString();
+    LOG.debug("Processing close of " + name);
+    String encodedRegionName = regionInfo.getEncodedName();
     // Check that this region is being served here
-    HRegion region = server.getOnlineRegion(regionName);
+    HRegion region = server.getFromOnlineRegions(encodedRegionName);
     if(region == null) {
-      LOG.warn("Received a CLOSE for the region " +
-          regionInfo.getRegionNameAsString() + " but not currently serving " +
-          "this region");
+      LOG.warn("Received CLOSE for region " + name + " but currently not serving");
       return;
     }
 
@@ -101,13 +97,13 @@ public class CloseRegionHandler extends 
     try {
       // TODO: If we need to keep updating CLOSING stamp to prevent against
       //       a timeout if this is long-running, need to spin up a thread?
-      server.removeFromOnlineRegions(regionInfo);
+      server.removeFromOnlineRegions(regionInfo.getEncodedName());
       region.close(abort);
     } catch (IOException e) {
-      LOG.error("IOException closing region for " + regionInfo);
-      LOG.debug("Deleting transition node that was in CLOSING");
+      LOG.error("IOException closing region for " + regionInfo +
+        "; deleting transition node that was in CLOSING");
       try {
-        ZKAssign.deleteClosingNode(server.getZooKeeper(), regionName);
+        ZKAssign.deleteClosingNode(server.getZooKeeper(), encodedRegionName);
       } catch (KeeperException e1) {
         LOG.error("Error deleting CLOSING node");
         return;
@@ -119,14 +115,14 @@ public class CloseRegionHandler extends 
     try {
       if(ZKAssign.transitionNodeClosed(server.getZooKeeper(), regionInfo,
           server.getServerName(), expectedVersion) == -1) {
-        LOG.warn("Completed the OPEN of a region but when transitioning from " +
-            " OPENING to OPENED got a version mismatch, someone else clashed " +
+        LOG.warn("Completed the CLOSE of a region but when transitioning from " +
+            " CLOSING to CLOSED got a version mismatch, someone else clashed " +
             "so now unassigning");
         region.close();
         return;
       }
     } catch (KeeperException e) {
-      LOG.error("Failed transitioning node from OPENING to OPENED", e);
+      LOG.error("Failed transitioning node from CLOSING to CLOSED", e);
       return;
     } catch (IOException e) {
       LOG.error("Failed to close region after failing to transition", e);
@@ -134,8 +130,6 @@ public class CloseRegionHandler extends 
     }
 
     // Done!  Successful region open
-    LOG.debug("Completed region close and successfully transitioned node to " +
-        "CLOSED for region " + region.getRegionNameAsString() + " (" +
-        regionName + ")");
+    LOG.debug("Closed region " + region.getRegionNameAsString());
   }
 }

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRootHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRootHandler.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRootHandler.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/CloseRootHandler.java Fri Aug 13 21:49:31 2010
@@ -20,7 +20,7 @@
 package org.apache.hadoop.hbase.regionserver.handler;
 
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.regionserver.RegionServerController;
+import org.apache.hadoop.hbase.regionserver.RegionServer;
 
 /**
  * Handles closing of the root region on a region server.
@@ -28,7 +28,7 @@ import org.apache.hadoop.hbase.regionser
  * This is executed after receiving an CLOSE RPC from the master for root.
  */
 public class CloseRootHandler extends CloseRegionHandler {
-  public CloseRootHandler(RegionServerController server,
+  public CloseRootHandler(RegionServer server,
       HRegionInfo regionInfo) {
     super(server, regionInfo, false, EventType.M2RS_CLOSE_ROOT);
   }

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenMetaHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenMetaHandler.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenMetaHandler.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenMetaHandler.java Fri Aug 13 21:49:31 2010
@@ -21,7 +21,7 @@ package org.apache.hadoop.hbase.regionse
 
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
-import org.apache.hadoop.hbase.regionserver.RegionServerController;
+import org.apache.hadoop.hbase.regionserver.RegionServer;
 
 /**
  * Handles opening of a meta region on a region server.
@@ -29,7 +29,7 @@ import org.apache.hadoop.hbase.regionser
  * This is executed after receiving an OPEN RPC from the master for meta.
  */
 public class OpenMetaHandler extends OpenRegionHandler {
-  public OpenMetaHandler(RegionServerController server,
+  public OpenMetaHandler(RegionServer server,
       CatalogTracker catalogTracker, HRegionInfo regionInfo) {
     super(server, catalogTracker, regionInfo, EventType.M2RS_OPEN_META);
   }

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java Fri Aug 13 21:49:31 2010
@@ -30,7 +30,7 @@ import org.apache.hadoop.hbase.catalog.M
 import org.apache.hadoop.hbase.catalog.RootLocationEditor;
 import org.apache.hadoop.hbase.executor.EventHandler;
 import org.apache.hadoop.hbase.regionserver.HRegion;
-import org.apache.hadoop.hbase.regionserver.RegionServerController;
+import org.apache.hadoop.hbase.regionserver.RegionServer;
 import org.apache.hadoop.hbase.zookeeper.ZKAssign;
 import org.apache.hadoop.util.Progressable;
 import org.apache.zookeeper.KeeperException;
@@ -44,18 +44,18 @@ import org.apache.zookeeper.KeeperExcept
 public class OpenRegionHandler extends EventHandler {
   private static final Log LOG = LogFactory.getLog(OpenRegionHandler.class);
 
-  private final RegionServerController server;
+  private final RegionServer server;
 
   private final CatalogTracker catalogTracker;
 
   private final HRegionInfo regionInfo;
 
-  public OpenRegionHandler(RegionServerController server,
+  public OpenRegionHandler(RegionServer server,
       CatalogTracker catalogTracker, HRegionInfo regionInfo) {
     this(server, catalogTracker, regionInfo, EventType.M2RS_OPEN_REGION);
   }
 
-  protected OpenRegionHandler(RegionServerController server,
+  protected OpenRegionHandler(RegionServer server,
       CatalogTracker catalogTracker, HRegionInfo regionInfo,
       EventType eventType) {
     super(server, eventType);
@@ -70,21 +70,19 @@ public class OpenRegionHandler extends E
 
   @Override
   public void process() {
-    LOG.debug("Processing open region of " +
-        regionInfo.getRegionNameAsString());
+    LOG.debug("Processing open of " + regionInfo.getRegionNameAsString());
+    final String encodedName = regionInfo.getEncodedName();
 
-    final String regionName = regionInfo.getEncodedName();
-
-    // Previously we would check for root region availability (but only that it
+    // TODO: Previously we would check for root region availability (but only that it
     // was initially available, does not check if it later went away)
     // Do we need to wait on both root and meta to be available to open a region
     // now since we edit meta?
 
     // Check that this region is not already online
-    HRegion region = server.getOnlineRegion(regionName);
-    if(region != null) {
-      LOG.warn("Attemping to open region " + regionInfo.getRegionNameAsString()
-          + " but it's already online on this server");
+    HRegion region = server.getFromOnlineRegions(encodedName);
+    if (region != null) {
+      LOG.warn("Attempting open of " + regionInfo.getRegionNameAsString() +
+        " but it's already online on this server");
       return;
     }
 
@@ -100,7 +98,7 @@ public class OpenRegionHandler extends E
       }
     } catch (KeeperException e) {
       LOG.error("Error transitioning node from OFFLINE to OPENING for region " +
-      		regionName, e);
+        encodedName, e);
       return;
     }
 
@@ -108,7 +106,8 @@ public class OpenRegionHandler extends E
     final AtomicInteger openingInteger = new AtomicInteger(openingVersion);
     try {
       // Instantiate the region.  This also periodically updates OPENING.
-      region = server.instantiateRegion(regionInfo, server.getLog(),
+      region = HRegion.openHRegion(regionInfo, server.getWAL(),
+          server.getConfiguration(), server.getFlushRequester(),
           new Progressable() {
             public void progress() {
               try {
@@ -125,8 +124,8 @@ public class OpenRegionHandler extends E
             }
       });
     } catch (IOException e) {
-      LOG.error("IOException instantiating region for " + regionInfo);
-      LOG.debug("Resetting state of transition node from OPENING to OFFLINE");
+      LOG.error("IOException instantiating region for " + regionInfo +
+        "; resetting state of transition node from OPENING to OFFLINE");
       try {
         // TODO: We should rely on the master timing out OPENING instead of this
         ZKAssign.forceNodeOffline(server.getZooKeeper(), regionInfo,
@@ -138,8 +137,7 @@ public class OpenRegionHandler extends E
       return;
     }
 
-    // Re-transition node to OPENING again to verify someone else has not
-    // stomped on us
+    // Re-transition node to OPENING again to verify no one has stomped on us
     openingVersion = openingInteger.get();
     try {
       if((openingVersion = ZKAssign.retransitionNodeOpening(
@@ -159,13 +157,9 @@ public class OpenRegionHandler extends E
       return;
     }
 
-    LOG.debug("Re-transitioned node to OPENING, completing OPEN by adding to " +
-        "online regions, doing on-open checks, and updating ROOT or META " +
-        "for region " + region.getRegionNameAsString());
-
     // Do checks to see if we need to compact (references or too many files)
     if(region.hasReferences() || region.hasTooManyStoreFiles()) {
-      server.getCompactSplitThread().compactionRequested(region,
+      server.getCompactionRequester().requestCompaction(region,
           region.hasReferences() ? "Region has references on open" :
                                    "Region has too many store files");
     }
@@ -213,7 +207,6 @@ public class OpenRegionHandler extends E
     }
 
     // Done!  Successful region open
-    LOG.debug("Completed region open and successfully transitioned node to " +
-        "OPENED for region " + region.getRegionNameAsString());
+    LOG.debug("Opened " + region.getRegionNameAsString());
   }
 }
\ No newline at end of file

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRootHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRootHandler.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRootHandler.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRootHandler.java Fri Aug 13 21:49:31 2010
@@ -21,7 +21,7 @@ package org.apache.hadoop.hbase.regionse
 
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
-import org.apache.hadoop.hbase.regionserver.RegionServerController;
+import org.apache.hadoop.hbase.regionserver.RegionServer;
 
 /**
  * Handles opening of the root region on a region server.
@@ -29,7 +29,7 @@ import org.apache.hadoop.hbase.regionser
  * This is executed after receiving an OPEN RPC from the master for root.
  */
 public class OpenRootHandler extends OpenRegionHandler {
-  public OpenRootHandler(RegionServerController server,
+  public OpenRootHandler(RegionServer server,
       CatalogTracker catalogTracker, HRegionInfo regionInfo) {
     super(server, catalogTracker, regionInfo, EventType.M2RS_OPEN_ROOT);
   }

Modified: hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java (original)
+++ hbase/branches/0.90_master_rewrite/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java Fri Aug 13 21:49:31 2010
@@ -42,7 +42,7 @@ public class JVMClusterUtil {
     private final HRegionServer regionServer;
 
     public RegionServerThread(final HRegionServer r, final int index) {
-      super(r, "RegionServer:" + index);
+      super(r, "RegionServer:" + index + ";" + r.getServerName());
       this.regionServer = r;
     }
 

Modified: hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java (original)
+++ hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java Fri Aug 13 21:49:31 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.hadoop.hbase.master;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;

Modified: hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java (original)
+++ hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java Fri Aug 13 21:49:31 2010
@@ -135,7 +135,7 @@ public class TestLogRolling extends HBas
     // When the META table can be opened, the region servers are running
     new HTable(conf, HConstants.META_TABLE_NAME);
     this.server = cluster.getRegionServerThreads().get(0).getRegionServer();
-    this.log = server.getLog();
+    this.log = server.getWAL();
 
     // Create the test table and open it
     HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -216,7 +216,7 @@ public class TestLogRolling extends HBas
     // When the META table can be opened, the region servers are running
     new HTable(conf, HConstants.META_TABLE_NAME);
     this.server = cluster.getRegionServer(0);
-    this.log = server.getLog();
+    this.log = server.getWAL();
     
     assertTrue("Need HDFS-826 for this test", log.canGetCurReplicas());
     // don't run this test without append support (HDFS-200 & HDFS-142)

Modified: hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java?rev=985377&r1=985376&r2=985377&view=diff
==============================================================================
--- hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java (original)
+++ hbase/branches/0.90_master_rewrite/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java Fri Aug 13 21:49:31 2010
@@ -345,7 +345,7 @@ public class TestWALReplay {
     private HRegion r;
 
     @Override
-    public void request(HRegion region) {
+    public void requestFlush(HRegion region) {
       count++;
       try {
         r.flushcache();



Mime
View raw message