[ 
https://issues.apache.org/jira/browse/YARN-11190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17656294#comment-17656294
 ] 

ASF GitHub Bot commented on YARN-11190:
---------------------------------------

szilard-nemeth commented on code in PR #4471:
URL: https://github.com/apache/hadoop/pull/4471#discussion_r1065113707


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/CSMappingPlacementRule.java:
##########
@@ -228,7 +228,11 @@ private VariableContext createVariableContext(
       ApplicationSubmissionContext asc, String user) {
     VariableContext vctx = new VariableContext();
 
-    vctx.put("%user", cleanName(user));
+    String cleanedName = cleanName(user);
+    if (!user.equals(cleanedName)) {
+      vctx.putOriginal("%user", user);
+    }
+    vctx.put("%user", cleanedName);

Review Comment:
   Yeah, the whole point is that if we don't keep the originalName separately 
(e.g. test.user) then the VariableMatcher will try to match for test_dot_user 
instead) so subsequent mapping rule actions won't be applied.
   
   Just try this out by commenting out the code block you think is unnecessary, 
the test called 
TestCSMappingPlacementRule#testOriginalUserNameWithDotCanBeUsedInMatchExpression
 will fail immediately)





> CS Mapping rule bug: User matcher does not work correctly for usernames with 
> dot
> --------------------------------------------------------------------------------
>
>                 Key: YARN-11190
>                 URL: https://issues.apache.org/jira/browse/YARN-11190
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: capacity scheduler
>            Reporter: Szilard Nemeth
>            Assignee: Szilard Nemeth
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: testUserNameSetDefaultAndPlaceWith2Rules.log, 
> testUserNameSetDefaultAndPlaceWith2RulesUsernameReplacedWithDot.log, 
> testcases.patch
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Given the following scenario, the placement engine does not work as expected.
> A user with a '.' (dot) inside his/her username submits a job.
> Let the username be "test.user"
> There are 2 mapping rules: 
> 1. The matcher matches the user with name "test.user" and has an associated 
> mapping rule action that sets the default queue to "root.user".
> 2. The second mapping rule matches the same user ("test.user") and places the 
> application to the default queue.
> *Expactation:*
> When the user with username "root.user" submits a job, the application will 
> be placed to queue "root.user".
> *Observed behaviour:* 
> The application is placed to test_dot_user.
> This means that the dot is replaced to "{_}dot{_}" too early so that the 
> default queue is set incorrectly.
>  
> I have attached a patch file that demonstrates this behaviour with 2 new 
> testcases along with the logs of these testcases.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to