Skip to content

Commit 944002a

Browse files
Remove extra user caching for REST services and migrate to the unified user check cache. (#17324)
1 parent eacd93b commit 944002a

File tree

7 files changed

+3
-117
lines changed

7 files changed

+3
-117
lines changed

iotdb-client/session/src/test/resources/iotdb-common.properties

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ enable_rest_service=true
3333
# Whether to display rest service interface information through swagger. eg: http://ip:port/swagger.json
3434
# enable_swagger=false
3535

36-
# the expiration time of the user login information cache (in seconds)
37-
# cache_expire_in_seconds=28800
38-
39-
# maximum number of users can be stored in the user login cache.
40-
# cache_max_num=100
41-
42-
# init capacity of users can be stored in the user login cache.
43-
# cache_init_num=10
44-
4536
# is SSL enabled
4637
# enable_https=false
4738

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceDescriptor.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,6 @@ private void loadProps(TrimProperties properties) {
109109
Integer.parseInt(
110110
properties.getProperty(
111111
"idle_timeout_in_seconds", Integer.toString(conf.getIdleTimeoutInSeconds()))));
112-
conf.setCacheExpireInSeconds(
113-
Integer.parseInt(
114-
properties.getProperty(
115-
"cache_expire_in_seconds", Integer.toString(conf.getCacheExpireInSeconds()))));
116-
conf.setCacheInitNum(
117-
Integer.parseInt(
118-
properties.getProperty("cache_init_num", Integer.toString(conf.getCacheInitNum()))));
119-
conf.setCacheMaxNum(
120-
Integer.parseInt(
121-
properties.getProperty("cache_max_num", Integer.toString(conf.getCacheMaxNum()))));
122112
}
123113

124114
/**

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/AuthorizationFilter.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
@Provider
4848
public class AuthorizationFilter implements ContainerRequestFilter, ContainerResponseFilter {
4949

50-
private final UserCache userCache = UserCache.getInstance();
5150
IoTDBRestServiceConfig config = IoTDBRestServiceDescriptor.getInstance().getConfig();
5251

5352
private static final SessionManager SESSION_MANAGER = SessionManager.getInstance();
@@ -85,15 +84,11 @@ public void filter(ContainerRequestContext containerRequestContext) throws IOExc
8584
containerRequestContext.abortWith(resp);
8685
return;
8786
}
88-
User user = userCache.getUser(authorizationHeader);
87+
User user = checkLogin(containerRequestContext, authorizationHeader);
8988
if (user == null) {
90-
user = checkLogin(containerRequestContext, authorizationHeader);
91-
if (user == null) {
92-
return;
93-
} else {
94-
userCache.setUser(authorizationHeader, user);
95-
}
89+
return;
9690
}
91+
9792
String sessionid = UUID.randomUUID().toString();
9893
if (SESSION_MANAGER.getCurrSession() == null) {
9994
RestClientSession restClientSession = new RestClientSession(sessionid);

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/UserCache.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

iotdb-core/datanode/src/test/resources/iotdb-common.properties

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ enable_rest_service=true
3333
# the default row limit to a REST query response when the rowSize parameter is not given in request
3434
# rest_query_default_row_size_limit=10000
3535

36-
# the expiration time of the user login information cache (in seconds)
37-
# cache_expire_in_seconds=28800
38-
39-
# maximum number of users can be stored in the user login cache.
40-
# cache_max_num=100
41-
42-
# init capacity of users can be stored in the user login cache.
43-
# cache_init_num=10
44-
4536
# is SSL enabled
4637
# enable_https=false
4738

iotdb-core/datanode/src/test/resources/iotdb-system.properties

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@ enable_rest_service=true
5050
# the default row limit to a REST query response when the rowSize parameter is not given in request
5151
# rest_query_default_row_size_limit=10000
5252

53-
# the expiration time of the user login information cache (in seconds)
54-
# cache_expire_in_seconds=28800
55-
56-
# maximum number of users can be stored in the user login cache.
57-
# cache_max_num=100
58-
59-
# init capacity of users can be stored in the user login cache.
60-
# cache_init_num=10
61-
6253
# is SSL enabled
6354
# enable_https=false
6455

iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -560,21 +560,6 @@ enable_swagger=false
560560
# Datatype: int
561561
rest_query_default_row_size_limit=10000
562562

563-
# the expiration time of the user login information cache (in seconds)
564-
# effectiveMode: restart
565-
# Datatype: int
566-
cache_expire_in_seconds=28800
567-
568-
# maximum number of users can be stored in the user login cache.
569-
# effectiveMode: restart
570-
# Datatype: int
571-
cache_max_num=100
572-
573-
# init capacity of users can be stored in the user login cache.
574-
# effectiveMode: restart
575-
# Datatype: int
576-
cache_init_num=10
577-
578563
# Is client authentication required
579564
# effectiveMode: restart
580565
# Datatype: boolean

0 commit comments

Comments
 (0)