[
https://issues.apache.org/jira/browse/HDFS-17380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17825938#comment-17825938
]
ASF GitHub Bot commented on HDFS-17380:
---------------------------------------
Hexiaoqiao commented on code in PR #6549:
URL: https://github.com/apache/hadoop/pull/6549#discussion_r1522674630
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FsImageValidation.java:
##########
@@ -77,6 +79,35 @@ public class FsImageValidation {
static final String FS_IMAGE = "FS_IMAGE";
+ /**
+ * Use an environment variable "PRINT_ERROR" to enable/disable printing
error messages.
+ * The default is true
+ */
+ static final boolean PRINT_ERROR;
+
+ static {
+ PRINT_ERROR = getEnvBoolean("PRINT_ERROR", true);
+ }
+
+ /**
+ * @return the boolean value of an environment property.
+ * If the environment property is not set or cannot be parsed as a
boolean,
+ * return the default value.
+ */
+ static boolean getEnvBoolean(String property, boolean defaultValue) {
+ final String env = System.getenv().get(property);
+ final boolean setToNonDefault = ("" + !defaultValue).equalsIgnoreCase(env);
+ // default | setToNonDefault | value
+ // ---------------------------------
+ // true | true | false
+ // true | false | true
+ // false | true | true
+ // false | false | false
+ final boolean value = defaultValue != setToNonDefault;
Review Comment:
I am a little confused about getting this environment property value. What
about get this boolean value directly just like #getEnv
(https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FsImageValidation.java#L80~L84)?
Any more consideration here?
> FsImageValidation: remove inaccessible nodes
> --------------------------------------------
>
> Key: HDFS-17380
> URL: https://issues.apache.org/jira/browse/HDFS-17380
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: tools
> Reporter: Tsz-wo Sze
> Assignee: Tsz-wo Sze
> Priority: Major
> Labels: pull-request-available
>
> If a fsimage is corrupted, it may have inaccessible nodes. The
> FsImageValidation tool currently is able to identify the inaccessible nodes
> when validating the INodeMap. This JIRA is to update the tool to remove the
> inaccessible nodes and then save a new fsimage.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]