boolean preUpgradeAction ( NamespaceInfo nsInfo ) throws IOException { int nsUpgradeVersion = nsInfo . getDistributedUpgradeVersion ( ) ; if ( nsUpgradeVersion >= getVersion ( ) ) return false ; // name-node will perform the upgrade // Missed the upgrade. Report problem to the name-node and throw exception String errorMsg = "\n Data-node missed a distributed upgrade and will shutdown." + "\n " + getDescription ( ) + "." + " Name-node version = " + nsInfo . getLayoutVersion ( ) + "." ; DataNode . LOG . fatal ( errorMsg ) ; try { dataNode . getNSNamenode ( nsInfo . getNamespaceID ( ) ) . errorReport ( dataNode . getDNRegistrationForNS ( nsInfo . getNamespaceID ( ) ) , DatanodeProtocol . NOTIFY , errorMsg ) ; } catch ( SocketTimeoutException e ) { // namenode is busy DataNode . LOG . info ( "Problem connecting to server: " + dataNode . getNSNamenode ( nsInfo . getNamespaceID ( ) ) . toString ( ) ) ; } throw new IOException ( errorMsg ) ; }
Specifies what to do before the upgrade is started .