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

[fix](auth)Fix concurrency issue during role manager upgrade #42419

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
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;

Expand All @@ -64,7 +65,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);
Expand Down Expand Up @@ -320,7 +321,7 @@ public static RoleManager read(DataInput in) throws IOException {

// 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());
Expand Down
Loading