hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (HDDS-1093) Configuration tab in OM/SCM ui is not displaying the correct values
Date Tue, 05 Mar 2019 23:19:00 GMT

     [ https://issues.apache.org/jira/browse/HDDS-1093?focusedWorklogId=208152&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-208152
]

ASF GitHub Bot logged work on HDDS-1093:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Mar/19 23:18
            Start Date: 05/Mar/19 23:18
    Worklog Time Spent: 10m 
      Work Description: bharatviswa504 commented on pull request #527: HDDS-1093. Configuration
tab in OM/SCM ui is not displaying the correct values
URL: https://github.com/apache/hadoop/pull/527#discussion_r262732681
 
 

 ##########
 File path: hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestOzoneConfiguration.java
 ##########
 @@ -0,0 +1,145 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdds.conf;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.junit.*;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Test class for OzoneConfiguration.
+ */
+public class TestOzoneConfiguration {
+
+  private Configuration conf;
+
+  @Rule
+  public TemporaryFolder tempConfigs = new TemporaryFolder();
+
+  @Before
+  public void setUp() throws Exception {
+    conf = new OzoneConfiguration();
+  }
+
+  private void startConfig(BufferedWriter out) throws IOException {
+    out.write("<?xml version=\"1.0\"?>\n");
+    out.write("<configuration>\n");
+  }
+
+  private void endConfig(BufferedWriter out) throws IOException {
+    out.write("</configuration>\n");
+    out.flush();
+    out.close();
+  }
+
+  @Test
+  public void testGetAllPropertiesByTags() throws Exception {
+    File coreDefault = tempConfigs.newFile("core-default-test.xml");
+    File coreSite = tempConfigs.newFile("core-site-test.xml");
+    try (BufferedWriter out = new BufferedWriter(new FileWriter(coreDefault))) {
+      startConfig(out);
+      appendProperty(out, "hadoop.tags.system", "YARN,HDFS,NAMENODE");
+      appendProperty(out, "hadoop.tags.custom", "MYCUSTOMTAG");
+      appendPropertyByTag(out, "dfs.cblock.trace.io", "false", "YARN");
+      appendPropertyByTag(out, "dfs.replication", "1", "HDFS");
+      appendPropertyByTag(out, "dfs.namenode.logging.level", "INFO",
+          "NAMENODE");
+      appendPropertyByTag(out, "dfs.random.key", "XYZ", "MYCUSTOMTAG");
+      endConfig(out);
+
+      Path fileResource = new Path(coreDefault.getAbsolutePath());
+      conf.addResource(fileResource);
+      assertEq(conf.getAllPropertiesByTag("MYCUSTOMTAG")
+          .getProperty("dfs.random.key"), "XYZ");
+    }
+
+    try (BufferedWriter out = new BufferedWriter(new FileWriter(coreSite))) {
+      startConfig(out);
+      appendProperty(out, "dfs.random.key", "ABC");
+      appendProperty(out, "dfs.replication", "3");
+      appendProperty(out, "dfs.cblock.trace.io", "true");
+      endConfig(out);
+
+      Path fileResource = new Path(coreSite.getAbsolutePath());
+      conf.addResource(fileResource);
+    }
+
+    // Test if values are getting overridden even without tags being present
+    assertEq("3", conf.getAllPropertiesByTag("HDFS")
+        .getProperty("dfs.replication"));
+    assertEq("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG")
+        .getProperty("dfs.random.key"));
+    assertEq("true", conf.getAllPropertiesByTag("YARN")
+        .getProperty("dfs.cblock.trace.io"));
+  }
+
+  private void appendProperty(BufferedWriter out, String name, String val)
+      throws IOException {
+    this.appendProperty(out, name, val, false);
+  }
+
+  private void appendProperty(BufferedWriter out, String name, String val,
+                              boolean isFinal) throws IOException {
+    out.write("<property>");
+    out.write("<name>");
+    out.write(name);
+    out.write("</name>");
+    out.write("<value>");
+    out.write(val);
+    out.write("</value>");
+    if (isFinal) {
+      out.write("<final>true</final>");
+    }
+    out.write("</property>\n");
+  }
+
+  private void appendPropertyByTag(BufferedWriter out, String name, String val,
+                                   String tags) throws IOException {
+    this.appendPropertyByTag(out, name, val, false, tags);
+  }
+
+  private void appendPropertyByTag(BufferedWriter out, String name, String val,
+                                   boolean isFinal,
+                                   String tag) throws IOException {
+    out.write("<property>");
+    out.write("<name>");
+    out.write(name);
+    out.write("</name>");
+    out.write("<value>");
+    out.write(val);
+    out.write("</value>");
+    if (isFinal) {
+      out.write("<final>true</final>");
+    }
+    out.write("<tag>");
+    out.write(tag);
+    out.write("</tag>");
+    out.write("</property>\n");
+  }
+
+  private static void assertEq(Object a, Object b) {
 
 Review comment:
   Instead we can directly use assertEquals, we don't need to do System.out.println
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 208152)
    Time Spent: 2h 50m  (was: 2h 40m)

> Configuration tab in OM/SCM ui is not displaying the correct values
> -------------------------------------------------------------------
>
>                 Key: HDDS-1093
>                 URL: https://issues.apache.org/jira/browse/HDDS-1093
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>          Components: Ozone Manager, SCM
>            Reporter: Sandeep Nemuri
>            Assignee: Vivek Ratnavel Subramanian
>            Priority: Critical
>              Labels: pull-request-available
>         Attachments: image-2019-02-12-19-47-18-332.png
>
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> Configuration tab in OM/SCM ui is not displaying the correct/configured values, rather
it is displaying the default values.
> !image-2019-02-12-19-47-18-332.png!
> {code:java}
> [hdfs@freonnode10 hadoop]$ curl -s http://freonnode10:9874/conf | grep ozone.om.handler.count.key
> <property><name>ozone.om.handler.count.key</name><value>40</value><final>false</final><source>ozone-site.xml</source></property>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message