Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MINOR] Avoid returning null in defaultUserApps when quota file does't config user #786

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

smallzhongfeng
Copy link
Contributor

What changes were proposed in this pull request?

map.getOrDefault() => map.computeIfAbsent()

Why are the changes needed?

If do not define the user and app num in the quota configuration file, it will appear that the defaultUserApps does not have the corresponding app number for this user, because we did not include the quotaAppNum in the defaultUserApps.

before :
The log from coordinator is [ERROR] 2023-03-28 19:24:11,18 Grpc-260 AccessAppQuotaChecker check - Denied by AccessAppQuotaChecker => User: xxxx, current app num is: 3, default app num is: null.

after :
The log from coordinator is [ERROR] 2023-03-31 14:32:21,228 Grpc-240 AccessAppQuotaChecker check - Denied by AccessAppQuotaChecker => User: xxxx, current app num is: 3, default app num is: 3.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Origin uts.

@smallzhongfeng smallzhongfeng changed the title [MINOR] Avoid returning null values in defaultUserApps [MINOR] Avoid returning null in defaultUserApps Mar 31, 2023
@smallzhongfeng smallzhongfeng changed the title [MINOR] Avoid returning null in defaultUserApps [MINOR] Avoid returning null in defaultUserApps when quota file does't config user Mar 31, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #786 (af1dcfc) into master (ea5a3ba) will increase coverage by 1.45%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #786      +/-   ##
============================================
+ Coverage     57.86%   59.31%   +1.45%     
  Complexity     2028     2028              
============================================
  Files           298      284      -14     
  Lines         14520    12554    -1966     
  Branches       1185     1185              
============================================
- Hits           8402     7447     -955     
+ Misses         5643     4690     -953     
+ Partials        475      417      -58     
Impacted Files Coverage Δ
...a/org/apache/uniffle/coordinator/QuotaManager.java 84.41% <100.00%> (ø)

... and 17 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@smallzhongfeng
Copy link
Contributor Author

cc @jerqi @zuston @leixm Not a big change. Thanks :-)

@zuston
Copy link
Member

zuston commented Mar 31, 2023

LGTM. I hadn't noticed this difference between getOrDefault and computeIfAbsent before

@zuston zuston merged commit 64924c6 into apache:master Mar 31, 2023
@zuston
Copy link
Member

zuston commented Mar 31, 2023

Thanks @smallzhongfeng Merged.

@smallzhongfeng
Copy link
Contributor Author

Thanks for your review! @zuston

xianjingfeng pushed a commit to xianjingfeng/incubator-uniffle that referenced this pull request Apr 5, 2023
…pache#786)

### What changes were proposed in this pull request?
`map.getOrDefault()` => `map.computeIfAbsent()`

### Why are the changes needed?
If do not define the user and app num  in the quota configuration file, it will appear that the `defaultUserApps` does not have the corresponding app number for this user, because we did not include the `quotaAppNum` in the `defaultUserApps`. 

**before** :
The log from coordinator is `[ERROR] 2023-03-28 19:24:11,18 Grpc-260 AccessAppQuotaChecker check - Denied by AccessAppQuotaChecker => User: xxxx, current app num is: 3, default app num is: null.`

**after** :
The log from coordinator is `[ERROR] 2023-03-31 14:32:21,228 Grpc-240 AccessAppQuotaChecker check - Denied by AccessAppQuotaChecker => User: xxxx, current app num is: 3, default app num is: 3.`

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Existing UTs.
@jerqi
Copy link
Contributor

jerqi commented Apr 13, 2023

@smallzhongfeng There is a fix. It should be merged to branch 0.7. But there is conflicts with branch 0.7. Could you raise a pr to branch 0.7?

@smallzhongfeng smallzhongfeng deleted the uniffle-null branch May 9, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants