K0K0V0K commented on code in PR #4655:
URL: https://github.com/apache/hadoop/pull/4655#discussion_r1064630413


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ConfigurationProperties.java:
##########
@@ -94,6 +108,42 @@ public Map<String, String> getPropertiesWithPrefix(
     return properties;
   }
 
+  /**
+   * Update or create value in the nodes.
+   * @param name name of the property
+   * @param value value of the property
+   */
+  public void set(String name, String value) {
+    PrefixNode node = getNode(name);

Review Comment:
   if the node is null, than the getNode will create a WARNING message
   ```
     /**
      * Finds the node that matches the whole key or create it, if it does not 
exist.
      * @param name name of the property
      * @return the found or created node, if the name is empty, than return 
with null
      */
     private PrefixNode getNode(String name) {
       List<String> propertyKeyParts = splitPropertyByDelimiter(name);
       if (!propertyKeyParts.isEmpty()) {
         return findOrCreatePrefixNode(null, propertyKeyParts.iterator());
       } else {
         LOG.warn("Empty configuration property");
         return null;
       }
     }
   ```



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ConfigurationProperties.java:
##########
@@ -94,6 +108,42 @@ public Map<String, String> getPropertiesWithPrefix(
     return properties;
   }
 
+  /**
+   * Update or create value in the nodes.
+   * @param name name of the property
+   * @param value value of the property
+   */
+  public void set(String name, String value) {
+    PrefixNode node = getNode(name);
+    if (node != null) {
+      node.getValues().put(name, value);
+    }
+  }
+
+  /**
+   * Delete value from nodes.
+   * @param name name of the property
+   */
+  public void unset(String name) {
+    PrefixNode node = getNode(name);
+    if (node != null) {

Review Comment:
   if the node is null, than the getNode will create a WARNING message
   ```
     /**
      * Finds the node that matches the whole key or create it, if it does not 
exist.
      * @param name name of the property
      * @return the found or created node, if the name is empty, than return 
with null
      */
     private PrefixNode getNode(String name) {
       List<String> propertyKeyParts = splitPropertyByDelimiter(name);
       if (!propertyKeyParts.isEmpty()) {
         return findOrCreatePrefixNode(null, propertyKeyParts.iterator());
       } else {
         LOG.warn("Empty configuration property");
         return null;
       }
     }
   ```



-- 
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.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to