From 59df5eb19f2a0cecab0c9893dd5c20d68b656de3 Mon Sep 17 00:00:00 2001 From: Uma Maheswara Rao G Date: Tue, 30 Oct 2012 01:55:39 +0000 Subject: [PATCH] HDFS-3789. JournalManager#format() should be able to throw IOException. Contributed by Ivan Kelly. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1403603 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/contrib/bkjournal/BookKeeperJournalManager.java | 2 +- .../apache/hadoop/hdfs/server/namenode/FileJournalManager.java | 2 +- .../org/apache/hadoop/hdfs/server/namenode/JournalManager.java | 2 +- .../org/apache/hadoop/hdfs/server/namenode/JournalSet.java | 2 +- .../hadoop/hdfs/server/namenode/TestGenericJournalConf.java | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 0706240a498..576cf44f269 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -95,6 +95,9 @@ Release 2.0.3-alpha - Unreleased HDFS-3695. Genericize format() to non-file JournalManagers. (todd via umamahesh) + HDFS-3789. JournalManager#format() should be able to throw IOException. + (Ivan Kelly via umamahesh) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/src/main/java/org/apache/hadoop/contrib/bkjournal/BookKeeperJournalManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/src/main/java/org/apache/hadoop/contrib/bkjournal/BookKeeperJournalManager.java index 8636fb72466..380db257035 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/src/main/java/org/apache/hadoop/contrib/bkjournal/BookKeeperJournalManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/bkjournal/src/main/java/org/apache/hadoop/contrib/bkjournal/BookKeeperJournalManager.java @@ -272,7 +272,7 @@ public class BookKeeperJournalManager implements JournalManager { } @Override - public void format(NamespaceInfo ns) { + public void format(NamespaceInfo ns) throws IOException { // Currently, BKJM automatically formats itself when first accessed. // TODO: change over to explicit formatting so that the admin can // clear out the BK storage when reformatting a cluster. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java index 51718a7bf89..a96272cbf35 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java @@ -79,7 +79,7 @@ class FileJournalManager implements JournalManager { public void close() throws IOException {} @Override - public void format(NamespaceInfo ns) { + public void format(NamespaceInfo ns) throws IOException { // Formatting file journals is done by the StorageDirectory // format code, since they may share their directory with // checkpoints, etc. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalManager.java index e4b8d9d2051..44a2f1424ee 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalManager.java @@ -41,7 +41,7 @@ public interface JournalManager extends Closeable, LogsPurgeable, * Format the underlying storage, removing any previously * stored data. */ - void format(NamespaceInfo ns); + void format(NamespaceInfo ns) throws IOException; /** * Begin writing to a new segment of the log stream, which starts at diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalSet.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalSet.java index 416663c6b06..cb0b164cc1c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalSet.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalSet.java @@ -172,7 +172,7 @@ public class JournalSet implements JournalManager { } @Override - public void format(NamespaceInfo nsInfo) { + public void format(NamespaceInfo nsInfo) throws IOException { // The iteration is done by FSEditLog itself throw new UnsupportedOperationException(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestGenericJournalConf.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestGenericJournalConf.java index 276b557ccbf..5d72b48703e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestGenericJournalConf.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestGenericJournalConf.java @@ -157,7 +157,7 @@ public class TestGenericJournalConf { } @Override - public void format(NamespaceInfo nsInfo) { + public void format(NamespaceInfo nsInfo) throws IOException { formatCalled = true; }