Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java (revision 599256) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java (working copy) @@ -742,6 +742,10 @@ throw new RuntimeException("Putting into msgQueue was " + "interrupted.", e); } + if (msgs[i].getMsg() == HMsg.MSG_REGION_OPEN) { + outboundMsgs.add(new HMsg(HMsg.MSG_REPORT_PROCESS_OPEN, + msgs[i].getRegionInfo())); + } } } } @@ -1161,8 +1165,8 @@ } finally { this.lock.writeLock().unlock(); } + reportOpen(region); } - reportOpen(region); } void closeRegion(final HRegionInfo hri, final boolean reportWhenCompleted) Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java (revision 599256) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java (working copy) @@ -1460,10 +1460,25 @@ // Get reports on what the RegionServer did. for (int i = 0; i < incomingMsgs.length; i++) { + if (LOG.isDebugEnabled()) { + LOG.debug("Received " + incomingMsgs[i].toString() + "from " + + serverName); + } HRegionInfo region = incomingMsgs[i].getRegionInfo(); switch (incomingMsgs[i].getMsg()) { + case HMsg.MSG_REPORT_PROCESS_OPEN: + synchronized (this.assignAttempts) { + // Region server has acknowledged request to open region. + // Extend region open time by 1/2 max region open time. + assignAttempts.put(region.getRegionName(), + Long.valueOf(assignAttempts.get( + region.getRegionName()).longValue() + + (this.maxRegionOpenTime / 2))); + } + break; + case HMsg.MSG_REPORT_OPEN: HRegionInfo regionInfo = unassignedRegions.get(region.getRegionName()); @@ -1484,9 +1499,7 @@ } else { LOG.info(info.getServerAddress().toString() + " serving " + region.getRegionName()); - // Remove from unassigned list so we don't assign it to someone else - this.unassignedRegions.remove(region.getRegionName()); - this.assignAttempts.remove(region.getRegionName()); + if (region.getRegionName().compareTo( HRegionInfo.rootRegionInfo.getRegionName()) == 0) { // Store the Root Region location (in memory) @@ -1495,21 +1508,23 @@ new HServerAddress(info.getServerAddress())); this.rootRegionLocation.notifyAll(); } - break; - } + } else { + // Note that the table has been assigned and is waiting for the meta + // table to be updated. - // Note that the table has been assigned and is waiting for the meta - // table to be updated. + pendingRegions.add(region.getRegionName()); - pendingRegions.add(region.getRegionName()); + // Queue up an update to note the region location. - // Queue up an update to note the region location. - - try { - msgQueue.put(new ProcessRegionOpen(info, region)); - } catch (InterruptedException e) { - throw new RuntimeException("Putting into msgQueue was interrupted.", e); - } + try { + msgQueue.put(new ProcessRegionOpen(info, region)); + } catch (InterruptedException e) { + throw new RuntimeException("Putting into msgQueue was interrupted.", e); + } + } + // Remove from unassigned list so we don't assign it to someone else + this.unassignedRegions.remove(region.getRegionName()); + this.assignAttempts.remove(region.getRegionName()); } break; Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMsg.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMsg.java (revision 599256) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMsg.java (working copy) @@ -53,6 +53,9 @@ /** region server is no longer serving the specified region */ public static final byte MSG_REPORT_CLOSE = 101; + + /** region server is processing open request */ + public static final byte MSG_REPORT_PROCESS_OPEN = 102; /** * region server split the region associated with this message. @@ -142,6 +145,10 @@ message.append("MSG_REGION_CLOSE_WITHOUT_REPORT : "); break; + case MSG_REPORT_PROCESS_OPEN: + message.append("MSG_REPORT_PROCESS_OPEN : "); + break; + case MSG_REPORT_OPEN: message.append("MSG_REPORT_OPEN : "); break;