You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uniffle.apache.org by zu...@apache.org on 2023/03/31 11:34:45 UTC

[incubator-uniffle] branch master updated: [MINOR] fix: set the default app number in `AccessAppQuotaChecker` (#786)

This is an automated email from the ASF dual-hosted git repository.

zuston pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 64924c6e [MINOR] fix: set the default app number in `AccessAppQuotaChecker` (#786)
64924c6e is described below

commit 64924c6ed735ba180c9701a3b706f60568757125
Author: jokercurry <84...@users.noreply.github.com>
AuthorDate: Fri Mar 31 19:34:40 2023 +0800

    [MINOR] fix: set the default app number in `AccessAppQuotaChecker` (#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.
---
 .../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 88cb0ca5..54456827 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 -> JavaUtils.newConcurrentMap());
-    Integer defaultAppNum = defaultUserApps.getOrDefault(user, quotaAppNum);
+    Integer defaultAppNum = defaultUserApps.computeIfAbsent(user, x -> quotaAppNum);
     synchronized (this) {
       int currentAppNum = appAndTimes.size();
       if (currentAppNum >= defaultAppNum) {