Skip to content

Commit eeb9e25

Browse files
author
shiwenyan
committed
Fix OOM problem for PIPE.
1 parent a0dbf9b commit eeb9e25

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -169,35 +169,31 @@ public List<Integer> checkUserPathPrivileges(
169169
String username, List<? extends PartialPath> allPath, PrivilegeType permission) {
170170
checkCacheAvailable();
171171
List<Integer> posList = new ArrayList<>();
172-
User user = iAuthorCache.getUserCache(username);
173-
if (user != null) {
174-
if (user.isOpenIdUser()) {
175-
return posList;
176-
}
177-
int pos = 0;
178-
for (PartialPath path : allPath) {
179-
if (!user.checkPathPrivilege(path, permission)) {
180-
boolean checkFromRole = false;
181-
for (String rolename : user.getRoleSet()) {
182-
Role cachedRole = iAuthorCache.getRoleCache(rolename);
183-
if (cachedRole == null) {
184-
return checkPathFromConfigNode(username, allPath, permission);
185-
}
186-
if (cachedRole.checkPathPrivilege(path, permission)) {
187-
checkFromRole = true;
188-
break;
189-
}
172+
User user = getUser(username);
173+
if (user.isOpenIdUser()) {
174+
return posList;
175+
}
176+
int pos = 0;
177+
for (PartialPath path : allPath) {
178+
if (!user.checkPathPrivilege(path, permission)) {
179+
boolean checkFromRole = false;
180+
for (String rolename : user.getRoleSet()) {
181+
Role cachedRole = iAuthorCache.getRoleCache(rolename);
182+
if (cachedRole == null) {
183+
checkRoleFromConfigNode(username, rolename);
190184
}
191-
if (!checkFromRole) {
192-
posList.add(pos);
185+
if (cachedRole.checkPathPrivilege(path, permission)) {
186+
checkFromRole = true;
187+
break;
193188
}
194189
}
195-
pos++;
190+
if (!checkFromRole) {
191+
posList.add(pos);
192+
}
196193
}
197-
return posList;
198-
} else {
199-
return checkPathFromConfigNode(username, allPath, permission);
194+
pos++;
200195
}
196+
return posList;
201197
}
202198

203199
@Override

0 commit comments

Comments
 (0)