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


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java:
##########
@@ -3364,12 +3364,29 @@ public boolean moveReservedContainer(RMContainer 
toBeMovedContainer,
     }
   }
 
-  @Override
+   @Override
   public long checkAndGetApplicationLifetime(String queueName,
       long lifetimeRequestedByApp) {
+    CSQueue queue = getQueue(queueName);
+
+    // This handles the case where the queue does not exist,
+    // addressing the issue related to YARN-11708.
+    if (queue == null) {
+      QueuePath queuePath = new QueuePath(queueName);
+
+      writeLock.lock();
+      try {
+        queue = queueManager.createQueue(queuePath);
+      } catch (YarnException | IOException e) {
+        LOG.error("Failed to create queue '{}': ", queueName, e);

Review Comment:
   ```suggestion
           LOG.error("Failed to create queue " + queueName, e);
   ```
   
   Because the current log line wont log the exception, cause will think that 
is the 2nd param in the message



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java:
##########
@@ -3364,12 +3364,29 @@ public boolean moveReservedContainer(RMContainer 
toBeMovedContainer,
     }
   }
 
-  @Override
+   @Override
   public long checkAndGetApplicationLifetime(String queueName,
       long lifetimeRequestedByApp) {
+    CSQueue queue = getQueue(queueName);
+
+    // This handles the case where the queue does not exist,
+    // addressing the issue related to YARN-11708.
+    if (queue == null) {
+      QueuePath queuePath = new QueuePath(queueName);
+
+      writeLock.lock();

Review Comment:
   This write lock should be before the get queue call, to properly handle the 
race condition, right?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to