HBASE-3022 Change format of enum messages in o.a.h.h.executor package

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@999660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-09-21 21:44:21 +00:00
parent 14d8fb2ab7
commit ffedf2c58e
26 changed files with 102 additions and 85 deletions

View File

@ -922,6 +922,7 @@ Release 0.21.0 - Unreleased
HBASE-2941 port HADOOP-6713 - threading scalability for RPC reads - to HBase
HBASE-2782 QOS for META table access
HBASE-3017 More log pruning
HBASE-3022 Change format of enum messages in o.a.h.h.executor package
NEW FEATURES
HBASE-1961 HBase EC2 scripts

View File

@ -100,31 +100,31 @@ public abstract class EventHandler implements Runnable, Comparable<Runnable> {
public enum EventType {
// Messages originating from RS (NOTE: there is NO direct communication from
// RS to Master). These are a result of RS updates into ZK.
RS2ZK_REGION_CLOSING (1), // RS is in process of closing a region
RS2ZK_REGION_CLOSED (2), // RS has finished closing a region
RS2ZK_REGION_OPENING (3), // RS is in process of opening a region
RS2ZK_REGION_OPENED (4), // RS has finished opening a region
RS_ZK_REGION_CLOSING (1), // RS is in process of closing a region
RS_ZK_REGION_CLOSED (2), // RS has finished closing a region
RS_ZK_REGION_OPENING (3), // RS is in process of opening a region
RS_ZK_REGION_OPENED (4), // RS has finished opening a region
// Messages originating from Master to RS
M2RS_OPEN_REGION (20), // Master asking RS to open a region
M2RS_OPEN_ROOT (21), // Master asking RS to open root
M2RS_OPEN_META (22), // Master asking RS to open meta
M2RS_CLOSE_REGION (23), // Master asking RS to close a region
M2RS_CLOSE_ROOT (24), // Master asking RS to close root
M2RS_CLOSE_META (25), // Master asking RS to close meta
M_RS_OPEN_REGION (20), // Master asking RS to open a region
M_RS_OPEN_ROOT (21), // Master asking RS to open root
M_RS_OPEN_META (22), // Master asking RS to open meta
M_RS_CLOSE_REGION (23), // Master asking RS to close a region
M_RS_CLOSE_ROOT (24), // Master asking RS to close root
M_RS_CLOSE_META (25), // Master asking RS to close meta
// Messages originating from Client to Master
C2M_DELETE_TABLE (40), // Client asking Master to delete a table
C2M_DISABLE_TABLE (41), // Client asking Master to disable a table
C2M_ENABLE_TABLE (42), // Client asking Master to enable a table
C2M_MODIFY_TABLE (43), // Client asking Master to modify a table
C2M_ADD_FAMILY (44), // Client asking Master to add family to table
C2M_DELETE_FAMILY (45), // Client asking Master to delete family of table
C2M_MODIFY_FAMILY (46), // Client asking Master to modify family of table
C_M_DELETE_TABLE (40), // Client asking Master to delete a table
C_M_DISABLE_TABLE (41), // Client asking Master to disable a table
C_M_ENABLE_TABLE (42), // Client asking Master to enable a table
C_M_MODIFY_TABLE (43), // Client asking Master to modify a table
C_M_ADD_FAMILY (44), // Client asking Master to add family to table
C_M_DELETE_FAMILY (45), // Client asking Master to delete family of table
C_M_MODIFY_FAMILY (46), // Client asking Master to modify family of table
// Updates from master to ZK. This is done by the master and there is
// nothing to process by either Master or RS
M2ZK_REGION_OFFLINE (50), // Master adds this region as offline in ZK
M_ZK_REGION_OFFLINE (50), // Master adds this region as offline in ZK
// Master controlled events to be executed on the master
M_SERVER_SHUTDOWN (70); // Master is processing shutdown of a RS

View File

@ -106,39 +106,39 @@ public class ExecutorService {
switch(type) {
// Master executor services
case RS2ZK_REGION_CLOSED:
case RS_ZK_REGION_CLOSED:
return ExecutorType.MASTER_CLOSE_REGION;
case RS2ZK_REGION_OPENED:
case RS_ZK_REGION_OPENED:
return ExecutorType.MASTER_OPEN_REGION;
case M_SERVER_SHUTDOWN:
return ExecutorType.MASTER_SERVER_OPERATIONS;
case C2M_DELETE_TABLE:
case C2M_DISABLE_TABLE:
case C2M_ENABLE_TABLE:
case C2M_MODIFY_TABLE:
case C_M_DELETE_TABLE:
case C_M_DISABLE_TABLE:
case C_M_ENABLE_TABLE:
case C_M_MODIFY_TABLE:
return ExecutorType.MASTER_TABLE_OPERATIONS;
// RegionServer executor services
case M2RS_OPEN_REGION:
case M_RS_OPEN_REGION:
return ExecutorType.RS_OPEN_REGION;
case M2RS_OPEN_ROOT:
case M_RS_OPEN_ROOT:
return ExecutorType.RS_OPEN_ROOT;
case M2RS_OPEN_META:
case M_RS_OPEN_META:
return ExecutorType.RS_OPEN_META;
case M2RS_CLOSE_REGION:
case M_RS_CLOSE_REGION:
return ExecutorType.RS_CLOSE_REGION;
case M2RS_CLOSE_ROOT:
case M_RS_CLOSE_ROOT:
return ExecutorType.RS_CLOSE_ROOT;
case M2RS_CLOSE_META:
case M_RS_CLOSE_META:
return ExecutorType.RS_CLOSE_META;
default:

View File

@ -33,7 +33,6 @@ import java.util.NavigableMap;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -190,7 +189,7 @@ public class AssignmentManager extends ZooKeeperListener {
MetaReader.getRegion(catalogTracker, data.getRegionName()).getFirst();
String encodedName = regionInfo.getEncodedName();
switch(data.getEventType()) {
case RS2ZK_REGION_CLOSING:
case RS_ZK_REGION_CLOSING:
// Just insert region into RIT.
// If this never updates the timeout will trigger new assignment
regionsInTransition.put(encodedName,
@ -198,7 +197,7 @@ public class AssignmentManager extends ZooKeeperListener {
data.getStamp()));
break;
case RS2ZK_REGION_CLOSED:
case RS_ZK_REGION_CLOSED:
// Region is closed, insert into RIT and handle it
regionsInTransition.put(encodedName,
new RegionState(regionInfo, RegionState.State.CLOSED,
@ -206,7 +205,7 @@ public class AssignmentManager extends ZooKeeperListener {
new ClosedRegionHandler(master, this, data, regionInfo).process();
break;
case RS2ZK_REGION_OPENING:
case RS_ZK_REGION_OPENING:
// Just insert region into RIT
// If this never updates the timeout will trigger new assignment
regionsInTransition.put(encodedName,
@ -214,7 +213,7 @@ public class AssignmentManager extends ZooKeeperListener {
data.getStamp()));
break;
case RS2ZK_REGION_OPENED:
case RS_ZK_REGION_OPENED:
// Region is opened, insert into RIT and handle it
regionsInTransition.put(encodedName,
new RegionState(regionInfo, RegionState.State.OPENING,
@ -250,11 +249,11 @@ public class AssignmentManager extends ZooKeeperListener {
", server=" + data.getServerName() + ", region=" + prettyPrintedRegionName);
RegionState regionState = regionsInTransition.get(encodedName);
switch(data.getEventType()) {
case M2ZK_REGION_OFFLINE:
case M_ZK_REGION_OFFLINE:
// Nothing to do.
break;
case RS2ZK_REGION_CLOSING:
case RS_ZK_REGION_CLOSING:
// Should see CLOSING after we have asked it to CLOSE or additional
// times after already being in state of CLOSING
if (regionState == null ||
@ -269,7 +268,7 @@ public class AssignmentManager extends ZooKeeperListener {
regionState.update(RegionState.State.CLOSING, data.getStamp());
break;
case RS2ZK_REGION_CLOSED:
case RS_ZK_REGION_CLOSED:
// Should see CLOSED after CLOSING but possible after PENDING_CLOSE
if (regionState == null ||
(!regionState.isPendingClose() && !regionState.isClosing())) {
@ -287,7 +286,7 @@ public class AssignmentManager extends ZooKeeperListener {
this, data, regionState.getRegion()));
break;
case RS2ZK_REGION_OPENING:
case RS_ZK_REGION_OPENING:
// Should see OPENING after we have asked it to OPEN or additional
// times after already being in state of OPENING
if(regionState == null ||
@ -303,7 +302,7 @@ public class AssignmentManager extends ZooKeeperListener {
regionState.update(RegionState.State.OPENING, data.getStamp());
break;
case RS2ZK_REGION_OPENED:
case RS_ZK_REGION_OPENED:
// Should see OPENED after OPENING but possible after PENDING_OPEN
if(regionState == null ||
(!regionState.isPendingOpen() && !regionState.isOpening())) {

View File

@ -63,7 +63,7 @@ public class ClosedRegionHandler extends EventHandler implements TotesHRegionInf
public ClosedRegionHandler(Server server,
AssignmentManager assignmentManager, RegionTransitionData data,
HRegionInfo regionInfo) {
super(server, EventType.RS2ZK_REGION_CLOSED);
super(server, EventType.RS_ZK_REGION_CLOSED);
this.assignmentManager = assignmentManager;
this.data = data;
this.regionInfo = regionInfo;

View File

@ -34,7 +34,7 @@ public class DeleteTableHandler extends TableEventHandler {
public DeleteTableHandler(byte [] tableName, Server server,
final MasterServices masterServices) throws IOException {
super(EventType.C2M_DELETE_TABLE, tableName, server, masterServices);
super(EventType.C_M_DELETE_TABLE, tableName, server, masterServices);
}
@Override

View File

@ -44,7 +44,7 @@ public class DisableTableHandler extends EventHandler {
public DisableTableHandler(Server server, byte [] tableName,
CatalogTracker catalogTracker, AssignmentManager assignmentManager)
throws TableNotFoundException, IOException {
super(server, EventType.C2M_DISABLE_TABLE);
super(server, EventType.C_M_DISABLE_TABLE);
this.tableName = tableName;
this.tableNameStr = Bytes.toString(this.tableName);
this.assignmentManager = assignmentManager;

View File

@ -45,7 +45,7 @@ public class EnableTableHandler extends EventHandler {
public EnableTableHandler(Server server, byte [] tableName,
CatalogTracker catalogTracker, AssignmentManager assignmentManager)
throws TableNotFoundException, IOException {
super(server, EventType.C2M_ENABLE_TABLE);
super(server, EventType.C_M_ENABLE_TABLE);
this.tableName = tableName;
this.tableNameStr = Bytes.toString(tableName);
this.ct = catalogTracker;

View File

@ -34,7 +34,7 @@ public class ModifyTableHandler extends TableEventHandler {
public ModifyTableHandler(final byte [] tableName,
final HTableDescriptor htd, final Server server,
final MasterServices masterServices) throws IOException {
super(EventType.C2M_MODIFY_TABLE, tableName, server, masterServices);
super(EventType.C_M_MODIFY_TABLE, tableName, server, masterServices);
this.htd = htd;
}

View File

@ -59,7 +59,7 @@ public class OpenedRegionHandler extends EventHandler implements TotesHRegionInf
public OpenedRegionHandler(Server server,
AssignmentManager assignmentManager, RegionTransitionData data,
HRegionInfo regionInfo, HServerInfo serverInfo) {
super(server, EventType.RS2ZK_REGION_OPENED);
super(server, EventType.RS_ZK_REGION_OPENED);
this.assignmentManager = assignmentManager;
this.data = data;
this.regionInfo = regionInfo;

View File

@ -40,7 +40,7 @@ public class TableAddFamilyHandler extends TableEventHandler {
public TableAddFamilyHandler(byte[] tableName, HColumnDescriptor familyDesc,
Server server, final MasterServices masterServices) throws IOException {
super(EventType.C2M_ADD_FAMILY, tableName, server, masterServices);
super(EventType.C_M_ADD_FAMILY, tableName, server, masterServices);
this.familyDesc = familyDesc;
}

View File

@ -40,7 +40,7 @@ public class TableDeleteFamilyHandler extends TableEventHandler {
public TableDeleteFamilyHandler(byte[] tableName, byte [] familyName,
Server server, final MasterServices masterServices) throws IOException {
super(EventType.C2M_ADD_FAMILY, tableName, server, masterServices);
super(EventType.C_M_ADD_FAMILY, tableName, server, masterServices);
this.familyName = familyName;
}

View File

@ -41,7 +41,7 @@ public class TableModifyFamilyHandler extends TableEventHandler {
public TableModifyFamilyHandler(byte[] tableName,
HColumnDescriptor familyDesc, Server server,
final MasterServices masterServices) throws IOException {
super(EventType.C2M_MODIFY_FAMILY, tableName, server, masterServices);
super(EventType.C_M_MODIFY_FAMILY, tableName, server, masterServices);
this.familyDesc = familyDesc;
}

View File

@ -38,6 +38,6 @@ public class CloseMetaHandler extends CloseRegionHandler {
final RegionServerServices rsServices,
final HRegionInfo regionInfo,
final boolean abort, final boolean zk) {
super(server, rsServices, regionInfo, abort, zk, EventType.M2RS_CLOSE_META);
super(server, rsServices, regionInfo, abort, zk, EventType.M_RS_CLOSE_META);
}
}

View File

@ -75,7 +75,7 @@ public class CloseRegionHandler extends EventHandler {
public CloseRegionHandler(final Server server,
final RegionServerServices rsServices,
final HRegionInfo regionInfo, final boolean abort, final boolean zk) {
this(server, rsServices, regionInfo, abort, zk, EventType.M2RS_CLOSE_REGION);
this(server, rsServices, regionInfo, abort, zk, EventType.M_RS_CLOSE_REGION);
}
protected CloseRegionHandler(final Server server,

View File

@ -38,6 +38,6 @@ public class CloseRootHandler extends CloseRegionHandler {
public CloseRootHandler(final Server server,
final RegionServerServices rsServices, HRegionInfo regionInfo,
final boolean abort, final boolean zk) {
super(server, rsServices, regionInfo, abort, zk, EventType.M2RS_CLOSE_ROOT);
super(server, rsServices, regionInfo, abort, zk, EventType.M_RS_CLOSE_ROOT);
}
}

View File

@ -31,6 +31,6 @@ import org.apache.hadoop.hbase.regionserver.RegionServerServices;
public class OpenMetaHandler extends OpenRegionHandler {
public OpenMetaHandler(final Server server,
final RegionServerServices rsServices, HRegionInfo regionInfo) {
super(server,rsServices, regionInfo, EventType.M2RS_OPEN_META);
super(server,rsServices, regionInfo, EventType.M_RS_OPEN_META);
}
}

View File

@ -48,7 +48,7 @@ public class OpenRegionHandler extends EventHandler {
public OpenRegionHandler(final Server server,
final RegionServerServices rsServices, HRegionInfo regionInfo) {
this(server, rsServices, regionInfo, EventType.M2RS_OPEN_REGION);
this(server, rsServices, regionInfo, EventType.M_RS_OPEN_REGION);
}
protected OpenRegionHandler(final Server server,

View File

@ -31,6 +31,6 @@ import org.apache.hadoop.hbase.regionserver.RegionServerServices;
public class OpenRootHandler extends OpenRegionHandler {
public OpenRootHandler(final Server server,
final RegionServerServices rsServices, HRegionInfo regionInfo) {
super(server, rsServices, regionInfo, EventType.M2RS_OPEN_ROOT);
super(server, rsServices, regionInfo, EventType.M_RS_OPEN_ROOT);
}
}

View File

@ -1705,7 +1705,7 @@ public class HLog implements Syncable {
* @return Path to file into which to dump split log edits.
* @throws IOException
*/
private static Path getRegionSplitEditsPath(final FileSystem fs,
static Path getRegionSplitEditsPath(final FileSystem fs,
final Entry logEntry, final Path rootDir)
throws IOException {
Path tableDir = HTableDescriptor.getTableDir(rootDir,

View File

@ -129,7 +129,7 @@ public class ZKAssign {
public static void createNodeOffline(ZooKeeperWatcher zkw, HRegionInfo region,
String serverName)
throws KeeperException, KeeperException.NodeExistsException {
createNodeOffline(zkw, region, serverName, EventType.M2ZK_REGION_OFFLINE);
createNodeOffline(zkw, region, serverName, EventType.M_ZK_REGION_OFFLINE);
}
public static void createNodeOffline(ZooKeeperWatcher zkw, HRegionInfo region,
@ -170,7 +170,7 @@ public class ZKAssign {
LOG.debug(zkw.prefix("Forcing existing unassigned node for " +
region.getEncodedName() + " to OFFLINE state"));
RegionTransitionData data = new RegionTransitionData(
EventType.M2ZK_REGION_OFFLINE, region.getRegionName(), serverName);
EventType.M_ZK_REGION_OFFLINE, region.getRegionName(), serverName);
synchronized(zkw.getNodes()) {
String node = getNodeName(zkw, region.getEncodedName());
zkw.getNodes().add(node);
@ -203,7 +203,7 @@ public class ZKAssign {
LOG.debug(zkw.prefix("Creating (or updating) unassigned node for " +
region.getEncodedName() + " with OFFLINE state"));
RegionTransitionData data = new RegionTransitionData(
EventType.M2ZK_REGION_OFFLINE, region.getRegionName(), serverName);
EventType.M_ZK_REGION_OFFLINE, region.getRegionName(), serverName);
synchronized(zkw.getNodes()) {
String node = getNodeName(zkw, region.getEncodedName());
zkw.getNodes().add(node);
@ -240,7 +240,7 @@ public class ZKAssign {
public static boolean deleteOpenedNode(ZooKeeperWatcher zkw,
String regionName)
throws KeeperException, KeeperException.NoNodeException {
return deleteNode(zkw, regionName, EventType.RS2ZK_REGION_OPENED);
return deleteNode(zkw, regionName, EventType.RS_ZK_REGION_OPENED);
}
/**
@ -266,7 +266,7 @@ public class ZKAssign {
public static boolean deleteClosedNode(ZooKeeperWatcher zkw,
String regionName)
throws KeeperException, KeeperException.NoNodeException {
return deleteNode(zkw, regionName, EventType.RS2ZK_REGION_CLOSED);
return deleteNode(zkw, regionName, EventType.RS_ZK_REGION_CLOSED);
}
/**
@ -292,7 +292,7 @@ public class ZKAssign {
public static boolean deleteClosingNode(ZooKeeperWatcher zkw,
String regionName)
throws KeeperException, KeeperException.NoNodeException {
return deleteNode(zkw, regionName, EventType.RS2ZK_REGION_CLOSING);
return deleteNode(zkw, regionName, EventType.RS_ZK_REGION_CLOSING);
}
/**
@ -395,7 +395,7 @@ public class ZKAssign {
LOG.debug(zkw.prefix("Creating unassigned node for " +
region.getEncodedName() + " in a CLOSING state"));
RegionTransitionData data = new RegionTransitionData(
EventType.RS2ZK_REGION_CLOSING, region.getRegionName(), serverName);
EventType.RS_ZK_REGION_CLOSING, region.getRegionName(), serverName);
synchronized(zkw.getNodes()) {
String node = getNodeName(zkw, region.getEncodedName());
zkw.getNodes().add(node);
@ -433,8 +433,8 @@ public class ZKAssign {
HRegionInfo region, String serverName, int expectedVersion)
throws KeeperException {
return transitionNode(zkw, region, serverName,
EventType.RS2ZK_REGION_CLOSING,
EventType.RS2ZK_REGION_CLOSED, expectedVersion);
EventType.RS_ZK_REGION_CLOSING,
EventType.RS_ZK_REGION_CLOSED, expectedVersion);
}
/**
@ -467,14 +467,14 @@ public class ZKAssign {
HRegionInfo region, String serverName)
throws KeeperException {
return transitionNodeOpening(zkw, region, serverName,
EventType.M2ZK_REGION_OFFLINE);
EventType.M_ZK_REGION_OFFLINE);
}
public static int transitionNodeOpening(ZooKeeperWatcher zkw,
HRegionInfo region, String serverName, final EventType beginState)
throws KeeperException {
return transitionNode(zkw, region, serverName, beginState,
EventType.RS2ZK_REGION_OPENING, -1);
EventType.RS_ZK_REGION_OPENING, -1);
}
/**
@ -507,8 +507,8 @@ public class ZKAssign {
HRegionInfo region, String serverName, int expectedVersion)
throws KeeperException {
return transitionNode(zkw, region, serverName,
EventType.RS2ZK_REGION_OPENING,
EventType.RS2ZK_REGION_OPENING, expectedVersion);
EventType.RS_ZK_REGION_OPENING,
EventType.RS_ZK_REGION_OPENING, expectedVersion);
}
/**
@ -543,8 +543,8 @@ public class ZKAssign {
HRegionInfo region, String serverName, int expectedVersion)
throws KeeperException {
return transitionNode(zkw, region, serverName,
EventType.RS2ZK_REGION_OPENING,
EventType.RS2ZK_REGION_OPENED, expectedVersion);
EventType.RS_ZK_REGION_OPENING,
EventType.RS_ZK_REGION_OPENED, expectedVersion);
}
/**

View File

@ -217,7 +217,7 @@ public class TestAdmin {
MasterServices services = TEST_UTIL.getMiniHBaseCluster().getMaster();
ExecutorService executor = services.getExecutorService();
AtomicBoolean done = new AtomicBoolean(false);
executor.registerListener(EventType.C2M_MODIFY_TABLE, new DoneListener(done));
executor.registerListener(EventType.C_M_MODIFY_TABLE, new DoneListener(done));
this.admin.modifyTable(tableName, htd);
while (!done.get()) {
synchronized (done) {
@ -228,7 +228,7 @@ public class TestAdmin {
}
}
}
executor.unregisterListener(EventType.C2M_MODIFY_TABLE);
executor.unregisterListener(EventType.C_M_MODIFY_TABLE);
}
/**

View File

@ -91,7 +91,7 @@ public class TestMaster {
CountDownLatch proceed = new CountDownLatch(1);
RegionOpenListener list = new RegionOpenListener(aboutToOpen, proceed);
cluster.getMaster().executorService.
registerListener(EventType.RS2ZK_REGION_OPENED, list);
registerListener(EventType.RS_ZK_REGION_OPENED, list);
LOG.info("Splitting table");
admin.split(TABLENAME);
@ -129,7 +129,7 @@ public class TestMaster {
@Override
public void afterProcess(EventHandler event) {
if (event.getEventType() != EventType.RS2ZK_REGION_OPENED) {
if (event.getEventType() != EventType.RS_ZK_REGION_OPENED) {
return;
}
try {

View File

@ -78,7 +78,7 @@ public class TestRestartCluster {
HMaster.MASTER);
LOG.debug("Created UNASSIGNED zNode for ROOT and META regions in state " +
EventType.M2ZK_REGION_OFFLINE);
EventType.M_ZK_REGION_OFFLINE);
// start the HB cluster
LOG.info("Starting HBase cluster...");

View File

@ -106,15 +106,15 @@ public class TestZKBasedOpenCloseRegion {
EventHandlerListener closeListener =
new ReopenEventListener(hri.getRegionNameAsString(),
closeEventProcessed, EventType.RS2ZK_REGION_CLOSED);
closeEventProcessed, EventType.RS_ZK_REGION_CLOSED);
cluster.getMaster().executorService.
registerListener(EventType.RS2ZK_REGION_CLOSED, closeListener);
registerListener(EventType.RS_ZK_REGION_CLOSED, closeListener);
EventHandlerListener openListener =
new ReopenEventListener(hri.getRegionNameAsString(),
reopenEventProcessed, EventType.RS2ZK_REGION_OPENED);
reopenEventProcessed, EventType.RS_ZK_REGION_OPENED);
cluster.getMaster().executorService.
registerListener(EventType.RS2ZK_REGION_OPENED, openListener);
registerListener(EventType.RS_ZK_REGION_OPENED, openListener);
LOG.info("Unassign " + hri.getRegionNameAsString());
cluster.getMaster().assignmentManager.unassign(hri);
@ -168,10 +168,10 @@ public class TestZKBasedOpenCloseRegion {
if(event.getEventType() == eventType) {
LOG.info("Finished processing " + eventType);
String regionName = "";
if(eventType == EventType.RS2ZK_REGION_OPENED) {
if(eventType == EventType.RS_ZK_REGION_OPENED) {
TotesHRegionInfo hriCarrier = (TotesHRegionInfo)event;
regionName = hriCarrier.getHRegionInfo().getRegionNameAsString();
} else if(eventType == EventType.RS2ZK_REGION_CLOSED) {
} else if(eventType == EventType.RS_ZK_REGION_CLOSED) {
TotesHRegionInfo hriCarrier = (TotesHRegionInfo)event;
regionName = hriCarrier.getHRegionInfo().getRegionNameAsString();
}
@ -200,7 +200,7 @@ public class TestZKBasedOpenCloseRegion {
EventHandlerListener listener =
new CloseRegionEventListener(hri.getRegionNameAsString(),
closeEventProcessed);
cluster.getMaster().executorService.registerListener(EventType.RS2ZK_REGION_CLOSED, listener);
cluster.getMaster().executorService.registerListener(EventType.RS_ZK_REGION_CLOSED, listener);
cluster.getMaster().assignmentManager.unassign(hri);
@ -224,7 +224,7 @@ public class TestZKBasedOpenCloseRegion {
@Override
public void afterProcess(EventHandler event) {
LOG.info("afterProcess(" + event + ")");
if(event.getEventType() == EventType.RS2ZK_REGION_CLOSED) {
if(event.getEventType() == EventType.RS_ZK_REGION_CLOSED) {
LOG.info("Finished processing CLOSE REGION");
TotesHRegionInfo hriCarrier = (TotesHRegionInfo)event;
if (regionToClose.equals(hriCarrier.getHRegionInfo().getRegionNameAsString())) {
@ -238,7 +238,7 @@ public class TestZKBasedOpenCloseRegion {
@Override
public void beforeProcess(EventHandler event) {
if(event.getEventType() == EventType.M2RS_CLOSE_REGION) {
if(event.getEventType() == EventType.M_RS_CLOSE_REGION) {
LOG.info("Received CLOSE RPC and beginning to process it");
}
}

View File

@ -38,6 +38,7 @@ 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;
@ -129,6 +130,22 @@ public class TestHLogSplit {
public void tearDown() throws Exception {
}
/**
* @throws IOException
* @see https://issues.apache.org/jira/browse/HBASE-3020
*/
@Test public void testRecoveredEditsPathForMeta() throws IOException {
FileSystem fs = FileSystem.get(TEST_UTIL.getConfiguration());
byte [] encoded = HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes();
long now = System.currentTimeMillis();
HLog.Entry entry =
new HLog.Entry(new HLogKey(encoded, HConstants.META_TABLE_NAME, 1, now),
new WALEdit());
Path p = HLog.getRegionSplitEditsPath(fs, entry, new Path("/"));
assertEquals(p.getParent().getParent(),
HRegionInfo.FIRST_META_REGIONINFO.getEncodedName());
}
@Test(expected = IOException.class)
public void testSplitFailsIfNewHLogGetsCreatedAfterSplitStarted()
throws IOException {