Skip to content

Commit b2175ff

Browse files
authored
Added some common interfaces for compatibility
1 parent 677f9b8 commit b2175ff

File tree

14 files changed

+47
-13
lines changed

14 files changed

+47
-13
lines changed

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnAsyncRequestType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,6 @@ public enum CnToDnAsyncRequestType {
125125
DETECT_TREE_DEVICE_VIEW_FIELD_TYPE,
126126

127127
// audit log and event write-back
128-
INSERT_RECORD
128+
INSERT_RECORD,
129+
ENABLE_SEPARATION_OF_ADMIN_POWERS,
129130
}

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public ConfigManager() throws IOException {
369369
NodeInfo nodeInfo = new NodeInfo();
370370
ClusterSchemaInfo clusterSchemaInfo = new ClusterSchemaInfo();
371371
PartitionInfo partitionInfo = new PartitionInfo();
372-
AuthorInfo authorInfo = new AuthorInfo();
372+
AuthorInfo authorInfo = createAuthorInfo();
373373
ProcedureInfo procedureInfo = new ProcedureInfo(this);
374374
UDFInfo udfInfo = new UDFInfo();
375375
TriggerInfo triggerInfo = new TriggerInfo();
@@ -409,8 +409,8 @@ public ConfigManager() throws IOException {
409409
new ClusterSchemaQuotaStatistics(
410410
COMMON_CONF.getSeriesLimitThreshold(), COMMON_CONF.getDeviceLimitThreshold()));
411411
this.partitionManager = new PartitionManager(this, partitionInfo);
412-
this.permissionManager = new PermissionManager(this, authorInfo);
413-
this.procedureManager = new ProcedureManager(this, procedureInfo);
412+
this.permissionManager = createPermissionManager(authorInfo);
413+
this.procedureManager = createProcedureManager(procedureInfo);
414414
this.udfManager = new UDFManager(this, udfInfo);
415415
this.triggerManager = new TriggerManager(this, triggerInfo);
416416
this.cqManager = new CQManager(this);
@@ -435,6 +435,18 @@ public void initConsensusManager() throws IOException {
435435
this.consensusManager.get().start();
436436
}
437437

438+
protected PermissionManager createPermissionManager(AuthorInfo authorInfo) {
439+
return new PermissionManager(this, authorInfo);
440+
}
441+
442+
protected ProcedureManager createProcedureManager(ProcedureInfo procedureInfo) {
443+
return new ProcedureManager(this, procedureInfo);
444+
}
445+
446+
protected AuthorInfo createAuthorInfo() {
447+
return new AuthorInfo();
448+
}
449+
438450
protected void setNodeManager(NodeInfo nodeInfo) {
439451
this.nodeManager = new NodeManager(this, nodeInfo);
440452
}

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/PermissionManager.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public class PermissionManager {
4444

4545
private static final Logger LOGGER = LoggerFactory.getLogger(PermissionManager.class);
4646

47-
private final ConfigManager configManager;
48-
private final AuthorInfo authorInfo;
47+
protected final ConfigManager configManager;
48+
protected final AuthorInfo authorInfo;
4949

5050
public PermissionManager(final ConfigManager configManager, final AuthorInfo authorInfo) {
5151
this.configManager = configManager;
@@ -106,7 +106,7 @@ public PermissionInfoResp queryPermission(final AuthorPlan authorPlan) {
106106
}
107107
}
108108

109-
private ConsensusManager getConsensusManager() {
109+
protected ConsensusManager getConsensusManager() {
110110
return configManager.getConsensusManager();
111111
}
112112

@@ -145,4 +145,9 @@ public TPermissionInfoResp getUser(String username) throws AuthException {
145145
public String getUserName(long userId) throws AuthException {
146146
return authorInfo.getUserName(userId);
147147
}
148+
149+
public TSStatus enableSeparationOfPowers(
150+
String systemAdminUsername, String securityAdminUsername, String auditAdminUsername) {
151+
throw new UnsupportedOperationException("Enable separation of powers is not supported");
152+
}
148153
}

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,7 @@ private TSStatus waitingProcedureFinished(final long procedureId) {
17991799
* @param procedure The specific procedure
18001800
* @return TSStatus the running result of this procedure
18011801
*/
1802-
private TSStatus waitingProcedureFinished(Procedure<?> procedure) {
1802+
protected TSStatus waitingProcedureFinished(Procedure<?> procedure) {
18031803
if (procedure == null) {
18041804
LOGGER.error("Unexpected null procedure parameters for waitingProcedureFinished");
18051805
return RpcUtils.getStatus(TSStatusCode.INTERNAL_SERVER_ERROR);

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/HeartbeatService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private void heartbeatLoopBody() {
138138
});
139139
}
140140

141-
private TDataNodeHeartbeatReq genHeartbeatReq() {
141+
protected TDataNodeHeartbeatReq genHeartbeatReq() {
142142
/* Generate heartbeat request */
143143
TDataNodeHeartbeatReq heartbeatReq = new TDataNodeHeartbeatReq();
144144
heartbeatReq.setHeartbeatTimestamp(System.nanoTime());

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/auth/AuthorInfo.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public class AuthorInfo implements SnapshotProcessor {
5151
public static final CommonConfig COMMON_CONFIG = CommonDescriptor.getInstance().getConfig();
5252
public static final String NO_USER_MSG = "No such user : ";
5353

54-
private IAuthorizer authorizer;
55-
private volatile IAuthorPlanExecutor authorPlanExecutor;
54+
protected IAuthorizer authorizer;
55+
protected volatile IAuthorPlanExecutor authorPlanExecutor;
5656

5757
public AuthorInfo() {
5858
try {
@@ -149,6 +149,11 @@ public TPermissionInfoResp getUserPermissionInfo(String username, ModelType type
149149
return authorPlanExecutor.getUserPermissionInfo(username, type);
150150
}
151151

152+
public TSStatus enableSeparationOfAdminPowers(
153+
String systemAdminUsername, String securityAdminUsername, String auditAdminUsername) {
154+
throw new UnsupportedOperationException("EnableSeparationOfAdminPowers is not supported");
155+
}
156+
152157
@TestOnly
153158
public void clear() throws AuthException {
154159
File userFolder = new File(COMMON_CONFIG.getUserFolder());

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/store/ProcedureType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public enum ProcedureType {
114114
/** Auth privilege */
115115
AUTH_OPERATE_PROCEDURE((short) 1300),
116116

117+
ENABLE_SEPARATION_OF_ADMIN_POWERS_PROCEDURE((short) 1301),
118+
117119
/** TTL */
118120
SET_TTL_PROCEDURE((short) 1400),
119121

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,7 @@ protected IConfigTask visitShowCurrentTimestamp(
13871387
protected IConfigTask visitRelationalAuthorPlan(
13881388
RelationalAuthorStatement node, MPPQueryContext context) {
13891389
context.setQueryType(node.getQueryType());
1390+
node.setExecutedByUserId(context.getUserId());
13901391
TSStatus status = node.checkStatementIsValid(context.getSession().getUserName());
13911392
if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
13921393
throw new AccessDeniedException(status.getMessage());

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TreeConfigTaskVisitor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ public IConfigTask visitTestConnection(
312312

313313
@Override
314314
public IConfigTask visitAuthor(AuthorStatement statement, MPPQueryContext context) {
315+
statement.setExecutedByUserId(context.getUserId());
315316
if (statement.getAuthorType() == AuthorType.UPDATE_USER) {
316317
visitUpdateUser(statement);
317318
}

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,6 @@ public enum StatementType {
188188

189189
SET_CONFIGURATION,
190190

191-
FAST_LAST_QUERY
191+
FAST_LAST_QUERY,
192+
SHOW_CONFIGURATION,
192193
}

0 commit comments

Comments
 (0)