[
https://issues.apache.org/jira/browse/HDFS-13805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16578099#comment-16578099
]
Vinayakumar B commented on HDFS-13805:
--------------------------------------
bq. In any situation where the cluster must be genuinely re-imaged it's not
too much to ask that the admin wipe master nodes separately.
Yes, this is the ideal case in production.
Given that we already have *dfs.reformat.disabled* to disable accidental
reformats from NN, I feel it would be fine to allow JournalNodes to do fomat
based on force flag.
Note that JournalNodes format only happens after NN's local dir format, which
can be guarded by confirm prompt ( in case of interactive) and
*dfs.reformat.disabled* config.
Regarding patch,
Completely avoiding {{analyzeStorage()}} is not necessary. Just need to avoid
{{checkCurrentIsEmpty}} flag.
{code}
---
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java
+++
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java
@@ -204,12 +204,14 @@ private static void purgeMatching(File dir, List<Pattern>
patterns,
}
}
- void format(NamespaceInfo nsInfo) throws IOException {
- unlockAll();
- try {
- sd.analyzeStorage(StartupOption.FORMAT, this, true);
- } finally {
- sd.unlock();
+ void format(NamespaceInfo nsInfo, boolean force) throws IOException {
+ if (!force) {
+ unlockAll();
+ try {
+ sd.analyzeStorage(StartupOption.FORMAT, this, true);
+ } finally {
+ sd.unlock();
+ }
}
setStorageInfo(nsInfo);
{code}
can be changed to
{code}
---
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java
+++
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java
@@ -204,10 +204,10 @@ private static void purgeMatching(File dir, List<Pattern>
patterns,
}
}
- void format(NamespaceInfo nsInfo) throws IOException {
+ void format(NamespaceInfo nsInfo, boolean force) throws IOException {
unlockAll();
try {
- sd.analyzeStorage(StartupOption.FORMAT, this, true);
+ sd.analyzeStorage(StartupOption.FORMAT, this, !force);
} finally {
sd.unlock();
}
{code}
> Journal Nodes should allow to format non-empty directories with "-force"
> option
> -------------------------------------------------------------------------------
>
> Key: HDFS-13805
> URL: https://issues.apache.org/jira/browse/HDFS-13805
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: journal-node
> Affects Versions: 3.0.0-alpha4
> Reporter: Surendra Singh Lilhore
> Assignee: Surendra Singh Lilhore
> Priority: Major
> Attachments: HDFS-13805.001.patch
>
>
> HDFS-11112 completely restricted to re-format journalnode, but it should be
> allowed when *"-force"* option is given. If user feel force option can
> accidentally delete the data then he can disable it by configuring
> "*dfs.reformat.disabled*"
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]