HBASE-4153 apply the correct patch - v4
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1173811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7e6a6538b4
commit
76ba002ef7
|
@ -1311,6 +1311,8 @@ public class HBaseAdmin implements Abortable, Closeable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tries to assign a region. Region could be reassigned to the same server.
|
||||
*
|
||||
* @param regionName
|
||||
* Region name to assign.
|
||||
* @param force
|
||||
|
|
|
@ -64,7 +64,6 @@ import org.apache.hadoop.hbase.regionserver.RegionAlreadyInTransitionException;
|
|||
import org.apache.hadoop.hbase.regionserver.RegionOpeningState;
|
||||
import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
|
||||
import org.apache.hadoop.hbase.master.RegionPlan;
|
||||
import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State;
|
||||
import org.apache.hadoop.hbase.master.handler.ClosedRegionHandler;
|
||||
import org.apache.hadoop.hbase.master.handler.DisableTableHandler;
|
||||
import org.apache.hadoop.hbase.master.handler.EnableTableHandler;
|
||||
|
@ -164,9 +163,6 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
|
||||
//Thread pool executor service for timeout monitor
|
||||
private java.util.concurrent.ExecutorService threadPoolExecutorService;
|
||||
//String to compare the RegionsAlreadyInTransition from RS
|
||||
private static final String ALREADY_TRANSITIONING = "for the region we are " +
|
||||
"already trying to ";
|
||||
|
||||
/**
|
||||
* Constructs a new assignment manager.
|
||||
|
@ -1457,13 +1453,10 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
if (t instanceof RemoteException) {
|
||||
t = ((RemoteException) t).unwrapRemoteException();
|
||||
if (t instanceof RegionAlreadyInTransitionException) {
|
||||
String errorMsg = "Failed assignment of " +
|
||||
state.getRegion().getRegionNameAsString() + " to " +
|
||||
plan.getDestination() + " as the region was already " +
|
||||
extractRegionState((RegionAlreadyInTransitionException) t) +
|
||||
" in the RS " +plan.getDestination();
|
||||
String errorMsg = "Failed assignment in: " + plan.getDestination()
|
||||
+ " due to " + t.getMessage();
|
||||
LOG.error(errorMsg, t);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
LOG.warn("Failed assignment of " +
|
||||
state.getRegion().getRegionNameAsString() + " to " +
|
||||
|
@ -1484,13 +1477,6 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
}
|
||||
}
|
||||
|
||||
private State extractRegionState(RegionAlreadyInTransitionException t) {
|
||||
RegionState.State state = t.getMessage().contains(
|
||||
ALREADY_TRANSITIONING + "OPEN") ? RegionState.State.PENDING_OPEN
|
||||
: RegionState.State.PENDING_CLOSE;
|
||||
return state;
|
||||
}
|
||||
|
||||
private void debugLog(HRegionInfo region, String string) {
|
||||
if (region.isMetaTable() || region.isRootRegion()) {
|
||||
LOG.info(string);
|
||||
|
|
|
@ -44,7 +44,6 @@ import java.util.SortedMap;
|
|||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
@ -101,7 +100,6 @@ import org.apache.hadoop.hbase.filter.WritableByteArrayComparable;
|
|||
import org.apache.hadoop.hbase.io.hfile.BlockCache;
|
||||
import org.apache.hadoop.hbase.io.hfile.BlockCacheColumnFamilySummary;
|
||||
import org.apache.hadoop.hbase.io.hfile.CacheStats;
|
||||
import org.apache.hadoop.hbase.io.hfile.LruBlockCache;
|
||||
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol;
|
||||
import org.apache.hadoop.hbase.ipc.HBaseRPC;
|
||||
import org.apache.hadoop.hbase.ipc.HBaseRPCErrorHandler;
|
||||
|
@ -313,13 +311,10 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
|
||||
/*
|
||||
* Strings to be used in forming the exception message for
|
||||
* RegionsAlreadyInTransitionException. The below strings combination
|
||||
* is used to extract the status in the master.
|
||||
* RegionsAlreadyInTransitionException.
|
||||
*/
|
||||
private static final String ALREADY_TRANSITIONING = "for the region we are already trying to ";
|
||||
private static final String RECEIVED = " received ";
|
||||
private static final String OPEN = "OPEN ";
|
||||
private static final String CLOSE = "CLOSE ";
|
||||
private static final String OPEN = "OPEN";
|
||||
private static final String CLOSE = "CLOSE";
|
||||
|
||||
/**
|
||||
* Starts a HRegionServer at the default location
|
||||
|
@ -2367,7 +2362,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
public RegionOpeningState openRegion(HRegionInfo region, int versionOfOfflineNode)
|
||||
throws IOException {
|
||||
checkOpen();
|
||||
checkIfRegionInTransition(region,OPEN);
|
||||
checkIfRegionInTransition(region, OPEN);
|
||||
HRegion onlineRegion = this.getFromOnlineRegions(region.getEncodedName());
|
||||
if (null != onlineRegion) {
|
||||
LOG.warn("Attempted open of " + region.getEncodedName()
|
||||
|
@ -2395,23 +2390,17 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
|
||||
private void checkIfRegionInTransition(HRegionInfo region,
|
||||
String currentAction) throws RegionAlreadyInTransitionException {
|
||||
|
||||
byte[] encodedName = region.getEncodedNameAsBytes();
|
||||
if (this.regionsInTransitionInRS.containsKey(encodedName)) {
|
||||
boolean openAction = this.regionsInTransitionInRS.get(encodedName);
|
||||
// The below exception message will be used in master.
|
||||
throw new RegionAlreadyInTransitionException(getExceptionMessage(region,
|
||||
encodedName, currentAction));
|
||||
throw new RegionAlreadyInTransitionException("Received:" + currentAction +
|
||||
" for the region:" + region.getRegionNameAsString() +
|
||||
" ,which we are already trying to " +
|
||||
(openAction ? OPEN : CLOSE)+ ".");
|
||||
}
|
||||
}
|
||||
|
||||
private String getExceptionMessage(HRegionInfo region, byte[] encodedName,
|
||||
String receivedAction) {
|
||||
boolean openAction = this.regionsInTransitionInRS.get(encodedName);
|
||||
return REGIONSERVER + ":" + this.getServerName() + RECEIVED
|
||||
+ receivedAction + ALREADY_TRANSITIONING + (openAction ? OPEN : CLOSE)
|
||||
+ "; " + region.getRegionNameAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@QosPriority(priority=HIGH_QOS)
|
||||
public void openRegions(List<HRegionInfo> regions)
|
||||
|
|
|
@ -30,4 +30,5 @@ public class RegionAlreadyInTransitionException extends IOException {
|
|||
public RegionAlreadyInTransitionException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,4 +78,5 @@ public interface RegionServerServices extends OnlineRegions {
|
|||
* @return map of regions in transition in this RS
|
||||
*/
|
||||
public ConcurrentSkipListMap<byte[], Boolean> getRegionsInTransitionInRS();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ import org.junit.Before;
|
|||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,9 +19,7 @@ package org.apache.hadoop.hbase.regionserver.handler;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
|
@ -135,10 +133,10 @@ class MockRegionServerServices implements RegionServerServices {
|
|||
public boolean isStopped() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
}
@Override
|
||||
public boolean isAborted() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class TestOpenRegionHandler {
|
|||
@Test
|
||||
public void testFailedOpenRegion() throws Exception {
|
||||
Server server = new MockServer(HTU);
|
||||
RegionServerServices rsServices = new MockRegionServerServices();
|
||||
RegionServerServices rsServices = Mockito.mock(RegionServerServices.class);
|
||||
|
||||
// Create it OFFLINE, which is what it expects
|
||||
ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());
|
||||
|
@ -157,7 +157,7 @@ public class TestOpenRegionHandler {
|
|||
@Test
|
||||
public void testFailedUpdateMeta() throws Exception {
|
||||
Server server = new MockServer(HTU);
|
||||
RegionServerServices rsServices = new MockRegionServerServices();
|
||||
RegionServerServices rsServices = Mockito.mock(RegionServerServices.class);
|
||||
|
||||
// Create it OFFLINE, which is what it expects
|
||||
ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());
|
||||
|
|
Loading…
Reference in New Issue