This is an automated email from the ASF dual-hosted git repository.
roryqi pushed a commit to branch branch-0.7
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/branch-0.7 by this push:
new 71a9c7a7 [MINOR][0.7] Avoid returning null in defaultUserApps when
quota file does't config user (#822)
71a9c7a7 is described below
commit 71a9c7a7a19b5c74ce11ccb9e06484b6bad34050
Author: jokercurry <[email protected]>
AuthorDate: Fri Apr 14 18:46:01 2023 +0800
[MINOR][0.7] Avoid returning null in defaultUserApps when quota file does't
config user (#822)
### 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.
---
.../src/main/java/org/apache/uniffle/coordinator/QuotaManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/coordinator/src/main/java/org/apache/uniffle/coordinator/QuotaManager.java
b/coordinator/src/main/java/org/apache/uniffle/coordinator/QuotaManager.java
index c9bb635a..f797a832 100644
--- a/coordinator/src/main/java/org/apache/uniffle/coordinator/QuotaManager.java
+++ b/coordinator/src/main/java/org/apache/uniffle/coordinator/QuotaManager.java
@@ -117,7 +117,7 @@ public class QuotaManager {
public boolean checkQuota(String user, String uuid) {
Map<String, Long> appAndTimes = currentUserAndApp.computeIfAbsent(user, x
-> Maps.newConcurrentMap());
- Integer defaultAppNum = defaultUserApps.getOrDefault(user, quotaAppNum);
+ Integer defaultAppNum = defaultUserApps.computeIfAbsent(user, x ->
quotaAppNum);
synchronized (this) {
int currentAppNum = appAndTimes.size();
if (currentAppNum >= defaultAppNum) {