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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 486dfe9f420 branch-2.1: [fix](auth)Fix concurrency issue during role 
manager upgrade  (#43194)
486dfe9f420 is described below

commit 486dfe9f420a0cc60b88313cdf67833651accb30
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Nov 10 00:45:07 2024 +0800

    branch-2.1: [fix](auth)Fix concurrency issue during role manager upgrade  
(#43194)
    
    Cherry-picked from #42419
    
    Co-authored-by: zhangdong <493738...@qq.com>
---
 .../src/main/java/org/apache/doris/mysql/privilege/RoleManager.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java
index 654db93f21d..5ce213e2957 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java
@@ -53,6 +53,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -63,7 +64,7 @@ public class RoleManager implements Writable, 
GsonPostProcessable {
 
     // Concurrency control is delegated by Auth, so not concurrentMap
     @SerializedName(value = "roles")
-    private Map<String, Role> roles = Maps.newHashMap();
+    private ConcurrentMap<String, Role> roles = Maps.newConcurrentMap();
 
     public RoleManager() {
         roles.put(Role.OPERATOR.getRoleName(), Role.OPERATOR);
@@ -295,7 +296,7 @@ public class RoleManager implements Writable, 
GsonPostProcessable {
 
     // should be removed after version 3.0
     private void removeClusterPrefix() {
-        Map<String, Role> newRoles = Maps.newHashMap();
+        ConcurrentMap<String, Role> newRoles = Maps.newConcurrentMap();
         for (Map.Entry<String, Role> entry : roles.entrySet()) {
             String roleName = 
ClusterNamespace.getNameFromFullName(entry.getKey());
             newRoles.put(roleName, entry.getValue());


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

Reply via email to