Skip to content

Commit 24615ed

Browse files
GuoPhilipseHarshitGupta11
authored andcommitted
HDFS-16338. Correct fsimage error configuration message (apache#3684). Contributed by guophilipse.
Reviewed-by: cxorm <lianp964@gmail.com> Reviewed-by: tomscut <litao@bigo.sg> Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
1 parent dd774d8 commit 24615ed

File tree

2 files changed

+19
-2
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src

2 files changed

+19
-2
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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();

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSImage.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
import org.apache.hadoop.hdfs.util.MD5FileUtils;
8181
import org.apache.hadoop.test.GenericTestUtils;
8282
import org.apache.hadoop.test.PathUtils;
83+
import org.apache.hadoop.test.LambdaTestUtils;
8384
import org.apache.hadoop.util.Time;
8485
import org.junit.Assert;
8586
import 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

0 commit comments

Comments
 (0)