HDFS-6034. Use DataNodeLayoutVersion for DN registration check and do not verify layout version if there is a rolling upgrade in progress.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-5535@1573119 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ee663fad14
commit
c69cc31adc
|
@ -127,3 +127,6 @@ HDFS-5535 subtasks:
|
||||||
HDFS-6031. Add back the "-rollingUpgrade started" namenode startup option;
|
HDFS-6031. Add back the "-rollingUpgrade started" namenode startup option;
|
||||||
otherwise, namenode cannot start when the layout version is changed.
|
otherwise, namenode cannot start when the layout version is changed.
|
||||||
(szetszwo)
|
(szetszwo)
|
||||||
|
|
||||||
|
HDFS-6034. Use DataNodeLayoutVersion for DN registration check and do not
|
||||||
|
verify layout version if there is a rolling upgrade in progress. (szetszwo)
|
||||||
|
|
|
@ -1020,7 +1020,6 @@ public abstract class Storage extends StorageInfo {
|
||||||
public static String getRegistrationID(StorageInfo storage) {
|
public static String getRegistrationID(StorageInfo storage) {
|
||||||
return "NS-" + Integer.toString(storage.getNamespaceID())
|
return "NS-" + Integer.toString(storage.getNamespaceID())
|
||||||
+ "-" + storage.getClusterID()
|
+ "-" + storage.getClusterID()
|
||||||
+ "-" + Integer.toString(storage.getLayoutVersion())
|
|
||||||
+ "-" + Long.toString(storage.getCTime());
|
+ "-" + Long.toString(storage.getCTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifie
|
||||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
|
||||||
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole;
|
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole;
|
||||||
import org.apache.hadoop.hdfs.server.common.IncorrectVersionException;
|
import org.apache.hadoop.hdfs.server.common.IncorrectVersionException;
|
||||||
|
import org.apache.hadoop.hdfs.server.datanode.DataNodeLayoutVersion;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.NameNode.OperationCategory;
|
import org.apache.hadoop.hdfs.server.namenode.NameNode.OperationCategory;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.metrics.NameNodeMetrics;
|
import org.apache.hadoop.hdfs.server.namenode.metrics.NameNodeMetrics;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods;
|
import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods;
|
||||||
|
@ -1076,13 +1077,30 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
* @param nodeReg node registration
|
* @param nodeReg node registration
|
||||||
* @throws UnregisteredNodeException if the registration is invalid
|
* @throws UnregisteredNodeException if the registration is invalid
|
||||||
*/
|
*/
|
||||||
void verifyRequest(NodeRegistration nodeReg) throws IOException {
|
private void verifyRequest(NodeRegistration nodeReg) throws IOException {
|
||||||
if (!namesystem.getRegistrationID().equals(nodeReg.getRegistrationID())) {
|
// verify registration ID
|
||||||
LOG.warn("Invalid registrationID - expected: "
|
final String id = nodeReg.getRegistrationID();
|
||||||
+ namesystem.getRegistrationID() + " received: "
|
final String expectedID = namesystem.getRegistrationID();
|
||||||
+ nodeReg.getRegistrationID());
|
if (!expectedID.equals(id)) {
|
||||||
|
LOG.warn("Registration IDs mismatched: the "
|
||||||
|
+ nodeReg.getClass().getSimpleName() + " ID is " + id
|
||||||
|
+ " but the expected ID is " + expectedID);
|
||||||
throw new UnregisteredNodeException(nodeReg);
|
throw new UnregisteredNodeException(nodeReg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// verify layout version if there is no rolling upgrade.
|
||||||
|
if (!namesystem.isRollingUpgrade()) {
|
||||||
|
final int lv = nodeReg.getVersion();
|
||||||
|
final int expectedLV = nodeReg instanceof NamenodeRegistration?
|
||||||
|
NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION
|
||||||
|
: DataNodeLayoutVersion.CURRENT_LAYOUT_VERSION;
|
||||||
|
if (expectedLV != nodeReg.getVersion()) {
|
||||||
|
LOG.warn("Layout versions mismatched: the "
|
||||||
|
+ nodeReg.getClass().getSimpleName() + " LV is " + lv
|
||||||
|
+ " but the expected LV is " + expectedLV);
|
||||||
|
throw new UnregisteredNodeException(nodeReg);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // RefreshAuthorizationPolicyProtocol
|
@Override // RefreshAuthorizationPolicyProtocol
|
||||||
|
|
Loading…
Reference in New Issue