HDFS-2141. Remove NameNode roles Active and Standby (they become states of the namenode). Contributed by Suresh Srinivas.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1148125 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2011-07-19 01:32:59 +00:00
parent c3f6575ca4
commit 6c0cb4d151
8 changed files with 19 additions and 17 deletions

View File

@ -572,6 +572,9 @@ Trunk (unreleased changes)
HDFS-2147. Move cluster network topology to block management and fix some HDFS-2147. Move cluster network topology to block management and fix some
javac warnings. (szetszwo) javac warnings. (szetszwo)
HDFS-2141. Remove NameNode roles Active and Standby (they become
states of the namenode). (suresh)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-1458. Improve checkpoint performance by avoiding unnecessary image HDFS-1458. Improve checkpoint performance by avoiding unnecessary image

View File

@ -65,7 +65,7 @@ public interface HdfsConstants {
case CHECKPOINT: case CHECKPOINT:
return NamenodeRole.CHECKPOINT; return NamenodeRole.CHECKPOINT;
default: default:
return NamenodeRole.ACTIVE; return NamenodeRole.NAMENODE;
} }
} }
@ -89,10 +89,9 @@ public interface HdfsConstants {
* Defines the NameNode role. * Defines the NameNode role.
*/ */
static public enum NamenodeRole { static public enum NamenodeRole {
ACTIVE ("NameNode"), NAMENODE ("NameNode"),
BACKUP ("Backup Node"), BACKUP ("Backup Node"),
CHECKPOINT("Checkpoint Node"), CHECKPOINT("Checkpoint Node");
STANDBY ("Standby Node");
private String description = null; private String description = null;
private NamenodeRole(String arg) {this.description = arg;} private NamenodeRole(String arg) {this.description = arg;}

View File

@ -327,7 +327,7 @@ public class BackupNode extends NameNode {
String msg = null; String msg = null;
if(nnReg == null) // consider as a rejection if(nnReg == null) // consider as a rejection
msg = "Registration rejected by " + nnRpcAddress; msg = "Registration rejected by " + nnRpcAddress;
else if(!nnReg.isRole(NamenodeRole.ACTIVE)) { else if(!nnReg.isRole(NamenodeRole.NAMENODE)) {
msg = "Name-node " + nnRpcAddress + " is not active"; msg = "Name-node " + nnRpcAddress + " is not active";
} }
if(msg != null) { if(msg != null) {

View File

@ -1142,7 +1142,7 @@ public class FSImage implements NNStorageListener, Closeable {
msg = "Name node " + bnReg.getAddress() msg = "Name node " + bnReg.getAddress()
+ " has incompatible namespace id: " + bnReg.getNamespaceID() + " has incompatible namespace id: " + bnReg.getNamespaceID()
+ " expected: " + storage.getNamespaceID(); + " expected: " + storage.getNamespaceID();
else if(bnReg.isRole(NamenodeRole.ACTIVE)) else if(bnReg.isRole(NamenodeRole.NAMENODE))
msg = "Name node " + bnReg.getAddress() msg = "Name node " + bnReg.getAddress()
+ " role " + bnReg.getRole() + ": checkpoint is not allowed."; + " role " + bnReg.getRole() + ": checkpoint is not allowed.";
else if(bnReg.getLayoutVersion() < storage.getLayoutVersion() else if(bnReg.getLayoutVersion() < storage.getLayoutVersion()

View File

@ -480,7 +480,7 @@ public class NameNode implements NamenodeProtocols, FSConstants {
* Activate name-node servers and threads. * Activate name-node servers and threads.
*/ */
void activate(Configuration conf) throws IOException { void activate(Configuration conf) throws IOException {
if ((isRole(NamenodeRole.ACTIVE)) if ((isRole(NamenodeRole.NAMENODE))
&& (UserGroupInformation.isSecurityEnabled())) { && (UserGroupInformation.isSecurityEnabled())) {
namesystem.activateSecretManager(); namesystem.activateSecretManager();
} }
@ -646,7 +646,7 @@ public class NameNode implements NamenodeProtocols, FSConstants {
* @throws IOException * @throws IOException
*/ */
public NameNode(Configuration conf) throws IOException { public NameNode(Configuration conf) throws IOException {
this(conf, NamenodeRole.ACTIVE); this(conf, NamenodeRole.NAMENODE);
} }
protected NameNode(Configuration conf, NamenodeRole role) protected NameNode(Configuration conf, NamenodeRole role)
@ -752,7 +752,7 @@ public class NameNode implements NamenodeProtocols, FSConstants {
public NamenodeCommand startCheckpoint(NamenodeRegistration registration) public NamenodeCommand startCheckpoint(NamenodeRegistration registration)
throws IOException { throws IOException {
verifyRequest(registration); verifyRequest(registration);
if(!isRole(NamenodeRole.ACTIVE)) if(!isRole(NamenodeRole.NAMENODE))
throw new IOException("Only an ACTIVE node can invoke startCheckpoint."); throw new IOException("Only an ACTIVE node can invoke startCheckpoint.");
return namesystem.startCheckpoint(registration, setRegistration()); return namesystem.startCheckpoint(registration, setRegistration());
} }
@ -761,7 +761,7 @@ public class NameNode implements NamenodeProtocols, FSConstants {
public void endCheckpoint(NamenodeRegistration registration, public void endCheckpoint(NamenodeRegistration registration,
CheckpointSignature sig) throws IOException { CheckpointSignature sig) throws IOException {
verifyRequest(registration); verifyRequest(registration);
if(!isRole(NamenodeRole.ACTIVE)) if(!isRole(NamenodeRole.NAMENODE))
throw new IOException("Only an ACTIVE node can invoke endCheckpoint."); throw new IOException("Only an ACTIVE node can invoke endCheckpoint.");
namesystem.endCheckpoint(registration, sig); namesystem.endCheckpoint(registration, sig);
} }

View File

@ -320,7 +320,7 @@ public class TestEditLogRace {
@Test @Test
public void testSaveImageWhileSyncInProgress() throws Exception { public void testSaveImageWhileSyncInProgress() throws Exception {
Configuration conf = getConf(); Configuration conf = getConf();
NameNode.initMetrics(conf, NamenodeRole.ACTIVE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
DFSTestUtil.formatNameNode(conf); DFSTestUtil.formatNameNode(conf);
final FSNamesystem namesystem = new FSNamesystem(conf); final FSNamesystem namesystem = new FSNamesystem(conf);
@ -410,7 +410,7 @@ public class TestEditLogRace {
@Test @Test
public void testSaveRightBeforeSync() throws Exception { public void testSaveRightBeforeSync() throws Exception {
Configuration conf = getConf(); Configuration conf = getConf();
NameNode.initMetrics(conf, NamenodeRole.ACTIVE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
DFSTestUtil.formatNameNode(conf); DFSTestUtil.formatNameNode(conf);
final FSNamesystem namesystem = new FSNamesystem(conf); final FSNamesystem namesystem = new FSNamesystem(conf);

View File

@ -101,7 +101,7 @@ public class TestSaveNamespace {
private void saveNamespaceWithInjectedFault(Fault fault) throws IOException { private void saveNamespaceWithInjectedFault(Fault fault) throws IOException {
Configuration conf = getConf(); Configuration conf = getConf();
NameNode.initMetrics(conf, NamenodeRole.ACTIVE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
DFSTestUtil.formatNameNode(conf); DFSTestUtil.formatNameNode(conf);
FSNamesystem fsn = new FSNamesystem(conf); FSNamesystem fsn = new FSNamesystem(conf);
@ -178,7 +178,7 @@ public class TestSaveNamespace {
Configuration conf = getConf(); Configuration conf = getConf();
conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_RESTORE_KEY, true); conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_RESTORE_KEY, true);
NameNode.initMetrics(conf, NamenodeRole.ACTIVE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
DFSTestUtil.formatNameNode(conf); DFSTestUtil.formatNameNode(conf);
FSNamesystem fsn = new FSNamesystem(conf); FSNamesystem fsn = new FSNamesystem(conf);
@ -295,7 +295,7 @@ public class TestSaveNamespace {
public void doTestFailedSaveNamespace(boolean restoreStorageAfterFailure) public void doTestFailedSaveNamespace(boolean restoreStorageAfterFailure)
throws Exception { throws Exception {
Configuration conf = getConf(); Configuration conf = getConf();
NameNode.initMetrics(conf, NamenodeRole.ACTIVE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
DFSTestUtil.formatNameNode(conf); DFSTestUtil.formatNameNode(conf);
FSNamesystem fsn = new FSNamesystem(conf); FSNamesystem fsn = new FSNamesystem(conf);
@ -356,7 +356,7 @@ public class TestSaveNamespace {
@Test @Test
public void testSaveWhileEditsRolled() throws Exception { public void testSaveWhileEditsRolled() throws Exception {
Configuration conf = getConf(); Configuration conf = getConf();
NameNode.initMetrics(conf, NamenodeRole.ACTIVE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
DFSTestUtil.formatNameNode(conf); DFSTestUtil.formatNameNode(conf);
FSNamesystem fsn = new FSNamesystem(conf); FSNamesystem fsn = new FSNamesystem(conf);

View File

@ -79,7 +79,7 @@ public class TestNNLeaseRecovery {
conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY, NAME_DIR); conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY, NAME_DIR);
// avoid stubbing access control // avoid stubbing access control
conf.setBoolean(DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY, false); conf.setBoolean(DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY, false);
NameNode.initMetrics(conf, NamenodeRole.ACTIVE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
FileSystem.setDefaultUri(conf, "hdfs://localhost:0"); FileSystem.setDefaultUri(conf, "hdfs://localhost:0");
conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "0.0.0.0:0"); conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "0.0.0.0:0");