private void connectToNNAndHandshake() throws IOException { // get NN proxy bpNamenode = dn.connectToNN(nnAddr); // First phase of the handshake with NN - get the namespace // info. NamespaceInfo nsInfo = retrieveNamespaceInfo(); // Verify that this matches the other NN in this HA pair. // This also initializes our block pool in the DN if we are // the first NN connection for this BP. bpos.verifyAndSetNamespaceInfo(this, nsInfo); /* set thread name again to include NamespaceInfo when it's available. */ this.bpThread.setName(formatThreadName("heartbeating", nnAddr)); // Second phase of the handshake with the NN. register(nsInfo); }
void reRegister() throws IOException { if (shouldRun()) { // re-retrieve namespace info to make sure that, if the NN // was restarted, we still match its version (HDFS-2120) NamespaceInfo nsInfo = retrieveNamespaceInfo(); // and re-register register(nsInfo); scheduler.scheduleHeartbeat(); // HDFS-9917,Standby NN IBR can be very huge if standby namenode is down // for sometime. if (state == HAServiceState.STANDBY) { ibrManager.clearIBRs(); } } }
private void connectToNNAndHandshake() throws IOException { // get NN proxy bpNamenode = dn.connectToNN(nnAddr); // First phase of the handshake with NN - get the namespace // info. NamespaceInfo nsInfo = retrieveNamespaceInfo(); // Verify that this matches the other NN in this HA pair. // This also initializes our block pool in the DN if we are // the first NN connection for this BP. bpos.verifyAndSetNamespaceInfo(nsInfo); // Second phase of the handshake with the NN. register(nsInfo); }
private void connectToNNAndHandshake() throws IOException { // get NN proxy bpNamenode = dn.connectToNN(nnAddr); // First phase of the handshake with NN - get the namespace // info. NamespaceInfo nsInfo = retrieveNamespaceInfo(); // Verify that this matches the other NN in this HA pair. // This also initializes our block pool in the DN if we are // the first NN connection for this BP. bpos.verifyAndSetNamespaceInfo(nsInfo); // Second phase of the handshake with the NN. register(nsInfo); }
void reRegister() throws IOException { if (shouldRun()) { // re-retrieve namespace info to make sure that, if the NN // was restarted, we still match its version (HDFS-2120) NamespaceInfo nsInfo = retrieveNamespaceInfo(); // and re-register register(nsInfo); scheduler.scheduleHeartbeat(); // HDFS-9917,Standby NN IBR can be very huge if standby namenode is down // for sometime. if (state == HAServiceState.STANDBY) { ibrManager.clearIBRs(); } } }
void reRegister() throws IOException { if (shouldRun()) { // re-retrieve namespace info to make sure that, if the NN // was restarted, we still match its version (HDFS-2120) NamespaceInfo nsInfo = retrieveNamespaceInfo(); // and re-register register(nsInfo); scheduler.scheduleHeartbeat(); // HDFS-9917,Standby NN IBR can be very huge if standby namenode is down // for sometime. if (state == HAServiceState.STANDBY) { ibrManager.clearIBRs(); } } }
@Test public void testDifferentLayoutVersions() throws Exception { // We expect no exceptions to be thrown when the layout versions match. assertEquals(HdfsConstants.NAMENODE_LAYOUT_VERSION, actor.retrieveNamespaceInfo().getLayoutVersion()); // We expect an exception to be thrown when the NN reports a layout version // different from that of the DN. doReturn(HdfsConstants.NAMENODE_LAYOUT_VERSION * 1000).when(fakeNsInfo) .getLayoutVersion(); try { actor.retrieveNamespaceInfo(); } catch (IOException e) { fail("Should not fail to retrieve NS info from DN with different layout version"); } } }
@Test public void testSoftwareVersionDifferences() throws Exception { // We expect no exception to be thrown when the software versions match. assertEquals(VersionInfo.getVersion(), actor.retrieveNamespaceInfo().getSoftwareVersion()); // We expect no exception to be thrown when the min NN version is below the // reported NN version. doReturn("4.0.0").when(fakeNsInfo).getSoftwareVersion(); doReturn("3.0.0").when(mockDnConf).getMinimumNameNodeVersion(); assertEquals("4.0.0", actor.retrieveNamespaceInfo().getSoftwareVersion()); // When the NN reports a version that's too low, throw an exception. doReturn("3.0.0").when(fakeNsInfo).getSoftwareVersion(); doReturn("4.0.0").when(mockDnConf).getMinimumNameNodeVersion(); try { actor.retrieveNamespaceInfo(); fail("Should have thrown an exception for NN with too-low version"); } catch (IncorrectVersionException ive) { GenericTestUtils.assertExceptionContains( "The reported NameNode version is too low", ive); LOG.info("Got expected exception", ive); } }