File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
hadoop-hdfs-project/hadoop-hdfs/src
main/java/org/apache/hadoop/hdfs/server/namenode
test/java/org/apache/hadoop/hdfs/server/namenode Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -582,12 +582,12 @@ void doImportCheckpoint(FSNamesystem target) throws IOException {
582582
583583 if (checkpointDirs == null || checkpointDirs .isEmpty ()) {
584584 throw new IOException ("Cannot import image from a checkpoint. "
585- + "\" dfs.namenode.checkpoint.dir\" is not set." );
585+ + "\" dfs.namenode.checkpoint.dir\" is not set." );
586586 }
587587
588588 if (checkpointEditsDirs == null || checkpointEditsDirs .isEmpty ()) {
589589 throw new IOException ("Cannot import image from a checkpoint. "
590- + "\" dfs.namenode.checkpoint.dir\" is not set." );
590+ + "\" dfs.namenode.checkpoint.edits. dir\" is not set." );
591591 }
592592
593593 FSImage realImage = target .getFSImage ();
Original file line number Diff line number Diff line change 8080import org .apache .hadoop .hdfs .util .MD5FileUtils ;
8181import org .apache .hadoop .test .GenericTestUtils ;
8282import org .apache .hadoop .test .PathUtils ;
83+ import org .apache .hadoop .test .LambdaTestUtils ;
8384import org .apache .hadoop .util .Time ;
8485import org .junit .Assert ;
8586import org .junit .Assume ;
@@ -275,6 +276,22 @@ public void testSaveAndLoadStripedINodeFile() throws IOException{
275276 }
276277 }
277278
279+ @ Test
280+ public void testImportCheckpoint () throws Exception {
281+ Configuration conf = new Configuration ();
282+ conf .set (DFSConfigKeys .DFS_NAMENODE_CHECKPOINT_EDITS_DIR_KEY , "" );
283+ try (MiniDFSCluster cluster = new MiniDFSCluster .Builder (conf ).build ()){
284+ cluster .waitActive ();
285+ FSNamesystem fsn = cluster .getNamesystem ();
286+ FSImage fsImage = new FSImage (conf );
287+ LambdaTestUtils .intercept (
288+ IOException .class ,
289+ "Cannot import image from a checkpoint. "
290+ + "\" dfs.namenode.checkpoint.edits.dir\" is not set." ,
291+ () -> fsImage .doImportCheckpoint (fsn ));
292+ }
293+ }
294+
278295 /**
279296 * Test if a INodeFileUnderConstruction with BlockInfoStriped can be
280297 * saved and loaded by FSImageSerialization
You can’t perform that action at this time.
0 commit comments