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

github-bot pushed a commit to branch auto-pick-43766-branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/auto-pick-43766-branch-3.0 by 
this push:
     new 605c342354a [fix](cloud) Fix replay default compute group failed throw 
exception (#43766)
605c342354a is described below

commit 605c342354a097cb0e83da30622bbfcc37d9039c
Author: deardeng <deng...@selectdb.com>
AuthorDate: Wed Nov 13 19:13:24 2024 +0800

    [fix](cloud) Fix replay default compute group failed throw exception 
(#43766)
    
    ### What problem does this PR solve?
    
    due to #42504, replay thread will check default compute group auth, if
    failed will throw exception, lead to fe can't start
    
    ```
    2024-11-12 06:49:46,432 ERROR (stateListener|14) 
[EditLog.loadJournal():1248] replay Operation Type 69, log id: 1124
    org.apache.doris.cloud.qe.ComputeGroupException: errCode = 2, detailMessage 
= set default compute group failed, user regression_test_cloud_user2 has no 
permission to use compute group 'smoke_test_cluster_01', please grant use 
privilege first , ComputeGroupException: 
CURRENT_USER_NO_AUTH_TO_USE_COMPUTE_GROUP, you canuse SQL `GRANT USAGE_PRIV ON 
COMPUTE GROUP {compute_group_name} TO {user}`
            at 
org.apache.doris.mysql.privilege.UserProperty.checkCloudDefaultCluster(UserProperty.java:398)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.mysql.privilege.UserProperty.update(UserProperty.java:263) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.mysql.privilege.UserPropertyMgr.updateUserProperty(UserPropertyMgr.java:91)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.mysql.privilege.Auth.updateUserPropertyInternal(Auth.java:1084)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.mysql.privilege.Auth.replayUpdateUserProperty(Auth.java:1077) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at org.apache.doris.persist.EditLog.loadJournal(EditLog.java:505) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at org.apache.doris.catalog.Env.replayJournal(Env.java:2962) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at org.apache.doris.catalog.Env.transferToMaster(Env.java:1552) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at org.apache.doris.catalog.Env.access$1200(Env.java:345) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at org.apache.doris.catalog.Env$5.runOneCycle(Env.java:2841) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at org.apache.doris.common.util.Daemon.run(Daemon.java:116) 
~[doris-fe.jar:1.2-SNAPSHOT]
    ```
    
    fix:
    ignore check default compute group auth when isReplay eq true
    
    Issue Number: close #xxx
    
    Related PR: #42504
---
 .../java/org/apache/doris/mysql/privilege/UserProperty.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
index e334937f2db..e4a76b23820 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
@@ -260,9 +260,9 @@ public class UserProperty implements Writable {
 
                 newDefaultLoadCluster = value;
             }  else if (keyArr[0].equalsIgnoreCase(DEFAULT_CLOUD_CLUSTER)) {
-                newDefaultCloudCluster = checkCloudDefaultCluster(keyArr, 
value, DEFAULT_CLOUD_CLUSTER);
+                newDefaultCloudCluster = checkCloudDefaultCluster(keyArr, 
value, DEFAULT_CLOUD_CLUSTER, isReplay);
             } else if (keyArr[0].equalsIgnoreCase(DEFAULT_COMPUTE_GROUP)) {
-                newDefaultCloudCluster = checkCloudDefaultCluster(keyArr, 
value, DEFAULT_COMPUTE_GROUP);
+                newDefaultCloudCluster = checkCloudDefaultCluster(keyArr, 
value, DEFAULT_COMPUTE_GROUP, isReplay);
             } else if (keyArr[0].equalsIgnoreCase(PROP_MAX_QUERY_INSTANCES)) {
                 // set property "max_query_instances" = "1000"
                 if (keyArr.length != 1) {
@@ -390,8 +390,12 @@ public class UserProperty implements Writable {
         defaultCloudCluster = newDefaultCloudCluster;
     }
 
-    private String checkCloudDefaultCluster(String[] keyArr, String value, 
String defaultComputeGroup)
+    private String checkCloudDefaultCluster(String[] keyArr, String value, 
String defaultComputeGroup, boolean isReplay)
             throws ComputeGroupException, DdlException {
+        // isReplay not check auth, not throw exception
+        if (isReplay) {
+            return value;
+        }
         // check cluster auth
         if (!Strings.isNullOrEmpty(value) && 
!Env.getCurrentEnv().getAuth().checkCloudPriv(
             new UserIdentity(qualifiedUser, "%"), value, PrivPredicate.USAGE, 
ResourceTypeEnum.CLUSTER)) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to