HBASE-1150 HMsg carries safemode flag; remove
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@759676 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a232c6e8f6
commit
c150f02537
|
@ -65,6 +65,7 @@ Release 0.20.0 - Unreleased
|
|||
Rawson via Andrew Purtell)
|
||||
HBASE-1293 hfile doesn't recycle decompressors (Ryan Rawson via Andrew
|
||||
Purtell)
|
||||
HBASE-1150 HMsg carries safemode flag; remove (Nitay Joffe via Stack)
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
@ -114,7 +113,6 @@ public class HMsg implements Writable {
|
|||
private Type type = null;
|
||||
private HRegionInfo info = null;
|
||||
private byte[] message = null;
|
||||
private boolean safeMode = false;
|
||||
|
||||
/** Default constructor. Used during deserialization */
|
||||
public HMsg() {
|
||||
|
@ -126,7 +124,7 @@ public class HMsg implements Writable {
|
|||
* @param type Message type
|
||||
*/
|
||||
public HMsg(final HMsg.Type type) {
|
||||
this(type, new HRegionInfo(), null, false);
|
||||
this(type, new HRegionInfo(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,20 +133,7 @@ public class HMsg implements Writable {
|
|||
* @param hri Region to which message <code>type</code> applies
|
||||
*/
|
||||
public HMsg(final HMsg.Type type, final HRegionInfo hri) {
|
||||
this(type, hri, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor used by master to inform region servers if we are still in
|
||||
* safe mode.
|
||||
*
|
||||
* @param type
|
||||
* @param hri
|
||||
* @param safeMode
|
||||
*/
|
||||
public HMsg(final HMsg.Type type, final HRegionInfo hri,
|
||||
final boolean safeMode) {
|
||||
this(type, hri, null, safeMode);
|
||||
this(type, hri, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,19 +145,6 @@ public class HMsg implements Writable {
|
|||
* @param msg Optional message (Stringified exception, etc.)
|
||||
*/
|
||||
public HMsg(final HMsg.Type type, final HRegionInfo hri, final byte[] msg) {
|
||||
this(type, hri, msg, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the master to inform region servers if we are still in safe mode
|
||||
*
|
||||
* @param type
|
||||
* @param hri
|
||||
* @param msg
|
||||
* @param safemode
|
||||
*/
|
||||
public HMsg(final HMsg.Type type, final HRegionInfo hri, final byte[] msg,
|
||||
final boolean safemode) {
|
||||
if (type == null) {
|
||||
throw new NullPointerException("Message type cannot be null");
|
||||
}
|
||||
|
@ -182,7 +154,6 @@ public class HMsg implements Writable {
|
|||
}
|
||||
this.info = hri;
|
||||
this.message = msg;
|
||||
this.safeMode = safemode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,11 +181,6 @@ public class HMsg implements Writable {
|
|||
return this.message;
|
||||
}
|
||||
|
||||
/** @return safe mode */
|
||||
public boolean isInSafeMode() {
|
||||
return this.safeMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
|
@ -230,7 +196,6 @@ public class HMsg implements Writable {
|
|||
if (this.message != null && this.message.length > 0) {
|
||||
sb.append(": " + Bytes.toString(this.message));
|
||||
}
|
||||
sb.append(": safeMode=" + safeMode);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
@ -270,6 +235,9 @@ public class HMsg implements Writable {
|
|||
// Writable
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @see org.apache.hadoop.io.Writable#write(java.io.DataOutput)
|
||||
*/
|
||||
public void write(DataOutput out) throws IOException {
|
||||
out.writeInt(this.type.ordinal());
|
||||
this.info.write(out);
|
||||
|
@ -279,9 +247,11 @@ public class HMsg implements Writable {
|
|||
out.writeBoolean(true);
|
||||
Bytes.writeByteArray(out, this.message);
|
||||
}
|
||||
out.writeBoolean(this.safeMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.hadoop.io.Writable#readFields(java.io.DataInput)
|
||||
*/
|
||||
public void readFields(DataInput in) throws IOException {
|
||||
int ordinal = in.readInt();
|
||||
this.type = HMsg.Type.values()[ordinal];
|
||||
|
@ -290,6 +260,5 @@ public class HMsg implements Writable {
|
|||
if (hasMessage) {
|
||||
this.message = Bytes.readByteArray(in);
|
||||
}
|
||||
this.safeMode = in.readBoolean();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ class RegionManager implements HConstants {
|
|||
this.historian.addRegionAssignment(s.getRegionInfo(),
|
||||
info.getServerName());
|
||||
returnMsgs.add(
|
||||
new HMsg(HMsg.Type.MSG_REGION_OPEN, s.getRegionInfo(), inSafeMode()));
|
||||
new HMsg(HMsg.Type.MSG_REGION_OPEN, s.getRegionInfo()));
|
||||
if (--nregions <= 0) {
|
||||
break;
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ class RegionManager implements HConstants {
|
|||
s.setPendingOpen(info.getServerName());
|
||||
this.historian.addRegionAssignment(s.getRegionInfo(), info.getServerName());
|
||||
returnMsgs.add(
|
||||
new HMsg(HMsg.Type.MSG_REGION_OPEN, s.getRegionInfo(), inSafeMode()));
|
||||
new HMsg(HMsg.Type.MSG_REGION_OPEN, s.getRegionInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ class RegionManager implements HConstants {
|
|||
}
|
||||
// make a message to close the region
|
||||
returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_CLOSE, currentRegion,
|
||||
OVERLOADED, inSafeMode()));
|
||||
OVERLOADED));
|
||||
// mark the region as closing
|
||||
setClosing(info.getServerName(), currentRegion, false);
|
||||
setPendingClose(regionName);
|
||||
|
@ -1129,7 +1129,7 @@ class RegionManager implements HConstants {
|
|||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Sending " + msg + " " + pair.getFirst() + " to " + addr);
|
||||
}
|
||||
returnMsgs.add(new HMsg(msg, pair.getFirst(), inSafeMode()));
|
||||
returnMsgs.add(new HMsg(msg, pair.getFirst()));
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,8 +410,7 @@ class ServerManager implements HConstants {
|
|||
// Tell the region server to close regions that we have marked for closing.
|
||||
for (HRegionInfo i:
|
||||
master.regionManager.getMarkedToClose(serverInfo.getServerName())) {
|
||||
returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_CLOSE, i,
|
||||
master.regionManager.inSafeMode()));
|
||||
returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_CLOSE, i));
|
||||
// Transition the region from toClose to closing state
|
||||
master.regionManager.setPendingClose(i.getRegionNameAsString());
|
||||
}
|
||||
|
@ -505,8 +504,7 @@ class ServerManager implements HConstants {
|
|||
// Otherwise the HMaster will think the Region was closed on purpose,
|
||||
// and then try to reopen it elsewhere; that's not what we want.
|
||||
returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_CLOSE_WITHOUT_REPORT,
|
||||
region, "Duplicate assignment".getBytes(),
|
||||
master.regionManager.inSafeMode()));
|
||||
region, "Duplicate assignment".getBytes()));
|
||||
} else {
|
||||
if (region.isRootRegion()) {
|
||||
// it was assigned, and it's not a duplicate assignment, so take it out
|
||||
|
|
|
@ -380,7 +380,7 @@ public class HRegionServer implements HConstants, HRegionInterface, HBaseRPCErro
|
|||
i++) {
|
||||
LOG.info(msgs[i].toString());
|
||||
if (safeMode.get()) {
|
||||
if (!msgs[i].isInSafeMode()) {
|
||||
if (zooKeeperWrapper.checkOutOfSafeMode()) {
|
||||
this.connection.unsetRootRegionLocation();
|
||||
synchronized (safeMode) {
|
||||
safeMode.set(false);
|
||||
|
|
Loading…
Reference in New Issue