List of usage examples for org.apache.hadoop.hdfs.server.protocol NamespaceInfo getBuildVersion
public String getBuildVersion()
From source file:common.DataNode.java
License:Apache License
private NamespaceInfo handshake() throws IOException { NamespaceInfo nsInfo = new NamespaceInfo(); while (shouldRun) { try {//from w ww .j av a2s. c om nsInfo = namenode.versionRequest(); break; } catch (SocketTimeoutException e) { // namenode is busy LOG.info("Problem connecting to server: " + getNameNodeAddr()); try { Thread.sleep(1000); } catch (InterruptedException ie) { } } } String errorMsg = null; // verify build version if (!nsInfo.getBuildVersion().equals(Storage.getBuildVersion())) { errorMsg = "Incompatible build versions: namenode BV = " + nsInfo.getBuildVersion() + "; datanode BV = " + Storage.getBuildVersion(); LOG.fatal(errorMsg); try { namenode.errorReport(dnRegistration, DatanodeProtocol.NOTIFY, errorMsg); } catch (SocketTimeoutException e) { // namenode is busy LOG.info("Problem connecting to server: " + getNameNodeAddr()); } throw new IOException(errorMsg); } assert FSConstants.LAYOUT_VERSION == nsInfo .getLayoutVersion() : "Data-node and name-node layout versions must be the same." + "Expected: " + FSConstants.LAYOUT_VERSION + " actual " + nsInfo.getLayoutVersion(); return nsInfo; }