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
javac warnings. (szetszwo)
HDFS-2141. Remove NameNode roles Active and Standby (they become
states of the namenode). (suresh)
OPTIMIZATIONS
HDFS-1458. Improve checkpoint performance by avoiding unnecessary image

View File

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

View File

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

View File

@ -1142,7 +1142,7 @@ NamenodeCommand startCheckpoint(NamenodeRegistration bnReg, // backup node
msg = "Name node " + bnReg.getAddress()
+ " has incompatible namespace id: " + bnReg.getNamespaceID()
+ " expected: " + storage.getNamespaceID();
else if(bnReg.isRole(NamenodeRole.ACTIVE))
else if(bnReg.isRole(NamenodeRole.NAMENODE))
msg = "Name node " + bnReg.getAddress()
+ " role " + bnReg.getRole() + ": checkpoint is not allowed.";
else if(bnReg.getLayoutVersion() < storage.getLayoutVersion()

View File

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

View File

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

View File

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

View File

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