dannytbecker commented on code in PR #6031:
URL: https://github.com/apache/hadoop/pull/6031#discussion_r1319367767
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestBootstrapStandby.java:
##########
@@ -172,6 +185,104 @@ public void testDownloadingLaterCheckpoint() throws
Exception {
restartNameNodesFromIndex(1);
}
+ /**
+ * Test for downloading a checkpoint made at a later checkpoint
+ * from the active.
+ */
+ @Test
+ public void testRollingUpgradeBootstrapStandby() throws Exception {
+ removeStandbyNameDirs();
+
+ int futureVersion = NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION - 1;
+
+ DistributedFileSystem fs = cluster.getFileSystem(0);
+ fs.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
+ fs.saveNamespace();
+ fs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
+
+ // Setup BootstrapStandby to think it is a future NameNode version
+ BootstrapStandby bs = spy(new BootstrapStandby());
+ doAnswer(nsInfo -> {
+ NamespaceInfo nsInfoSpy = (NamespaceInfo) spy(nsInfo.callRealMethod());
+ doReturn(futureVersion).when(nsInfoSpy).getServiceLayoutVersion();
+ return nsInfoSpy;
+ }).when(bs).getProxyNamespaceInfo(any());
+
+ // BootstrapStandby should fail if the node has a future version
+ // and the cluster isn't in rolling upgrade
+ bs.setConf(cluster.getConfiguration(1));
+ assertEquals("BootstrapStandby should return ERR_CODE_INVALID_VERSION",
+ ERR_CODE_INVALID_VERSION, bs.run(new String[]{"-force"}));
+
+ // Start rolling upgrade
+ fs.rollingUpgrade(RollingUpgradeAction.PREPARE);
+ nn0 = spy(nn0);
+
+ // Make nn0 think it is a future version
+ doAnswer(fsImage -> {
+ FSImage fsImageSpy = (FSImage) spy(fsImage.callRealMethod());
+ doAnswer(storage -> {
+ NNStorage storageSpy = (NNStorage) spy(storage.callRealMethod());
+ doReturn(futureVersion).when(storageSpy).getServiceLayoutVersion();
+ return storageSpy;
+ }).when(fsImageSpy).getStorage();
+ return fsImageSpy;
+ }).when(nn0).getFSImage();
+
+ // Roll edit logs a few times to inflate txid
+ nn0.getRpcServer().rollEditLog();
+ nn0.getRpcServer().rollEditLog();
+ // Make checkpoint
+ NameNodeAdapter.enterSafeMode(nn0, false);
+ NameNodeAdapter.saveNamespace(nn0);
+ NameNodeAdapter.leaveSafeMode(nn0);
+
+ long expectedCheckpointTxId = NameNodeAdapter.getNamesystem(nn0)
+ .getFSImage().getMostRecentCheckpointTxId();
+ assertEquals(11, expectedCheckpointTxId);
+
+ for (int i = 1; i < maxNNCount; i++) {
+ // BootstrapStandby on Standby NameNode
+ bs.setConf(cluster.getConfiguration(i));
+ bs.run(new String[]{"-force"});
Review Comment:
This returns a failure code, ERR_CODE_INVALID_VERSION (3). The
assertNNHasCheckpoints on the next line throws an NPE because the name dir is
empty. Here is the output from my test run:
`2023-09-07T22:03:52,791 ERROR ha.BootstrapStandby
(BootstrapStandby.java:doRun(217)) - Layout version on remote node (-67) does
not match this node's layout version (-68)`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]