HBASE-1502 Remove need for heartbeats in HBase; fix broke build

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1097284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-04-27 23:43:45 +00:00
parent 529223130a
commit 52033a212f
5 changed files with 24 additions and 22 deletions

View File

@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.coprocessor;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HServerInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.UnknownRegionException;
@ -109,18 +110,6 @@ public class BaseMasterObserver implements MasterObserver {
byte[] tableName) throws IOException {
}
@Override
public void preMove(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo region, HServerInfo srcServer, HServerInfo destServer)
throws UnknownRegionException {
}
@Override
public void postMove(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo region, HServerInfo srcServer, HServerInfo destServer)
throws UnknownRegionException {
}
@Override
public void preAssign(ObserverContext<MasterCoprocessorEnvironment> ctx,
byte[] regionName, boolean force) throws IOException {
@ -179,4 +168,16 @@ public class BaseMasterObserver implements MasterObserver {
@Override
public void stop(CoprocessorEnvironment ctx) throws IOException {
}
@Override
public void preMove(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo region, ServerName srcServer, ServerName destServer)
throws UnknownRegionException {
}
@Override
public void postMove(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo region, ServerName srcServer, ServerName destServer)
throws UnknownRegionException {
}
}

View File

@ -187,7 +187,7 @@ class ActiveMasterManager extends ZooKeeperListener {
ZKUtil.getDataAndWatch(watcher, watcher.masterAddressZNode);
// TODO: redo this to make it atomic (only added for tests)
ServerName master = new ServerName(Bytes.toString(bytes));
if(master != null && master.equals(this.sn)) {
if (master != null && master.equals(this.sn)) {
ZKUtil.deleteNode(watcher, watcher.masterAddressZNode);
}
} catch (KeeperException e) {

View File

@ -243,7 +243,8 @@ public class AssignmentManager extends ZooKeeperListener {
processRegionsInTransition();
}
public void processRegionsInTransition() throws KeeperException, IOException {
public void processRegionsInTransition()
throws KeeperException, IOException, InterruptedException {
List<String> nodes = ZKUtil.listChildrenAndWatchForNewChildren(watcher,
watcher.assignmentZNode);
// Run through all regions. If they are not assigned and not in RIT, then
@ -265,7 +266,6 @@ public class AssignmentManager extends ZooKeeperListener {
// If we found user regions out on cluster, its a failover.
if (userRegionsOutOnCluster) {
LOG.info("Found regions out on cluster or in RIT; failover");
processDeadServers(deadServers);
if (!nodes.isEmpty()) {
for (String encodedRegionName: nodes) {
processRegionInTransition(encodedRegionName, null);
@ -417,7 +417,7 @@ public class AssignmentManager extends ZooKeeperListener {
boolean lateEvent = data.getStamp() <
(System.currentTimeMillis() - 15000);
LOG.debug("Handling transition=" + data.getEventType() +
", server=" + data.getServerName() + ", region=" +
", server=" + data.getOrigin() + ", region=" +
prettyPrintedRegionName +
(lateEvent? ", which is more than 15 seconds late" : ""));
RegionState regionState = regionsInTransition.get(encodedName);

View File

@ -86,7 +86,6 @@ import org.apache.hadoop.hbase.zookeeper.RegionServerTracker;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.net.DNS;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
@ -321,7 +320,9 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
* @throws InterruptedException
*/
private boolean becomeActiveMaster() throws InterruptedException {
this.activeMasterManager = new ActiveMasterManager(zooKeeper, address,
// TODO: This is wrong!!!! Should have new servername if we restart ourselves,
// if we come back to life.
this.activeMasterManager = new ActiveMasterManager(zooKeeper, this.serverName,
this);
this.zooKeeper.registerListener(activeMasterManager);
stallIfBackupMaster(this.conf, this.activeMasterManager);
@ -355,7 +356,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
boolean wasUp = this.clusterStatusTracker.isClusterUp();
if (!wasUp) this.clusterStatusTracker.setClusterUp();
LOG.info("Server active/primary master; " + this.address +
LOG.info("Server active/primary master; " + this.serverName +
", sessionid=0x" +
Long.toHexString(this.zooKeeper.getZooKeeper().getSessionId()) +
", cluster-up flag was=" + wasUp);
@ -1101,7 +1102,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
private boolean tryRecoveringExpiredZKSession() throws InterruptedException,
IOException, KeeperException {
this.zooKeeper = new ZooKeeperWatcher(conf, MASTER + ":"
+ address.getPort(), this);
+ this.serverName.getPort(), this);
if (!becomeActiveMaster()) {
return false;

View File

@ -275,7 +275,7 @@ public class TestZKBasedOpenCloseRegion {
// now ask the master to move the region to hr1, will fail
TEST_UTIL.getHBaseAdmin().move(hri.getEncodedNameAsBytes(),
Bytes.toBytes(hr1.getServerName()));
Bytes.toBytes(hr1.getServerName().toString()));
while (!reopenEventProcessed.get()) {
Threads.sleep(100);
@ -290,7 +290,7 @@ public class TestZKBasedOpenCloseRegion {
// move the region again, but this time it will work
TEST_UTIL.getHBaseAdmin().move(hri.getEncodedNameAsBytes(),
Bytes.toBytes(hr1.getServerName()));
Bytes.toBytes(hr1.getServerName().toString()));
while (!reopenEventProcessed.get()) {
Threads.sleep(100);