You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2024/09/23 08:28:42 UTC
(iotdb) branch master updated: Refactor: Removed the useless Ser/de logic in configNode read plans (#13577)
This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 697871705ec Refactor: Removed the useless Ser/de logic in configNode read plans (#13577)
697871705ec is described below
commit 697871705ec48516d92e5344c17a7ac16841ccfe
Author: Caideyipi <87...@users.noreply.github.com>
AuthorDate: Mon Sep 23 16:28:36 2024 +0800
Refactor: Removed the useless Ser/de logic in configNode read plans (#13577)
---
.../consensus/request/ConfigPhysicalPlan.java | 170 +-------
.../request/ConfigPhysicalPlanVisitor.java | 2 +-
...PipePlanV2.java => ConfigPhysicalReadPlan.java} | 14 +-
.../read/ainode/GetAINodeConfigurationPlan.java | 31 +-
.../request/read/auth/AuthorReadPlan.java | 143 ++++++
.../request/{write => read}/cq/ShowCQPlan.java | 20 +-
.../request/read/database/CountDatabasePlan.java | 51 +--
.../request/read/database/GetDatabasePlan.java | 6 +-
.../datanode/GetDataNodeConfigurationPlan.java | 30 +-
.../read/function/GetFunctionTablePlan.java | 18 +-
.../request/read/function/GetUDFJarPlan.java | 42 +-
.../request/read/model/GetModelInfoPlan.java | 32 +-
.../request/read/model/ShowModelPlan.java | 34 +-
.../read/partition/CountTimeSlotListPlan.java | 49 +--
.../read/partition/GetDataPartitionPlan.java | 66 +--
.../read/partition/GetNodePathsPartitionPlan.java | 33 +-
.../partition/GetOrCreateDataPartitionPlan.java | 10 +-
.../partition/GetOrCreateSchemaPartitionPlan.java | 3 +-
.../read/partition/GetSchemaPartitionPlan.java | 58 +--
.../read/partition/GetSeriesSlotListPlan.java | 36 +-
.../read/partition/GetTimeSlotListPlan.java | 49 +--
.../read/pipe/plugin/GetPipePluginJarPlan.java | 35 +-
.../read/pipe/plugin/GetPipePluginTablePlan.java | 18 +-
.../request/read/pipe/task/ShowPipePlanV2.java | 18 +-
.../request/read/region/GetRegionIdPlan.java | 49 +--
.../request/read/region/GetRegionInfoListPlan.java | 47 +-
.../read/subscription/ShowSubscriptionPlan.java | 18 +-
.../request/read/subscription/ShowTopicPlan.java | 18 +-
.../request/read/table/ShowTablePlan.java | 27 +-
.../read/template/CheckTemplateSettablePlan.java | 33 +-
.../read/template/GetAllSchemaTemplatePlan.java | 16 +-
.../read/template/GetAllTemplateSetInfoPlan.java | 16 +-
.../read/template/GetPathsSetTemplatePlan.java | 33 +-
.../read/template/GetSchemaTemplatePlan.java | 32 +-
.../read/template/GetTemplateSetInfoPlan.java | 37 +-
.../read/trigger/GetTransferringTriggersPlan.java | 18 +-
.../request/read/trigger/GetTriggerJarPlan.java | 42 +-
.../read/trigger/GetTriggerLocationPlan.java | 38 +-
.../request/read/trigger/GetTriggerTablePlan.java | 38 +-
.../consensus/request/read/ttl/ShowTTLPlan.java | 19 +-
.../request/{ => write}/auth/AuthorPlan.java | 99 +----
.../write/partition/RemoveRegionLocationPlan.java | 5 -
.../request/write/sync/ShowPipePlanV1.java | 59 ---
.../statemachine/ConfigRegionStateMachine.java | 22 +-
.../iotdb/confignode/manager/ConfigManager.java | 13 +-
.../apache/iotdb/confignode/manager/IManager.java | 7 +-
.../iotdb/confignode/manager/ModelManager.java | 10 +-
.../confignode/manager/PermissionManager.java | 9 +-
.../iotdb/confignode/manager/ProcedureManager.java | 2 +-
.../manager/consensus/ConsensusManager.java | 3 +-
.../iotdb/confignode/manager/cq/CQManager.java | 2 +-
.../manager/partition/PartitionManager.java | 16 +-
.../PipeConfigPhysicalPlanPatternParseVisitor.java | 2 +-
.../receiver/protocol/IoTDBConfigNodeReceiver.java | 2 +-
.../PipeConfigPhysicalPlanTSStatusVisitor.java | 2 +-
.../iotdb/confignode/persistence/AuthorInfo.java | 53 +--
.../persistence/executor/ConfigPlanExecutor.java | 14 +-
.../schema/CNPhysicalPlanGenerator.java | 2 +-
.../impl/sync/AuthOperationProcedure.java | 2 +-
.../thrift/ConfigNodeRPCServiceProcessor.java | 7 +-
.../request/ConfigPhysicalPlanSerDeTest.java | 482 +--------------------
...eConfigPhysicalPlanPatternParseVisitorTest.java | 2 +-
.../confignode/persistence/AuthorInfoTest.java | 82 ++--
.../persistence/CNPhysicalPlanGeneratorTest.java | 2 +-
.../ConfigRegionListeningQueueTest.java | 2 +-
.../pipe/receiver/PipeEnrichedProcedureTest.java | 2 +-
.../impl/sync/AuthOperationProcedureTest.java | 29 +-
67 files changed, 506 insertions(+), 1875 deletions(-)
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java
index 49dcc2bdfe4..7bfa5c50c69 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java
@@ -20,38 +20,8 @@
package org.apache.iotdb.confignode.consensus.request;
import org.apache.iotdb.commons.exception.runtime.SerializationRunTimeException;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
-import org.apache.iotdb.confignode.consensus.request.read.database.CountDatabasePlan;
-import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePlan;
-import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
-import org.apache.iotdb.confignode.consensus.request.read.function.GetFunctionTablePlan;
-import org.apache.iotdb.confignode.consensus.request.read.function.GetUDFJarPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.CountTimeSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetNodePathsPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateDataPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateSchemaPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetSchemaPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetSeriesSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetTimeSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.pipe.plugin.GetPipePluginJarPlan;
-import org.apache.iotdb.confignode.consensus.request.read.pipe.plugin.GetPipePluginTablePlan;
-import org.apache.iotdb.confignode.consensus.request.read.pipe.task.ShowPipePlanV2;
-import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionIdPlan;
-import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionInfoListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.subscription.ShowSubscriptionPlan;
import org.apache.iotdb.confignode.consensus.request.read.subscription.ShowTopicPlan;
-import org.apache.iotdb.confignode.consensus.request.read.table.ShowTablePlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.CheckTemplateSettablePlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetAllSchemaTemplatePlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetAllTemplateSetInfoPlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetPathsSetTemplatePlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetSchemaTemplatePlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetTemplateSetInfoPlan;
-import org.apache.iotdb.confignode.consensus.request.read.trigger.GetTransferringTriggersPlan;
-import org.apache.iotdb.confignode.consensus.request.read.trigger.GetTriggerJarPlan;
-import org.apache.iotdb.confignode.consensus.request.read.trigger.GetTriggerLocationPlan;
-import org.apache.iotdb.confignode.consensus.request.read.trigger.GetTriggerTablePlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.ApplyConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.UpdateClusterIdPlan;
@@ -59,7 +29,6 @@ import org.apache.iotdb.confignode.consensus.request.write.confignode.UpdateVers
import org.apache.iotdb.confignode.consensus.request.write.cq.ActiveCQPlan;
import org.apache.iotdb.confignode.consensus.request.write.cq.AddCQPlan;
import org.apache.iotdb.confignode.consensus.request.write.cq.DropCQPlan;
-import org.apache.iotdb.confignode.consensus.request.write.cq.ShowCQPlan;
import org.apache.iotdb.confignode.consensus.request.write.cq.UpdateCQLastExecTimePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.AdjustMaxRegionGroupNumPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
@@ -115,7 +84,6 @@ import org.apache.iotdb.confignode.consensus.request.write.sync.GetPipeSinkPlanV
import org.apache.iotdb.confignode.consensus.request.write.sync.PreCreatePipePlanV1;
import org.apache.iotdb.confignode.consensus.request.write.sync.RecordPipeMessagePlan;
import org.apache.iotdb.confignode.consensus.request.write.sync.SetPipeStatusPlanV1;
-import org.apache.iotdb.confignode.consensus.request.write.sync.ShowPipePlanV1;
import org.apache.iotdb.confignode.consensus.request.write.table.AddTableColumnPlan;
import org.apache.iotdb.confignode.consensus.request.write.table.CommitCreateTablePlan;
import org.apache.iotdb.confignode.consensus.request.write.table.PreCreateTablePlan;
@@ -138,8 +106,6 @@ import org.apache.iotdb.confignode.consensus.request.write.trigger.UpdateTrigger
import org.apache.iotdb.consensus.common.request.IConsensusRequest;
import org.apache.tsfile.utils.PublicBAOS;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.DataOutputStream;
import java.io.IOException;
@@ -148,11 +114,9 @@ import java.util.Objects;
public abstract class ConfigPhysicalPlan implements IConsensusRequest {
- private static final Logger LOGGER = LoggerFactory.getLogger(ConfigPhysicalPlan.class);
-
private final ConfigPhysicalPlanType type;
- protected ConfigPhysicalPlan(ConfigPhysicalPlanType type) {
+ protected ConfigPhysicalPlan(final ConfigPhysicalPlanType type) {
this.type = type;
}
@@ -162,37 +126,37 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
@Override
public ByteBuffer serializeToByteBuffer() {
- try (PublicBAOS byteArrayOutputStream = new PublicBAOS();
- DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream)) {
+ try (final PublicBAOS byteArrayOutputStream = new PublicBAOS();
+ final DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream)) {
serializeImpl(outputStream);
return ByteBuffer.wrap(byteArrayOutputStream.getBuf(), 0, byteArrayOutputStream.size());
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new SerializationRunTimeException(e);
}
}
- protected abstract void serializeImpl(DataOutputStream stream) throws IOException;
+ protected abstract void serializeImpl(final DataOutputStream stream) throws IOException;
- protected abstract void deserializeImpl(ByteBuffer buffer) throws IOException;
+ protected abstract void deserializeImpl(final ByteBuffer buffer) throws IOException;
public int getSerializedSize() throws IOException {
- PublicBAOS byteArrayOutputStream = new PublicBAOS();
- DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream);
+ final PublicBAOS byteArrayOutputStream = new PublicBAOS();
+ final DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream);
serializeImpl(outputStream);
return byteArrayOutputStream.size();
}
public static class Factory {
- public static ConfigPhysicalPlan create(ByteBuffer buffer) throws IOException {
- short planType = buffer.getShort();
- ConfigPhysicalPlanType configPhysicalPlanType =
+ public static ConfigPhysicalPlan create(final ByteBuffer buffer) throws IOException {
+ final short planType = buffer.getShort();
+ final ConfigPhysicalPlanType configPhysicalPlanType =
ConfigPhysicalPlanType.convertToConfigPhysicalPlanType(planType);
if (configPhysicalPlanType == null) {
throw new IOException("Unrecognized log configPhysicalPlanType: " + planType);
}
- ConfigPhysicalPlan plan;
+ final ConfigPhysicalPlan plan;
switch (configPhysicalPlanType) {
case RegisterDataNode:
plan = new RegisterDataNodePlan();
@@ -203,9 +167,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case RemoveDataNode:
plan = new RemoveDataNodePlan();
break;
- case GetDataNodeConfiguration:
- plan = new GetDataNodeConfigurationPlan();
- break;
case CreateDatabase:
plan = new DatabaseSchemaPlan(ConfigPhysicalPlanType.CreateDatabase);
break;
@@ -227,12 +188,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case AdjustMaxRegionGroupNum:
plan = new AdjustMaxRegionGroupNumPlan();
break;
- case CountDatabase:
- plan = new CountDatabasePlan();
- break;
- case GetDatabase:
- plan = new GetDatabasePlan();
- break;
case CreateRegionGroups:
plan = new CreateRegionGroupsPlan();
break;
@@ -254,24 +209,12 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case PollSpecificRegionMaintainTask:
plan = new PollSpecificRegionMaintainTaskPlan();
break;
- case GetSchemaPartition:
- plan = new GetSchemaPartitionPlan();
- break;
case CreateSchemaPartition:
plan = new CreateSchemaPartitionPlan();
break;
- case GetOrCreateSchemaPartition:
- plan = new GetOrCreateSchemaPartitionPlan();
- break;
- case GetDataPartition:
- plan = new GetDataPartitionPlan();
- break;
case CreateDataPartition:
plan = new CreateDataPartitionPlan();
break;
- case GetOrCreateDataPartition:
- plan = new GetOrCreateDataPartitionPlan();
- break;
case DeleteProcedure:
plan = new DeleteProcedurePlan();
break;
@@ -284,12 +227,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case DeleteDatabase:
plan = new DeleteDatabasePlan();
break;
- case ListUserDep:
- case ListRoleDep:
- case ListUserPrivilegeDep:
- case ListRolePrivilegeDep:
- case ListUserRolesDep:
- case ListRoleUsersDep:
case CreateUserDep:
case CreateRoleDep:
case DropUserDep:
@@ -301,12 +238,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case RevokeRoleDep:
case RevokeRoleFromUserDep:
case UpdateUserDep:
- case ListUser:
- case ListRole:
- case ListUserPrivilege:
- case ListRolePrivilege:
- case ListUserRoles:
- case ListRoleUsers:
case CreateUser:
case CreateRole:
case DropUser:
@@ -348,33 +279,9 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case UpdateTriggerStateInTable:
plan = new UpdateTriggerStateInTablePlan();
break;
- case GetTriggerTable:
- plan = new GetTriggerTablePlan();
- break;
- case GetTriggerLocation:
- plan = new GetTriggerLocationPlan();
- break;
- case GetTriggerJar:
- plan = new GetTriggerJarPlan();
- break;
case CreateSchemaTemplate:
plan = new CreateSchemaTemplatePlan();
break;
- case GetAllSchemaTemplate:
- plan = new GetAllSchemaTemplatePlan();
- break;
- case GetSchemaTemplate:
- plan = new GetSchemaTemplatePlan();
- break;
- case CheckTemplateSettable:
- plan = new CheckTemplateSettablePlan();
- break;
- case GetPathsSetTemplate:
- plan = new GetPathsSetTemplatePlan();
- break;
- case GetAllTemplateSetInfo:
- plan = new GetAllTemplateSetInfoPlan();
- break;
case SetSchemaTemplate:
plan = new SetSchemaTemplatePlan();
break;
@@ -384,9 +291,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case CommitSetSchemaTemplate:
plan = new CommitSetSchemaTemplatePlan();
break;
- case GetTemplateSetInfo:
- plan = new GetTemplateSetInfoPlan();
- break;
case DropSchemaTemplate:
plan = new DropSchemaTemplatePlan();
break;
@@ -417,15 +321,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case SetTableProperties:
plan = new SetTablePropertiesPlan();
break;
- case ShowTable:
- plan = new ShowTablePlan();
- break;
- case GetNodePathsPartition:
- plan = new GetNodePathsPartitionPlan();
- break;
- case GetRegionInfoList:
- plan = new GetRegionInfoListPlan();
- break;
case CreatePipeSinkV1:
plan = new CreatePipeSinkPlanV1();
break;
@@ -444,9 +339,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case DropPipeV1:
plan = new DropPipePlanV1();
break;
- case ShowPipeV1:
- plan = new ShowPipePlanV1();
- break;
case RecordPipeMessageV1:
plan = new RecordPipeMessagePlan();
break;
@@ -462,9 +354,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case AlterPipeV2:
plan = new AlterPipePlanV2();
break;
- case ShowPipeV2:
- plan = new ShowPipePlanV2();
- break;
case OperateMultiplePipesV2:
plan = new OperateMultiplePipesPlanV2();
break;
@@ -501,9 +390,6 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case ConsumerGroupHandleMetaChange:
plan = new ConsumerGroupHandleMetaChangePlan();
break;
- case ShowSubscription:
- plan = new ShowSubscriptionPlan();
- break;
case PipeUnsetTemplate:
plan = new PipeUnsetSchemaTemplatePlan();
break;
@@ -516,27 +402,12 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case PipeDeactivateTemplate:
plan = new PipeDeactivateTemplatePlan();
break;
- case GetRegionId:
- plan = new GetRegionIdPlan();
- break;
- case GetTimeSlotList:
- plan = new GetTimeSlotListPlan();
- break;
- case CountTimeSlotList:
- plan = new CountTimeSlotListPlan();
- break;
- case GetSeriesSlotList:
- plan = new GetSeriesSlotListPlan();
- break;
case UpdateTriggersOnTransferNodes:
plan = new UpdateTriggersOnTransferNodesPlan();
break;
case UpdateTriggerLocation:
plan = new UpdateTriggerLocationPlan();
break;
- case GetTransferringTriggers:
- plan = new GetTransferringTriggersPlan();
- break;
case ACTIVE_CQ:
plan = new ActiveCQPlan();
break;
@@ -549,27 +420,12 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
case UPDATE_CQ_LAST_EXEC_TIME:
plan = new UpdateCQLastExecTimePlan();
break;
- case SHOW_CQ:
- plan = new ShowCQPlan();
- break;
- case GetFunctionTable:
- plan = new GetFunctionTablePlan();
- break;
- case GetFunctionJar:
- plan = new GetUDFJarPlan();
- break;
case CreatePipePlugin:
plan = new CreatePipePluginPlan();
break;
case DropPipePlugin:
plan = new DropPipePluginPlan();
break;
- case GetPipePluginTable:
- plan = new GetPipePluginTablePlan();
- break;
- case GetPipePluginJar:
- plan = new GetPipePluginJarPlan();
- break;
case setSpaceQuota:
plan = new SetSpaceQuotaPlan();
break;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanVisitor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanVisitor.java
index bfdf71c7e54..1e418e33819 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanVisitor.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanVisitor.java
@@ -19,7 +19,7 @@
package org.apache.iotdb.confignode.consensus.request;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DeleteDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/task/ShowPipePlanV2.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ConfigPhysicalReadPlan.java
similarity index 72%
copy from iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/task/ShowPipePlanV2.java
copy to iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ConfigPhysicalReadPlan.java
index 0cd6d9ef5cb..b8652f03a1b 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/task/ShowPipePlanV2.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ConfigPhysicalReadPlan.java
@@ -7,7 +7,7 @@
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.iotdb.confignode.consensus.request.read.pipe.task;
+package org.apache.iotdb.confignode.consensus.request.read;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
@@ -26,19 +26,19 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
-public class ShowPipePlanV2 extends ConfigPhysicalPlan {
+public abstract class ConfigPhysicalReadPlan extends ConfigPhysicalPlan {
- public ShowPipePlanV2() {
- super(ConfigPhysicalPlanType.ShowPipeV2);
+ protected ConfigPhysicalReadPlan(final ConfigPhysicalPlanType type) {
+ super(type);
}
@Override
protected void serializeImpl(final DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
+ throw new UnsupportedOperationException("Read request does not need to be serialized.");
}
@Override
protected void deserializeImpl(final ByteBuffer buffer) throws IOException {
- // Empty method, since it is not needed now
+ throw new UnsupportedOperationException("Read request does not need to be deserialized.");
}
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ainode/GetAINodeConfigurationPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ainode/GetAINodeConfigurationPlan.java
index f13cbd276cf..b080cf77c5d 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ainode/GetAINodeConfigurationPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ainode/GetAINodeConfigurationPlan.java
@@ -19,24 +19,16 @@
package org.apache.iotdb.confignode.consensus.request.read.ainode;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class GetAINodeConfigurationPlan extends ConfigPhysicalPlan {
+public class GetAINodeConfigurationPlan extends ConfigPhysicalReadPlan {
// if aiNodeId is set to -1, return all AINode configurations.
- private int aiNodeId;
+ private final int aiNodeId;
- public GetAINodeConfigurationPlan() {
+ public GetAINodeConfigurationPlan(final int aiNodeId) {
super(ConfigPhysicalPlanType.GetAINodeConfiguration);
- }
-
- public GetAINodeConfigurationPlan(int aiNodeId) {
- this();
this.aiNodeId = aiNodeId;
}
@@ -45,25 +37,14 @@ public class GetAINodeConfigurationPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- stream.writeInt(aiNodeId);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.aiNodeId = buffer.getInt();
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof GetAINodeConfigurationPlan)) {
return false;
}
- GetAINodeConfigurationPlan that = (GetAINodeConfigurationPlan) o;
+ final GetAINodeConfigurationPlan that = (GetAINodeConfigurationPlan) o;
return aiNodeId == that.aiNodeId;
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/auth/AuthorReadPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/auth/AuthorReadPlan.java
new file mode 100644
index 00000000000..d418aa4d083
--- /dev/null
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/auth/AuthorReadPlan.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.confignode.consensus.request.read.auth;
+
+import org.apache.iotdb.commons.auth.entity.PrivilegeType;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+public class AuthorReadPlan extends ConfigPhysicalReadPlan {
+
+ private final ConfigPhysicalPlanType authorType;
+ private final String roleName;
+ private String password;
+ private final String newPassword;
+ private Set<Integer> permissions;
+ private final List<PartialPath> nodeNameList;
+ private String userName;
+ private final boolean grantOpt;
+
+ /**
+ * {@link AuthorReadPlan} Constructor.
+ *
+ * @param authorType author type
+ * @param userName user name
+ * @param roleName role name
+ * @param password password
+ * @param newPassword new password
+ * @param permissions permissions
+ * @param grantOpt with grant option, only grant statement can set grantOpt = true
+ * @param nodeNameList node name in Path structure
+ */
+ public AuthorReadPlan(
+ final ConfigPhysicalPlanType authorType,
+ final String userName,
+ final String roleName,
+ final String password,
+ final String newPassword,
+ final Set<Integer> permissions,
+ final boolean grantOpt,
+ final List<PartialPath> nodeNameList) {
+ super(authorType);
+ this.authorType = authorType;
+ this.userName = userName;
+ this.roleName = roleName;
+ this.password = password;
+ this.newPassword = newPassword;
+ this.permissions = permissions;
+ this.grantOpt = grantOpt;
+ this.nodeNameList = nodeNameList;
+ }
+
+ public String getRoleName() {
+ return roleName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(final String password) {
+ this.password = password;
+ }
+
+ public Set<Integer> getPermissions() {
+ return permissions;
+ }
+
+ public void setPermissions(final Set<Integer> permissions) {
+ this.permissions = permissions;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(final String userName) {
+ this.userName = userName;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final AuthorReadPlan that = (AuthorReadPlan) o;
+ return Objects.equals(authorType, that.authorType)
+ && Objects.equals(userName, that.userName)
+ && Objects.equals(roleName, that.roleName)
+ && Objects.equals(password, that.password)
+ && Objects.equals(newPassword, that.newPassword)
+ && Objects.equals(permissions, that.permissions)
+ && grantOpt == that.grantOpt
+ && Objects.equals(nodeNameList, that.nodeNameList);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ authorType, userName, roleName, password, newPassword, permissions, nodeNameList, grantOpt);
+ }
+
+ @Override
+ public String toString() {
+ return "[type:"
+ + authorType
+ + ", username:"
+ + userName
+ + ", rolename:"
+ + roleName
+ + ", permissions:"
+ + PrivilegeType.toPriType(permissions)
+ + ", grant option:"
+ + grantOpt
+ + ", paths:"
+ + nodeNameList
+ + "]";
+ }
+}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/cq/ShowCQPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/cq/ShowCQPlan.java
similarity index 63%
rename from iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/cq/ShowCQPlan.java
rename to iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/cq/ShowCQPlan.java
index 7c146238a5e..5217849deb4 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/cq/ShowCQPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/cq/ShowCQPlan.java
@@ -17,29 +17,15 @@
* under the License.
*/
-package org.apache.iotdb.confignode.consensus.request.write.cq;
+package org.apache.iotdb.confignode.consensus.request.read.cq;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import static org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType.SHOW_CQ;
-public class ShowCQPlan extends ConfigPhysicalPlan {
+public class ShowCQPlan extends ConfigPhysicalReadPlan {
public ShowCQPlan() {
super(SHOW_CQ);
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- // no customized field to deserialize from
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java
index 3e838c08a06..4772688c701 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java
@@ -20,37 +20,27 @@
package org.apache.iotdb.confignode.consensus.request.read.database;
import org.apache.iotdb.commons.path.PathPatternTree;
-import org.apache.iotdb.commons.utils.BasicStructureSerDeUtil;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
-public class CountDatabasePlan extends ConfigPhysicalPlan {
+public class CountDatabasePlan extends ConfigPhysicalReadPlan {
- private String[] storageGroupPattern;
- private PathPatternTree scope;
+ private final String[] storageGroupPattern;
+ private final PathPatternTree scope;
- public CountDatabasePlan() {
+ public CountDatabasePlan(final List<String> storageGroupPattern, final PathPatternTree scope) {
super(ConfigPhysicalPlanType.CountDatabase);
- }
-
- public CountDatabasePlan(ConfigPhysicalPlanType type) {
- super(type);
- }
-
- public CountDatabasePlan(List<String> storageGroupPattern, PathPatternTree scope) {
- this();
this.storageGroupPattern = storageGroupPattern.toArray(new String[0]);
this.scope = scope;
}
public CountDatabasePlan(
- ConfigPhysicalPlanType type, List<String> storageGroupPattern, PathPatternTree scope) {
+ final ConfigPhysicalPlanType type,
+ final List<String> storageGroupPattern,
+ final PathPatternTree scope) {
super(type);
this.storageGroupPattern = storageGroupPattern.toArray(new String[0]);
this.scope = scope;
@@ -65,35 +55,14 @@ public class CountDatabasePlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
-
- stream.writeInt(storageGroupPattern.length);
- for (String node : storageGroupPattern) {
- BasicStructureSerDeUtil.write(node, stream);
- }
- scope.serialize(stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) {
- int length = buffer.getInt();
- storageGroupPattern = new String[length];
- for (int i = 0; i < length; i++) {
- storageGroupPattern[i] = BasicStructureSerDeUtil.readString(buffer);
- }
- scope = PathPatternTree.deserialize(buffer);
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- CountDatabasePlan that = (CountDatabasePlan) o;
+ final CountDatabasePlan that = (CountDatabasePlan) o;
return Arrays.equals(storageGroupPattern, that.storageGroupPattern);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java
index 161e58776f5..2ba4c419498 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java
@@ -26,11 +26,7 @@ import java.util.List;
public class GetDatabasePlan extends CountDatabasePlan {
- public GetDatabasePlan() {
- super(ConfigPhysicalPlanType.GetDatabase);
- }
-
- public GetDatabasePlan(List<String> storageGroupPathPattern, PathPatternTree scope) {
+ public GetDatabasePlan(final List<String> storageGroupPathPattern, final PathPatternTree scope) {
super(ConfigPhysicalPlanType.GetDatabase, storageGroupPathPattern, scope);
}
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/datanode/GetDataNodeConfigurationPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/datanode/GetDataNodeConfigurationPlan.java
index 22f7202841d..7223415c3de 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/datanode/GetDataNodeConfigurationPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/datanode/GetDataNodeConfigurationPlan.java
@@ -19,25 +19,18 @@
package org.apache.iotdb.confignode.consensus.request.read.datanode;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
/** Get DataNodeInfo by the specific DataNode's id. And return all when dataNodeID is set to -1. */
-public class GetDataNodeConfigurationPlan extends ConfigPhysicalPlan {
+public class GetDataNodeConfigurationPlan extends ConfigPhysicalReadPlan {
- private int dataNodeId;
+ private final int dataNodeId;
- public GetDataNodeConfigurationPlan() {
+ public GetDataNodeConfigurationPlan(final int dataNodeId) {
super(ConfigPhysicalPlanType.GetDataNodeConfiguration);
- }
-
- public GetDataNodeConfigurationPlan(int dataNodeId) {
- this();
this.dataNodeId = dataNodeId;
}
@@ -46,25 +39,14 @@ public class GetDataNodeConfigurationPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- stream.writeInt(dataNodeId);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) {
- this.dataNodeId = buffer.getInt();
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- GetDataNodeConfigurationPlan that = (GetDataNodeConfigurationPlan) o;
+ final GetDataNodeConfigurationPlan that = (GetDataNodeConfigurationPlan) o;
return dataNodeId == that.dataNodeId;
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/function/GetFunctionTablePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/function/GetFunctionTablePlan.java
index 0dc530bb7d4..bcc9fed7b9b 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/function/GetFunctionTablePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/function/GetFunctionTablePlan.java
@@ -19,26 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.function;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class GetFunctionTablePlan extends ConfigPhysicalPlan {
+public class GetFunctionTablePlan extends ConfigPhysicalReadPlan {
public GetFunctionTablePlan() {
super(ConfigPhysicalPlanType.GetFunctionTable);
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- // do nothing
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/function/GetUDFJarPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/function/GetUDFJarPlan.java
index 09baafdcc4f..ba81d964360 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/function/GetUDFJarPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/function/GetUDFJarPlan.java
@@ -19,27 +19,17 @@
package org.apache.iotdb.confignode.consensus.request.read.function;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-public class GetUDFJarPlan extends ConfigPhysicalPlan {
-
- private List<String> jarNames;
+public class GetUDFJarPlan extends ConfigPhysicalReadPlan {
- public GetUDFJarPlan() {
- super(ConfigPhysicalPlanType.GetFunctionJar);
- }
+ private final List<String> jarNames;
- public GetUDFJarPlan(List<String> triggerNames) {
+ public GetUDFJarPlan(final List<String> triggerNames) {
super(ConfigPhysicalPlanType.GetFunctionJar);
jarNames = triggerNames;
}
@@ -49,27 +39,7 @@ public class GetUDFJarPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
-
- ReadWriteIOUtils.write(jarNames.size(), stream);
- for (String jarName : jarNames) {
- ReadWriteIOUtils.write(jarName, stream);
- }
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- int size = ReadWriteIOUtils.readInt(buffer);
- jarNames = new ArrayList<>(size);
- while (size > 0) {
- jarNames.add(ReadWriteIOUtils.readString(buffer));
- size--;
- }
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
@@ -79,7 +49,7 @@ public class GetUDFJarPlan extends ConfigPhysicalPlan {
if (!super.equals(o)) {
return false;
}
- GetUDFJarPlan that = (GetUDFJarPlan) o;
+ final GetUDFJarPlan that = (GetUDFJarPlan) o;
return Objects.equals(jarNames, that.jarNames);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/model/GetModelInfoPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/model/GetModelInfoPlan.java
index 9be7c59b1e7..dfec065f206 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/model/GetModelInfoPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/model/GetModelInfoPlan.java
@@ -19,26 +19,17 @@
package org.apache.iotdb.confignode.consensus.request.read.model;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import org.apache.iotdb.confignode.rpc.thrift.TGetModelInfoReq;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class GetModelInfoPlan extends ConfigPhysicalPlan {
+public class GetModelInfoPlan extends ConfigPhysicalReadPlan {
- private String modelId;
+ private final String modelId;
- public GetModelInfoPlan() {
- super(ConfigPhysicalPlanType.GetModelInfo);
- }
-
- public GetModelInfoPlan(TGetModelInfoReq getModelInfoReq) {
+ public GetModelInfoPlan(final TGetModelInfoReq getModelInfoReq) {
super(ConfigPhysicalPlanType.GetModelInfo);
this.modelId = getModelInfoReq.getModelId();
}
@@ -48,18 +39,7 @@ public class GetModelInfoPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- ReadWriteIOUtils.write(modelId, stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.modelId = ReadWriteIOUtils.readString(buffer);
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
@@ -69,7 +49,7 @@ public class GetModelInfoPlan extends ConfigPhysicalPlan {
if (!super.equals(o)) {
return false;
}
- GetModelInfoPlan that = (GetModelInfoPlan) o;
+ final GetModelInfoPlan that = (GetModelInfoPlan) o;
return Objects.equals(modelId, that.modelId);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/model/ShowModelPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/model/ShowModelPlan.java
index b9dddf0cf49..c3d0ff79a37 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/model/ShowModelPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/model/ShowModelPlan.java
@@ -19,26 +19,17 @@
package org.apache.iotdb.confignode.consensus.request.read.model;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import org.apache.iotdb.confignode.rpc.thrift.TShowModelReq;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class ShowModelPlan extends ConfigPhysicalPlan {
+public class ShowModelPlan extends ConfigPhysicalReadPlan {
private String modelName;
- public ShowModelPlan() {
- super(ConfigPhysicalPlanType.ShowModel);
- }
-
- public ShowModelPlan(TShowModelReq showModelReq) {
+ public ShowModelPlan(final TShowModelReq showModelReq) {
super(ConfigPhysicalPlanType.ShowModel);
if (showModelReq.isSetModelId()) {
this.modelName = showModelReq.getModelId();
@@ -54,22 +45,7 @@ public class ShowModelPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- ReadWriteIOUtils.write(modelName != null, stream);
- ReadWriteIOUtils.write(modelName, stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- boolean isSetModelId = ReadWriteIOUtils.readBool(buffer);
- if (isSetModelId) {
- this.modelName = ReadWriteIOUtils.readString(buffer);
- }
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
@@ -79,7 +55,7 @@ public class ShowModelPlan extends ConfigPhysicalPlan {
if (!super.equals(o)) {
return false;
}
- ShowModelPlan that = (ShowModelPlan) o;
+ final ShowModelPlan that = (ShowModelPlan) o;
return Objects.equals(modelName, that.modelName);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/CountTimeSlotListPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/CountTimeSlotListPlan.java
index acf7c974224..0050f712fb0 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/CountTimeSlotListPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/CountTimeSlotListPlan.java
@@ -22,18 +22,12 @@ package org.apache.iotdb.confignode.consensus.request.read.partition;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
-import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class CountTimeSlotListPlan extends ConfigPhysicalPlan {
+public class CountTimeSlotListPlan extends ConfigPhysicalReadPlan {
private String database;
@@ -41,16 +35,12 @@ public class CountTimeSlotListPlan extends ConfigPhysicalPlan {
private TConsensusGroupId regionId;
- private long startTime;
+ private final long startTime;
- private long endTime;
+ private final long endTime;
- public CountTimeSlotListPlan() {
+ public CountTimeSlotListPlan(final long startTime, final long endTime) {
super(ConfigPhysicalPlanType.CountTimeSlotList);
- }
-
- public CountTimeSlotListPlan(long startTime, long endTime) {
- this();
this.startTime = startTime;
this.endTime = endTime;
this.database = "";
@@ -58,7 +48,7 @@ public class CountTimeSlotListPlan extends ConfigPhysicalPlan {
this.regionId = new TConsensusGroupId(TConsensusGroupType.DataRegion, -1);
}
- public void setDatabase(String database) {
+ public void setDatabase(final String database) {
this.database = database;
}
@@ -66,7 +56,7 @@ public class CountTimeSlotListPlan extends ConfigPhysicalPlan {
return database;
}
- public void setRegionId(TConsensusGroupId regionId) {
+ public void setRegionId(final TConsensusGroupId regionId) {
this.regionId = regionId;
}
@@ -74,7 +64,7 @@ public class CountTimeSlotListPlan extends ConfigPhysicalPlan {
return regionId;
}
- public void setSeriesSlotId(TSeriesPartitionSlot seriesSlotId) {
+ public void setSeriesSlotId(final TSeriesPartitionSlot seriesSlotId) {
this.seriesSlotId = seriesSlotId;
}
@@ -91,33 +81,14 @@ public class CountTimeSlotListPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- ReadWriteIOUtils.write(database, stream);
- ThriftCommonsSerDeUtils.serializeTSeriesPartitionSlot(seriesSlotId, stream);
- ThriftCommonsSerDeUtils.serializeTConsensusGroupId(regionId, stream);
- stream.writeLong(startTime);
- stream.writeLong(endTime);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.database = ReadWriteIOUtils.readString(buffer);
- this.seriesSlotId = ThriftCommonsSerDeUtils.deserializeTSeriesPartitionSlot(buffer);
- this.regionId = ThriftCommonsSerDeUtils.deserializeTConsensusGroupId(buffer);
- this.startTime = buffer.getLong();
- this.endTime = buffer.getLong();
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- CountTimeSlotListPlan that = (CountTimeSlotListPlan) o;
+ final CountTimeSlotListPlan that = (CountTimeSlotListPlan) o;
return database.equals(that.database)
&& seriesSlotId.equals(that.seriesSlotId)
&& regionId.equals(that.regionId)
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java
index 32e494b5534..cce8e146114 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java
@@ -20,39 +20,28 @@
package org.apache.iotdb.confignode.consensus.request.read.partition;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
-import org.apache.iotdb.commons.utils.BasicStructureSerDeUtil;
-import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import org.apache.iotdb.confignode.rpc.thrift.TDataPartitionReq;
import org.apache.iotdb.confignode.rpc.thrift.TTimeSlotList;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.HashMap;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
/** Get or create DataPartition by the specific partitionSlotsMap. */
-public class GetDataPartitionPlan extends ConfigPhysicalPlan {
+public class GetDataPartitionPlan extends ConfigPhysicalReadPlan {
// Map<StorageGroup, Map<TSeriesPartitionSlot, List<TTimePartitionSlot>>>
protected Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> partitionSlotsMap;
- public GetDataPartitionPlan() {
- super(ConfigPhysicalPlanType.GetDataPartition);
- }
-
- public GetDataPartitionPlan(ConfigPhysicalPlanType configPhysicalPlanType) {
+ public GetDataPartitionPlan(final ConfigPhysicalPlanType configPhysicalPlanType) {
super(configPhysicalPlanType);
}
public GetDataPartitionPlan(
- Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> partitionSlotsMap) {
- this();
+ final Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> partitionSlotsMap) {
+ super(ConfigPhysicalPlanType.GetDataPartition);
this.partitionSlotsMap = partitionSlotsMap;
}
@@ -66,58 +55,19 @@ public class GetDataPartitionPlan extends ConfigPhysicalPlan {
* @param req TDataPartitionReq
* @return GetDataPartitionPlan
*/
- public static GetDataPartitionPlan convertFromRpcTDataPartitionReq(TDataPartitionReq req) {
+ public static GetDataPartitionPlan convertFromRpcTDataPartitionReq(final TDataPartitionReq req) {
return new GetDataPartitionPlan(new ConcurrentHashMap<>(req.getPartitionSlotsMap()));
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
-
- stream.writeInt(partitionSlotsMap.size());
- for (Entry<String, Map<TSeriesPartitionSlot, TTimeSlotList>> entry :
- partitionSlotsMap.entrySet()) {
- String storageGroup = entry.getKey();
- Map<TSeriesPartitionSlot, TTimeSlotList> seriesPartitionTimePartitionSlots = entry.getValue();
- BasicStructureSerDeUtil.write(storageGroup, stream);
- stream.writeInt(seriesPartitionTimePartitionSlots.size());
- for (Entry<TSeriesPartitionSlot, TTimeSlotList> e :
- seriesPartitionTimePartitionSlots.entrySet()) {
- TSeriesPartitionSlot seriesPartitionSlot = e.getKey();
- TTimeSlotList timePartitionSlotList = e.getValue();
- ThriftCommonsSerDeUtils.serializeTSeriesPartitionSlot(seriesPartitionSlot, stream);
- ThriftCommonsSerDeUtils.serializeTTimePartitionSlotList(timePartitionSlotList, stream);
- }
- }
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) {
- partitionSlotsMap = new HashMap<>();
- int storageGroupNum = buffer.getInt();
- for (int i = 0; i < storageGroupNum; i++) {
- String storageGroup = BasicStructureSerDeUtil.readString(buffer);
- partitionSlotsMap.put(storageGroup, new HashMap<>());
- int seriesPartitionSlotNum = buffer.getInt();
- for (int j = 0; j < seriesPartitionSlotNum; j++) {
- TSeriesPartitionSlot seriesPartitionSlot =
- ThriftCommonsSerDeUtils.deserializeTSeriesPartitionSlot(buffer);
- TTimeSlotList timePartitionSlotList =
- ThriftCommonsSerDeUtils.deserializeTTimePartitionSlotList(buffer);
- partitionSlotsMap.get(storageGroup).put(seriesPartitionSlot, timePartitionSlotList);
- }
- }
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- GetDataPartitionPlan that = (GetDataPartitionPlan) o;
+ final GetDataPartitionPlan that = (GetDataPartitionPlan) o;
return partitionSlotsMap.equals(that.partitionSlotsMap);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetNodePathsPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetNodePathsPartitionPlan.java
index 978a70853b2..3b8d0a7c8b1 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetNodePathsPartitionPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetNodePathsPartitionPlan.java
@@ -20,17 +20,13 @@
package org.apache.iotdb.confignode.consensus.request.read.partition;
import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.path.PathDeserializeUtil;
import org.apache.iotdb.commons.path.PathPatternTree;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class GetNodePathsPartitionPlan extends ConfigPhysicalPlan {
+public class GetNodePathsPartitionPlan extends ConfigPhysicalReadPlan {
private PartialPath partialPath;
private PathPatternTree scope;
private int level = -1;
@@ -43,7 +39,7 @@ public class GetNodePathsPartitionPlan extends ConfigPhysicalPlan {
return scope;
}
- public void setScope(PathPatternTree scope) {
+ public void setScope(final PathPatternTree scope) {
this.scope = scope;
}
@@ -51,7 +47,7 @@ public class GetNodePathsPartitionPlan extends ConfigPhysicalPlan {
return partialPath;
}
- public void setPartialPath(PartialPath partialPath) {
+ public void setPartialPath(final PartialPath partialPath) {
this.partialPath = partialPath;
}
@@ -59,34 +55,19 @@ public class GetNodePathsPartitionPlan extends ConfigPhysicalPlan {
return level;
}
- public void setLevel(int level) {
+ public void setLevel(final int level) {
this.level = level;
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- partialPath.serialize(stream);
- scope.serialize(stream);
- stream.writeInt(level);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- partialPath = (PartialPath) PathDeserializeUtil.deserialize(buffer);
- scope = PathPatternTree.deserialize(buffer);
- level = buffer.getInt();
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- GetNodePathsPartitionPlan that = (GetNodePathsPartitionPlan) o;
+ final GetNodePathsPartitionPlan that = (GetNodePathsPartitionPlan) o;
return level == that.level && Objects.equals(partialPath, that.partialPath);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetOrCreateDataPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetOrCreateDataPartitionPlan.java
index 347ae312147..800b7e0e19a 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetOrCreateDataPartitionPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetOrCreateDataPartitionPlan.java
@@ -29,13 +29,9 @@ import java.util.concurrent.ConcurrentHashMap;
public class GetOrCreateDataPartitionPlan extends GetDataPartitionPlan {
- public GetOrCreateDataPartitionPlan() {
- super(ConfigPhysicalPlanType.GetOrCreateDataPartition);
- }
-
public GetOrCreateDataPartitionPlan(
- Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> partitionSlotsMap) {
- this();
+ final Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> partitionSlotsMap) {
+ super(ConfigPhysicalPlanType.GetOrCreateDataPartition);
this.partitionSlotsMap = partitionSlotsMap;
}
@@ -46,7 +42,7 @@ public class GetOrCreateDataPartitionPlan extends GetDataPartitionPlan {
* @return GetOrCreateDataPartitionPlan
*/
public static GetOrCreateDataPartitionPlan convertFromRpcTDataPartitionReq(
- TDataPartitionReq req) {
+ final TDataPartitionReq req) {
return new GetOrCreateDataPartitionPlan(new ConcurrentHashMap<>(req.getPartitionSlotsMap()));
}
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetOrCreateSchemaPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetOrCreateSchemaPartitionPlan.java
index e245bc7155f..c7b7272c569 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetOrCreateSchemaPartitionPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetOrCreateSchemaPartitionPlan.java
@@ -31,7 +31,8 @@ public class GetOrCreateSchemaPartitionPlan extends GetSchemaPartitionPlan {
super(ConfigPhysicalPlanType.GetOrCreateSchemaPartition);
}
- public GetOrCreateSchemaPartitionPlan(Map<String, List<TSeriesPartitionSlot>> partitionSlotsMap) {
+ public GetOrCreateSchemaPartitionPlan(
+ final Map<String, List<TSeriesPartitionSlot>> partitionSlotsMap) {
this();
this.partitionSlotsMap = partitionSlotsMap;
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java
index 2751c5efaed..8bfccd18a1c 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java
@@ -20,39 +20,27 @@
package org.apache.iotdb.confignode.consensus.request.read.partition;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
-import org.apache.iotdb.commons.utils.BasicStructureSerDeUtil;
-import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Objects;
/** Get or create SchemaPartition by the specific partitionSlotsMap. */
-public class GetSchemaPartitionPlan extends ConfigPhysicalPlan {
+public class GetSchemaPartitionPlan extends ConfigPhysicalReadPlan {
// Map<StorageGroup, List<SeriesPartitionSlot>>
// Get all SchemaPartitions when the partitionSlotsMap is empty
// Get all exists SchemaPartitions in one StorageGroup when the SeriesPartitionSlot is empty
protected Map<String, List<TSeriesPartitionSlot>> partitionSlotsMap;
- public GetSchemaPartitionPlan() {
- super(ConfigPhysicalPlanType.GetSchemaPartition);
- }
-
- public GetSchemaPartitionPlan(ConfigPhysicalPlanType configPhysicalPlanType) {
+ public GetSchemaPartitionPlan(final ConfigPhysicalPlanType configPhysicalPlanType) {
super(configPhysicalPlanType);
}
- public GetSchemaPartitionPlan(Map<String, List<TSeriesPartitionSlot>> partitionSlotsMap) {
- this();
+ public GetSchemaPartitionPlan(final Map<String, List<TSeriesPartitionSlot>> partitionSlotsMap) {
+ super(ConfigPhysicalPlanType.GetSchemaPartition);
this.partitionSlotsMap = partitionSlotsMap;
}
@@ -61,46 +49,14 @@ public class GetSchemaPartitionPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
-
- stream.writeInt(partitionSlotsMap.size());
- for (Entry<String, List<TSeriesPartitionSlot>> entry : partitionSlotsMap.entrySet()) {
- String storageGroup = entry.getKey();
- List<TSeriesPartitionSlot> seriesPartitionSlots = entry.getValue();
- BasicStructureSerDeUtil.write(storageGroup, stream);
- stream.writeInt(seriesPartitionSlots.size());
- seriesPartitionSlots.forEach(
- seriesPartitionSlot ->
- ThriftCommonsSerDeUtils.serializeTSeriesPartitionSlot(seriesPartitionSlot, stream));
- }
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- partitionSlotsMap = new HashMap<>();
- int storageGroupNum = buffer.getInt();
- for (int i = 0; i < storageGroupNum; i++) {
- String storageGroup = BasicStructureSerDeUtil.readString(buffer);
- partitionSlotsMap.put(storageGroup, new ArrayList<>());
- int seriesPartitionSlotNum = buffer.getInt();
- for (int j = 0; j < seriesPartitionSlotNum; j++) {
- TSeriesPartitionSlot seriesPartitionSlot =
- ThriftCommonsSerDeUtils.deserializeTSeriesPartitionSlot(buffer);
- partitionSlotsMap.get(storageGroup).add(seriesPartitionSlot);
- }
- }
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- GetSchemaPartitionPlan that = (GetSchemaPartitionPlan) o;
+ final GetSchemaPartitionPlan that = (GetSchemaPartitionPlan) o;
return partitionSlotsMap.equals(that.partitionSlotsMap);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSeriesSlotListPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSeriesSlotListPlan.java
index 832a9b8fa39..f0d130fa563 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSeriesSlotListPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSeriesSlotListPlan.java
@@ -20,28 +20,19 @@
package org.apache.iotdb.confignode.consensus.request.read.partition;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class GetSeriesSlotListPlan extends ConfigPhysicalPlan {
+public class GetSeriesSlotListPlan extends ConfigPhysicalReadPlan {
- private String database;
+ private final String database;
- private TConsensusGroupType partitionType;
+ private final TConsensusGroupType partitionType;
- public GetSeriesSlotListPlan() {
+ public GetSeriesSlotListPlan(final String database, final TConsensusGroupType partitionType) {
super(ConfigPhysicalPlanType.GetSeriesSlotList);
- }
-
- public GetSeriesSlotListPlan(String database, TConsensusGroupType partitionType) {
- this();
this.database = database;
this.partitionType = partitionType;
}
@@ -55,27 +46,14 @@ public class GetSeriesSlotListPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- ReadWriteIOUtils.write(database, stream);
- stream.writeInt(partitionType.ordinal());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.database = ReadWriteIOUtils.readString(buffer);
- this.partitionType = TConsensusGroupType.findByValue(buffer.getInt());
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- GetSeriesSlotListPlan that = (GetSeriesSlotListPlan) o;
+ final GetSeriesSlotListPlan that = (GetSeriesSlotListPlan) o;
return database.equals(that.database) && partitionType.equals(that.partitionType);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java
index 1b6f881763e..00a130fc307 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java
@@ -22,18 +22,12 @@ package org.apache.iotdb.confignode.consensus.request.read.partition;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
-import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
+public class GetTimeSlotListPlan extends ConfigPhysicalReadPlan {
private String database;
@@ -41,16 +35,12 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
private TConsensusGroupId regionId;
- private long startTime;
+ private final long startTime;
- private long endTime;
+ private final long endTime;
- public GetTimeSlotListPlan() {
+ public GetTimeSlotListPlan(final long startTime, final long endTime) {
super(ConfigPhysicalPlanType.GetTimeSlotList);
- }
-
- public GetTimeSlotListPlan(long startTime, long endTime) {
- this();
this.startTime = startTime;
this.endTime = endTime;
this.database = "";
@@ -58,7 +48,7 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
this.regionId = new TConsensusGroupId(TConsensusGroupType.DataRegion, -1);
}
- public void setDatabase(String database) {
+ public void setDatabase(final String database) {
this.database = database;
}
@@ -66,7 +56,7 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
return database;
}
- public void setRegionId(TConsensusGroupId regionId) {
+ public void setRegionId(final TConsensusGroupId regionId) {
this.regionId = regionId;
}
@@ -74,7 +64,7 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
return regionId;
}
- public void setSeriesSlotId(TSeriesPartitionSlot seriesSlotId) {
+ public void setSeriesSlotId(final TSeriesPartitionSlot seriesSlotId) {
this.seriesSlotId = seriesSlotId;
}
@@ -91,33 +81,14 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- ReadWriteIOUtils.write(database, stream);
- ThriftCommonsSerDeUtils.serializeTSeriesPartitionSlot(seriesSlotId, stream);
- ThriftCommonsSerDeUtils.serializeTConsensusGroupId(regionId, stream);
- stream.writeLong(startTime);
- stream.writeLong(endTime);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.database = ReadWriteIOUtils.readString(buffer);
- this.seriesSlotId = ThriftCommonsSerDeUtils.deserializeTSeriesPartitionSlot(buffer);
- this.regionId = ThriftCommonsSerDeUtils.deserializeTConsensusGroupId(buffer);
- this.startTime = buffer.getLong();
- this.endTime = buffer.getLong();
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- GetTimeSlotListPlan that = (GetTimeSlotListPlan) o;
+ final GetTimeSlotListPlan that = (GetTimeSlotListPlan) o;
return database.equals(that.database)
&& seriesSlotId.equals(that.seriesSlotId)
&& regionId.equals(that.regionId)
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/plugin/GetPipePluginJarPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/plugin/GetPipePluginJarPlan.java
index 363b88a85d9..a8f99e6a3d1 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/plugin/GetPipePluginJarPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/plugin/GetPipePluginJarPlan.java
@@ -19,23 +19,13 @@
package org.apache.iotdb.confignode.consensus.request.read.pipe.plugin;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
import java.util.List;
-public class GetPipePluginJarPlan extends ConfigPhysicalPlan {
- private List<String> jarNames;
-
- public GetPipePluginJarPlan() {
- super(ConfigPhysicalPlanType.GetPipePluginJar);
- }
+public class GetPipePluginJarPlan extends ConfigPhysicalReadPlan {
+ private final List<String> jarNames;
public GetPipePluginJarPlan(final List<String> jarNames) {
super(ConfigPhysicalPlanType.GetPipePluginJar);
@@ -45,23 +35,4 @@ public class GetPipePluginJarPlan extends ConfigPhysicalPlan {
public List<String> getJarNames() {
return jarNames;
}
-
- @Override
- protected void serializeImpl(final DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
-
- ReadWriteIOUtils.write(jarNames.size(), stream);
- for (final String jarName : jarNames) {
- ReadWriteIOUtils.write(jarName, stream);
- }
- }
-
- @Override
- protected void deserializeImpl(final ByteBuffer buffer) throws IOException {
- final int size = ReadWriteIOUtils.readInt(buffer);
- jarNames = new ArrayList<>();
- for (int i = 0; i < size; i++) {
- jarNames.add(ReadWriteIOUtils.readString(buffer));
- }
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/plugin/GetPipePluginTablePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/plugin/GetPipePluginTablePlan.java
index cabe5cc1139..39cf23ed344 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/plugin/GetPipePluginTablePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/plugin/GetPipePluginTablePlan.java
@@ -19,26 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.pipe.plugin;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class GetPipePluginTablePlan extends ConfigPhysicalPlan {
+public class GetPipePluginTablePlan extends ConfigPhysicalReadPlan {
public GetPipePluginTablePlan() {
super(ConfigPhysicalPlanType.GetPipePluginTable);
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- // Empty method, since it is not needed now
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/task/ShowPipePlanV2.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/task/ShowPipePlanV2.java
index 0cd6d9ef5cb..6bb67d24146 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/task/ShowPipePlanV2.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/pipe/task/ShowPipePlanV2.java
@@ -19,26 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.pipe.task;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class ShowPipePlanV2 extends ConfigPhysicalPlan {
+public class ShowPipePlanV2 extends ConfigPhysicalReadPlan {
public ShowPipePlanV2() {
super(ConfigPhysicalPlanType.ShowPipeV2);
}
-
- @Override
- protected void serializeImpl(final DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(final ByteBuffer buffer) throws IOException {
- // Empty method, since it is not needed now
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionIdPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionIdPlan.java
index 00797a1fb14..878d18c3bab 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionIdPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionIdPlan.java
@@ -22,22 +22,16 @@ package org.apache.iotdb.confignode.consensus.request.read.region;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
-import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class GetRegionIdPlan extends ConfigPhysicalPlan {
+public class GetRegionIdPlan extends ConfigPhysicalReadPlan {
private String database;
- private TConsensusGroupType partitionType;
+ private final TConsensusGroupType partitionType;
private TTimePartitionSlot startTimeSlotId;
@@ -45,12 +39,8 @@ public class GetRegionIdPlan extends ConfigPhysicalPlan {
private TSeriesPartitionSlot seriesSlotId;
- public GetRegionIdPlan() {
+ public GetRegionIdPlan(final TConsensusGroupType partitionType) {
super(ConfigPhysicalPlanType.GetRegionId);
- }
-
- public GetRegionIdPlan(TConsensusGroupType partitionType) {
- this();
this.partitionType = partitionType;
this.database = "";
this.seriesSlotId = new TSeriesPartitionSlot(-1);
@@ -62,11 +52,11 @@ public class GetRegionIdPlan extends ConfigPhysicalPlan {
return database;
}
- public void setDatabase(String database) {
+ public void setDatabase(final String database) {
this.database = database;
}
- public void setSeriesSlotId(TSeriesPartitionSlot seriesSlotId) {
+ public void setSeriesSlotId(final TSeriesPartitionSlot seriesSlotId) {
this.seriesSlotId = seriesSlotId;
}
@@ -78,7 +68,7 @@ public class GetRegionIdPlan extends ConfigPhysicalPlan {
return startTimeSlotId;
}
- public void setStartTimeSlotId(TTimePartitionSlot startTimeSlotId) {
+ public void setStartTimeSlotId(final TTimePartitionSlot startTimeSlotId) {
this.startTimeSlotId = startTimeSlotId;
}
@@ -86,7 +76,7 @@ public class GetRegionIdPlan extends ConfigPhysicalPlan {
return endTimeSlotId;
}
- public void setEndTimeSlotId(TTimePartitionSlot endTimeSlotId) {
+ public void setEndTimeSlotId(final TTimePartitionSlot endTimeSlotId) {
this.endTimeSlotId = endTimeSlotId;
}
@@ -95,33 +85,14 @@ public class GetRegionIdPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- stream.writeInt(partitionType.ordinal());
- ReadWriteIOUtils.write(database, stream);
- ThriftCommonsSerDeUtils.serializeTSeriesPartitionSlot(seriesSlotId, stream);
- ThriftCommonsSerDeUtils.serializeTTimePartitionSlot(startTimeSlotId, stream);
- ThriftCommonsSerDeUtils.serializeTTimePartitionSlot(endTimeSlotId, stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.partitionType = TConsensusGroupType.findByValue(buffer.getInt());
- this.database = ReadWriteIOUtils.readString(buffer);
- this.seriesSlotId = ThriftCommonsSerDeUtils.deserializeTSeriesPartitionSlot(buffer);
- this.startTimeSlotId = ThriftCommonsSerDeUtils.deserializeTTimePartitionSlot(buffer);
- this.endTimeSlotId = ThriftCommonsSerDeUtils.deserializeTTimePartitionSlot(buffer);
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- GetRegionIdPlan that = (GetRegionIdPlan) o;
+ final GetRegionIdPlan that = (GetRegionIdPlan) o;
return database.equals(that.database)
&& partitionType.equals(that.partitionType)
&& seriesSlotId.equals(that.seriesSlotId)
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionInfoListPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionInfoListPlan.java
index f302fb03de3..da504b36d6c 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionInfoListPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionInfoListPlan.java
@@ -19,18 +19,11 @@
package org.apache.iotdb.confignode.consensus.request.read.region;
-import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import org.apache.iotdb.confignode.rpc.thrift.TShowRegionReq;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class GetRegionInfoListPlan extends ConfigPhysicalPlan {
+public class GetRegionInfoListPlan extends ConfigPhysicalReadPlan {
private TShowRegionReq showRegionReq;
@@ -38,7 +31,7 @@ public class GetRegionInfoListPlan extends ConfigPhysicalPlan {
super(ConfigPhysicalPlanType.GetRegionInfoList);
}
- public GetRegionInfoListPlan(TShowRegionReq showRegionReq) {
+ public GetRegionInfoListPlan(final TShowRegionReq showRegionReq) {
super(ConfigPhysicalPlanType.GetRegionInfoList);
this.showRegionReq = showRegionReq;
}
@@ -47,39 +40,7 @@ public class GetRegionInfoListPlan extends ConfigPhysicalPlan {
return showRegionReq;
}
- public void setShowRegionReq(TShowRegionReq showRegionReq) {
+ public void setShowRegionReq(final TShowRegionReq showRegionReq) {
this.showRegionReq = showRegionReq;
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- stream.writeBoolean(showRegionReq != null);
- if (showRegionReq != null) {
- boolean setConsensusGroupType = showRegionReq.isSetConsensusGroupType();
- stream.writeBoolean(setConsensusGroupType);
- if (setConsensusGroupType) {
- ReadWriteIOUtils.write(showRegionReq.getConsensusGroupType().ordinal(), stream);
- }
- boolean setStorageGroups = showRegionReq.isSetDatabases();
- stream.writeBoolean(setStorageGroups);
- if (setStorageGroups) {
- ReadWriteIOUtils.writeStringList(showRegionReq.getDatabases(), stream);
- }
- }
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- if (ReadWriteIOUtils.readBool(buffer)) {
- this.showRegionReq = new TShowRegionReq();
- if (ReadWriteIOUtils.readBool(buffer)) {
- this.showRegionReq.setConsensusGroupType(
- TConsensusGroupType.values()[ReadWriteIOUtils.readInt(buffer)]);
- }
- if (ReadWriteIOUtils.readBool(buffer)) {
- this.showRegionReq.setDatabases(ReadWriteIOUtils.readStringList(buffer));
- }
- }
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/subscription/ShowSubscriptionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/subscription/ShowSubscriptionPlan.java
index 881a689539a..5514e0542d9 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/subscription/ShowSubscriptionPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/subscription/ShowSubscriptionPlan.java
@@ -19,26 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.subscription;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class ShowSubscriptionPlan extends ConfigPhysicalPlan {
+public class ShowSubscriptionPlan extends ConfigPhysicalReadPlan {
public ShowSubscriptionPlan() {
super(ConfigPhysicalPlanType.ShowSubscription);
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- // Empty method, since it is not needed now
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/subscription/ShowTopicPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/subscription/ShowTopicPlan.java
index 810990ba960..7d1f5200aa1 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/subscription/ShowTopicPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/subscription/ShowTopicPlan.java
@@ -19,26 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.subscription;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class ShowTopicPlan extends ConfigPhysicalPlan {
+public class ShowTopicPlan extends ConfigPhysicalReadPlan {
public ShowTopicPlan() {
super(ConfigPhysicalPlanType.ShowTopic);
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- // Empty method, since it is not needed now
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/table/ShowTablePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/table/ShowTablePlan.java
index 48d3b4af239..8847151d211 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/table/ShowTablePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/table/ShowTablePlan.java
@@ -19,22 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.table;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
+public class ShowTablePlan extends ConfigPhysicalReadPlan {
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class ShowTablePlan extends ConfigPhysicalPlan {
-
- private String database;
-
- public ShowTablePlan() {
- super(ConfigPhysicalPlanType.ShowTable);
- }
+ private final String database;
public ShowTablePlan(final String database) {
super(ConfigPhysicalPlanType.ShowTable);
@@ -44,15 +34,4 @@ public class ShowTablePlan extends ConfigPhysicalPlan {
public String getDatabase() {
return database;
}
-
- @Override
- protected void serializeImpl(final DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- ReadWriteIOUtils.write(database, stream);
- }
-
- @Override
- protected void deserializeImpl(final ByteBuffer buffer) throws IOException {
- database = ReadWriteIOUtils.readString(buffer);
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/CheckTemplateSettablePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/CheckTemplateSettablePlan.java
index df6a44cb83f..42f4c30c775 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/CheckTemplateSettablePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/CheckTemplateSettablePlan.java
@@ -19,25 +19,15 @@
package org.apache.iotdb.confignode.consensus.request.read.template;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
+public class CheckTemplateSettablePlan extends ConfigPhysicalReadPlan {
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
+ private final String name;
+ private final String path;
-public class CheckTemplateSettablePlan extends ConfigPhysicalPlan {
-
- private String name;
- private String path;
-
- public CheckTemplateSettablePlan() {
- super(ConfigPhysicalPlanType.CheckTemplateSettable);
- }
-
- public CheckTemplateSettablePlan(String name, String path) {
+ public CheckTemplateSettablePlan(final String name, final String path) {
super(ConfigPhysicalPlanType.CheckTemplateSettable);
this.name = name;
this.path = path;
@@ -50,17 +40,4 @@ public class CheckTemplateSettablePlan extends ConfigPhysicalPlan {
public String getPath() {
return path;
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- ReadWriteIOUtils.write(name, stream);
- ReadWriteIOUtils.write(path, stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.name = ReadWriteIOUtils.readString(buffer);
- this.path = ReadWriteIOUtils.readString(buffer);
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetAllSchemaTemplatePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetAllSchemaTemplatePlan.java
index bf1a7d8ff26..0add0c2edf7 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetAllSchemaTemplatePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetAllSchemaTemplatePlan.java
@@ -19,24 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.template;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class GetAllSchemaTemplatePlan extends ConfigPhysicalPlan {
+public class GetAllSchemaTemplatePlan extends ConfigPhysicalReadPlan {
public GetAllSchemaTemplatePlan() {
super(ConfigPhysicalPlanType.GetAllSchemaTemplate);
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {}
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetAllTemplateSetInfoPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetAllTemplateSetInfoPlan.java
index f13e5b02e78..c56f79165b8 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetAllTemplateSetInfoPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetAllTemplateSetInfoPlan.java
@@ -19,24 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.template;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class GetAllTemplateSetInfoPlan extends ConfigPhysicalPlan {
+public class GetAllTemplateSetInfoPlan extends ConfigPhysicalReadPlan {
public GetAllTemplateSetInfoPlan() {
super(ConfigPhysicalPlanType.GetAllTemplateSetInfo);
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {}
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetPathsSetTemplatePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetPathsSetTemplatePlan.java
index e96d4d7957a..f81805066af 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetPathsSetTemplatePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetPathsSetTemplatePlan.java
@@ -20,25 +20,15 @@
package org.apache.iotdb.confignode.consensus.request.read.template;
import org.apache.iotdb.commons.path.PathPatternTree;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
+public class GetPathsSetTemplatePlan extends ConfigPhysicalReadPlan {
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
+ private final String name;
+ private final PathPatternTree scope;
-public class GetPathsSetTemplatePlan extends ConfigPhysicalPlan {
-
- private String name;
- private PathPatternTree scope;
-
- public GetPathsSetTemplatePlan() {
- super(ConfigPhysicalPlanType.GetPathsSetTemplate);
- }
-
- public GetPathsSetTemplatePlan(String name, PathPatternTree scope) {
+ public GetPathsSetTemplatePlan(final String name, final PathPatternTree scope) {
super(ConfigPhysicalPlanType.GetPathsSetTemplate);
this.name = name;
this.scope = scope;
@@ -51,17 +41,4 @@ public class GetPathsSetTemplatePlan extends ConfigPhysicalPlan {
public PathPatternTree getScope() {
return scope;
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- ReadWriteIOUtils.write(name, stream);
- scope.serialize(stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.name = ReadWriteIOUtils.readString(buffer);
- this.scope = PathPatternTree.deserialize(buffer);
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetSchemaTemplatePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetSchemaTemplatePlan.java
index 627dfa98c68..95454299239 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetSchemaTemplatePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetSchemaTemplatePlan.java
@@ -19,26 +19,17 @@
package org.apache.iotdb.confignode.consensus.request.read.template;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class GetSchemaTemplatePlan extends ConfigPhysicalPlan {
+public class GetSchemaTemplatePlan extends ConfigPhysicalReadPlan {
- private String templateName;
+ private final String templateName;
- public GetSchemaTemplatePlan() {
+ public GetSchemaTemplatePlan(final String templateName) {
super(ConfigPhysicalPlanType.GetSchemaTemplate);
- }
-
- public GetSchemaTemplatePlan(String templateName) {
- this();
this.templateName = templateName;
}
@@ -47,25 +38,14 @@ public class GetSchemaTemplatePlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- ReadWriteIOUtils.write(getType().getPlanType(), stream);
- ReadWriteIOUtils.write(templateName, stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.templateName = ReadWriteIOUtils.readString(buffer);
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- GetSchemaTemplatePlan that = (GetSchemaTemplatePlan) o;
+ final GetSchemaTemplatePlan that = (GetSchemaTemplatePlan) o;
return this.templateName.equalsIgnoreCase(that.templateName);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetTemplateSetInfoPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetTemplateSetInfoPlan.java
index a63e5ca912e..4ee8ebd7afd 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetTemplateSetInfoPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/template/GetTemplateSetInfoPlan.java
@@ -20,27 +20,16 @@
package org.apache.iotdb.confignode.consensus.request.read.template;
import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.path.PathDeserializeUtil;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
import java.util.List;
-public class GetTemplateSetInfoPlan extends ConfigPhysicalPlan {
-
- private List<PartialPath> patternList;
+public class GetTemplateSetInfoPlan extends ConfigPhysicalReadPlan {
- public GetTemplateSetInfoPlan() {
- super(ConfigPhysicalPlanType.GetTemplateSetInfo);
- }
+ private final List<PartialPath> patternList;
- public GetTemplateSetInfoPlan(List<PartialPath> patternList) {
+ public GetTemplateSetInfoPlan(final List<PartialPath> patternList) {
super(ConfigPhysicalPlanType.GetTemplateSetInfo);
this.patternList = patternList;
}
@@ -48,22 +37,4 @@ public class GetTemplateSetInfoPlan extends ConfigPhysicalPlan {
public List<PartialPath> getPatternList() {
return patternList;
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- ReadWriteIOUtils.write(getType().getPlanType(), stream);
- ReadWriteIOUtils.write(patternList.size(), stream);
- for (PartialPath pattern : patternList) {
- pattern.serialize(stream);
- }
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- int size = ReadWriteIOUtils.readInt(buffer);
- patternList = new ArrayList<>(size);
- for (int i = 0; i < size; i++) {
- patternList.add((PartialPath) PathDeserializeUtil.deserialize(buffer));
- }
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTransferringTriggersPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTransferringTriggersPlan.java
index f7c9bf599e9..d919ffd40ba 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTransferringTriggersPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTransferringTriggersPlan.java
@@ -19,26 +19,12 @@
package org.apache.iotdb.confignode.consensus.request.read.trigger;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class GetTransferringTriggersPlan extends ConfigPhysicalPlan {
+public class GetTransferringTriggersPlan extends ConfigPhysicalReadPlan {
public GetTransferringTriggersPlan() {
super(ConfigPhysicalPlanType.GetTransferringTriggers);
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- // do nothing
- }
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerJarPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerJarPlan.java
index 09addc05b85..04ded3f97e5 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerJarPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerJarPlan.java
@@ -19,27 +19,17 @@
package org.apache.iotdb.confignode.consensus.request.read.trigger;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-public class GetTriggerJarPlan extends ConfigPhysicalPlan {
-
- private List<String> jarNames;
+public class GetTriggerJarPlan extends ConfigPhysicalReadPlan {
- public GetTriggerJarPlan() {
- super(ConfigPhysicalPlanType.GetTriggerJar);
- }
+ private final List<String> jarNames;
- public GetTriggerJarPlan(List<String> triggerNames) {
+ public GetTriggerJarPlan(final List<String> triggerNames) {
super(ConfigPhysicalPlanType.GetTriggerJar);
jarNames = triggerNames;
}
@@ -49,27 +39,7 @@ public class GetTriggerJarPlan extends ConfigPhysicalPlan {
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
-
- ReadWriteIOUtils.write(jarNames.size(), stream);
- for (String jarName : jarNames) {
- ReadWriteIOUtils.write(jarName, stream);
- }
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- int size = ReadWriteIOUtils.readInt(buffer);
- jarNames = new ArrayList<>(size);
- while (size > 0) {
- jarNames.add(ReadWriteIOUtils.readString(buffer));
- size--;
- }
- }
-
- @Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
@@ -79,7 +49,7 @@ public class GetTriggerJarPlan extends ConfigPhysicalPlan {
if (!super.equals(o)) {
return false;
}
- GetTriggerJarPlan that = (GetTriggerJarPlan) o;
+ final GetTriggerJarPlan that = (GetTriggerJarPlan) o;
return Objects.equals(jarNames, that.jarNames);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerLocationPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerLocationPlan.java
index 597392519de..a3dad77c035 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerLocationPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerLocationPlan.java
@@ -19,26 +19,16 @@
package org.apache.iotdb.confignode.consensus.request.read.trigger;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class GetTriggerLocationPlan extends ConfigPhysicalPlan {
-
- String triggerName;
+public class GetTriggerLocationPlan extends ConfigPhysicalReadPlan {
+ private final String triggerName;
- public GetTriggerLocationPlan() {
+ public GetTriggerLocationPlan(final String triggerName) {
super(ConfigPhysicalPlanType.GetTriggerLocation);
- }
-
- public GetTriggerLocationPlan(String triggerName) {
- this();
this.triggerName = triggerName;
}
@@ -46,24 +36,8 @@ public class GetTriggerLocationPlan extends ConfigPhysicalPlan {
return triggerName;
}
- public void setTriggerName(String triggerName) {
- this.triggerName = triggerName;
- }
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
-
- ReadWriteIOUtils.write(triggerName, stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.triggerName = ReadWriteIOUtils.readString(buffer);
- }
-
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
@@ -73,7 +47,7 @@ public class GetTriggerLocationPlan extends ConfigPhysicalPlan {
if (!super.equals(o)) {
return false;
}
- GetTriggerLocationPlan that = (GetTriggerLocationPlan) o;
+ final GetTriggerLocationPlan that = (GetTriggerLocationPlan) o;
return Objects.equals(triggerName, that.triggerName);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerTablePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerTablePlan.java
index a1af8644ce0..4388d78da24 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerTablePlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/trigger/GetTriggerTablePlan.java
@@ -19,26 +19,16 @@
package org.apache.iotdb.confignode.consensus.request.read.trigger;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
-import org.apache.tsfile.utils.ReadWriteIOUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Objects;
-public class GetTriggerTablePlan extends ConfigPhysicalPlan {
-
- boolean onlyStateful;
+public class GetTriggerTablePlan extends ConfigPhysicalReadPlan {
+ private final boolean onlyStateful;
- public GetTriggerTablePlan() {
+ public GetTriggerTablePlan(final boolean onlyStateful) {
super(ConfigPhysicalPlanType.GetTriggerTable);
- }
-
- public GetTriggerTablePlan(boolean onlyStateful) {
- this();
this.onlyStateful = onlyStateful;
}
@@ -46,24 +36,8 @@ public class GetTriggerTablePlan extends ConfigPhysicalPlan {
return onlyStateful;
}
- public void setOnlyStateful(boolean onlyStateful) {
- this.onlyStateful = onlyStateful;
- }
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
-
- ReadWriteIOUtils.write(onlyStateful, stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- this.onlyStateful = ReadWriteIOUtils.readBool(buffer);
- }
-
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
@@ -73,7 +47,7 @@ public class GetTriggerTablePlan extends ConfigPhysicalPlan {
if (!super.equals(o)) {
return false;
}
- GetTriggerTablePlan that = (GetTriggerTablePlan) o;
+ final GetTriggerTablePlan that = (GetTriggerTablePlan) o;
return onlyStateful == that.onlyStateful;
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ttl/ShowTTLPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ttl/ShowTTLPlan.java
index 9dd9eded31e..9f2992eeeb1 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ttl/ShowTTLPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/ttl/ShowTTLPlan.java
@@ -16,18 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.confignode.consensus.request.read.ttl;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import org.apache.iotdb.db.utils.constant.SqlConstant;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class ShowTTLPlan extends ConfigPhysicalPlan {
- private String[] pathPattern;
+public class ShowTTLPlan extends ConfigPhysicalReadPlan {
+ private final String[] pathPattern;
public String[] getPathPattern() {
return pathPattern;
@@ -38,14 +35,8 @@ public class ShowTTLPlan extends ConfigPhysicalPlan {
this.pathPattern = SqlConstant.getSingleRootArray();
}
- public ShowTTLPlan(String[] pathPattern) {
+ public ShowTTLPlan(final String[] pathPattern) {
super(ConfigPhysicalPlanType.ShowTTL);
this.pathPattern = pathPattern;
}
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {}
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {}
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/auth/AuthorPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/auth/AuthorPlan.java
similarity index 67%
rename from iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/auth/AuthorPlan.java
rename to iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/auth/AuthorPlan.java
index be162647f8f..8711cd86587 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/auth/AuthorPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/auth/AuthorPlan.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.iotdb.confignode.consensus.request.auth;
+package org.apache.iotdb.confignode.consensus.request.write.auth;
import org.apache.iotdb.commons.auth.entity.PrivilegeType;
import org.apache.iotdb.commons.exception.MetadataException;
@@ -91,7 +91,7 @@ public class AuthorPlan extends ConfigPhysicalPlan {
return authorType;
}
- public void setAuthorType(ConfigPhysicalPlanType authorType) {
+ public void setAuthorType(final ConfigPhysicalPlanType authorType) {
this.authorType = authorType;
}
@@ -99,7 +99,7 @@ public class AuthorPlan extends ConfigPhysicalPlan {
return roleName;
}
- public void setRoleName(String roleName) {
+ public void setRoleName(final String roleName) {
this.roleName = roleName;
}
@@ -107,7 +107,7 @@ public class AuthorPlan extends ConfigPhysicalPlan {
return password;
}
- public void setPassword(String password) {
+ public void setPassword(final String password) {
this.password = password;
}
@@ -115,15 +115,11 @@ public class AuthorPlan extends ConfigPhysicalPlan {
return newPassword;
}
- public void setNewPassword(String newPassword) {
- this.newPassword = newPassword;
- }
-
public Set<Integer> getPermissions() {
return permissions;
}
- public void setPermissions(Set<Integer> permissions) {
+ public void setPermissions(final Set<Integer> permissions) {
this.permissions = permissions;
}
@@ -131,7 +127,7 @@ public class AuthorPlan extends ConfigPhysicalPlan {
return this.grantOpt;
}
- public void setGrantOpt(boolean grantOpt) {
+ public void setGrantOpt(final boolean grantOpt) {
this.grantOpt = grantOpt;
}
@@ -139,7 +135,7 @@ public class AuthorPlan extends ConfigPhysicalPlan {
return nodeNameList;
}
- public void setNodeNameList(List<PartialPath> nodeNameList) {
+ public void setNodeNameList(final List<PartialPath> nodeNameList) {
this.nodeNameList = nodeNameList;
}
@@ -147,13 +143,13 @@ public class AuthorPlan extends ConfigPhysicalPlan {
return userName;
}
- public void setUserName(String userName) {
+ public void setUserName(final String userName) {
this.userName = userName;
}
@Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- ReadWriteIOUtils.write(getPlanType(authorType), stream);
+ protected void serializeImpl(final DataOutputStream stream) throws IOException {
+ ReadWriteIOUtils.write(authorType.getPlanType(), stream);
BasicStructureSerDeUtil.write(userName, stream);
BasicStructureSerDeUtil.write(roleName, stream);
BasicStructureSerDeUtil.write(password, stream);
@@ -163,12 +159,12 @@ public class AuthorPlan extends ConfigPhysicalPlan {
} else {
stream.write((byte) 1);
stream.writeInt(permissions.size());
- for (int permission : permissions) {
+ for (final int permission : permissions) {
stream.writeInt(permission);
}
}
BasicStructureSerDeUtil.write(nodeNameList.size(), stream);
- for (PartialPath partialPath : nodeNameList) {
+ for (final PartialPath partialPath : nodeNameList) {
BasicStructureSerDeUtil.write(partialPath.getFullPath(), stream);
}
BasicStructureSerDeUtil.write(grantOpt ? 1 : 0, stream);
@@ -184,14 +180,14 @@ public class AuthorPlan extends ConfigPhysicalPlan {
if (hasPermissions == (byte) 0) {
this.permissions = null;
} else {
- int permissionsSize = buffer.getInt();
+ final int permissionsSize = buffer.getInt();
this.permissions = new HashSet<>();
for (int i = 0; i < permissionsSize; i++) {
permissions.add(buffer.getInt());
}
}
- int nodeNameListSize = BasicStructureSerDeUtil.readInt(buffer);
+ final int nodeNameListSize = BasicStructureSerDeUtil.readInt(buffer);
nodeNameList = new ArrayList<>(nodeNameListSize);
try {
for (int i = 0; i < nodeNameListSize; i++) {
@@ -206,78 +202,15 @@ public class AuthorPlan extends ConfigPhysicalPlan {
}
}
- private short getPlanType(ConfigPhysicalPlanType configPhysicalPlanType) {
- short type;
- switch (configPhysicalPlanType) {
- case CreateUser:
- type = ConfigPhysicalPlanType.CreateUser.getPlanType();
- break;
- case CreateRole:
- type = ConfigPhysicalPlanType.CreateRole.getPlanType();
- break;
- case DropUser:
- type = ConfigPhysicalPlanType.DropUser.getPlanType();
- break;
- case DropRole:
- type = ConfigPhysicalPlanType.DropRole.getPlanType();
- break;
- case GrantRole:
- type = ConfigPhysicalPlanType.GrantRole.getPlanType();
- break;
- case GrantUser:
- type = ConfigPhysicalPlanType.GrantUser.getPlanType();
- break;
- case GrantRoleToUser:
- type = ConfigPhysicalPlanType.GrantRoleToUser.getPlanType();
- break;
- case RevokeUser:
- type = ConfigPhysicalPlanType.RevokeUser.getPlanType();
- break;
- case RevokeRole:
- type = ConfigPhysicalPlanType.RevokeRole.getPlanType();
- break;
- case RevokeRoleFromUser:
- type = ConfigPhysicalPlanType.RevokeRoleFromUser.getPlanType();
- break;
- case UpdateUser:
- type = ConfigPhysicalPlanType.UpdateUser.getPlanType();
- break;
- case ListUser:
- type = ConfigPhysicalPlanType.ListUser.getPlanType();
- break;
- case ListRole:
- type = ConfigPhysicalPlanType.ListRole.getPlanType();
- break;
- case ListUserPrivilege:
- type = ConfigPhysicalPlanType.ListUserPrivilege.getPlanType();
- break;
- case ListRolePrivilege:
- type = ConfigPhysicalPlanType.ListRolePrivilege.getPlanType();
- break;
- case ListUserRoles:
- type = ConfigPhysicalPlanType.ListUserRoles.getPlanType();
- break;
- case ListRoleUsers:
- type = ConfigPhysicalPlanType.ListRoleUsers.getPlanType();
- break;
- case CreateUserWithRawPassword:
- type = ConfigPhysicalPlanType.CreateUserWithRawPassword.getPlanType();
- break;
- default:
- throw new IllegalArgumentException("Unknown operator: " + configPhysicalPlanType);
- }
- return type;
- }
-
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- AuthorPlan that = (AuthorPlan) o;
+ final AuthorPlan that = (AuthorPlan) o;
return Objects.equals(authorType, that.authorType)
&& Objects.equals(userName, that.userName)
&& Objects.equals(roleName, that.roleName)
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/RemoveRegionLocationPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/RemoveRegionLocationPlan.java
index 9dc6a007052..47bc6493aa1 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/RemoveRegionLocationPlan.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/RemoveRegionLocationPlan.java
@@ -58,11 +58,6 @@ public class RemoveRegionLocationPlan extends ConfigPhysicalPlan {
deprecatedLocation = ThriftCommonsSerDeUtils.deserializeTDataNodeLocation(buffer);
}
- @Override
- public ConfigPhysicalPlanType getType() {
- return super.getType();
- }
-
public TConsensusGroupId getRegionId() {
return regionId;
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/sync/ShowPipePlanV1.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/sync/ShowPipePlanV1.java
deleted file mode 100644
index 0d8af2d1573..00000000000
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/sync/ShowPipePlanV1.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.confignode.consensus.request.write.sync;
-
-import org.apache.iotdb.commons.utils.BasicStructureSerDeUtil;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
-import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-// Deprecated, restored for upgrade
-@Deprecated
-public class ShowPipePlanV1 extends ConfigPhysicalPlan {
- /** empty pipeName means show all PIPE */
- private String pipeName;
-
- public ShowPipePlanV1() {
- super(ConfigPhysicalPlanType.ShowPipeV1);
- }
-
- public ShowPipePlanV1(String pipeName) {
- this();
- this.pipeName = pipeName;
- }
-
- public String getPipeName() {
- return pipeName;
- }
-
- @Override
- protected void serializeImpl(DataOutputStream stream) throws IOException {
- stream.writeShort(getType().getPlanType());
- BasicStructureSerDeUtil.write(pipeName, stream);
- }
-
- @Override
- protected void deserializeImpl(ByteBuffer buffer) throws IOException {
- pipeName = BasicStructureSerDeUtil.readString(buffer);
- }
-}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
index 3861521f6e9..16d24c4272a 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
@@ -31,6 +31,7 @@ import org.apache.iotdb.commons.file.SystemFileFactory;
import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import org.apache.iotdb.confignode.exception.physical.UnknownPhysicalPlanTypeException;
import org.apache.iotdb.confignode.manager.ConfigManager;
import org.apache.iotdb.confignode.manager.consensus.ConsensusManager;
@@ -166,17 +167,10 @@ public class ConfigRegionStateMachine implements IStateMachine, IStateMachine.Ev
}
@Override
- public DataSet read(IConsensusRequest request) {
- ConfigPhysicalPlan plan;
- if (request instanceof ByteBufferConsensusRequest) {
- try {
- plan = ConfigPhysicalPlan.Factory.create(request.serializeToByteBuffer());
- } catch (Exception e) {
- LOGGER.error("Deserialization error for write plan : {}", request);
- return null;
- }
- } else if (request instanceof ConfigPhysicalPlan) {
- plan = (ConfigPhysicalPlan) request;
+ public DataSet read(final IConsensusRequest request) {
+ final ConfigPhysicalReadPlan plan;
+ if (request instanceof ConfigPhysicalReadPlan) {
+ plan = (ConfigPhysicalReadPlan) request;
} else {
LOGGER.error("Unexpected read plan : {}", request);
return null;
@@ -184,12 +178,12 @@ public class ConfigRegionStateMachine implements IStateMachine, IStateMachine.Ev
return read(plan);
}
- /** Transmit {@link ConfigPhysicalPlan} to {@link ConfigPlanExecutor} */
- protected DataSet read(ConfigPhysicalPlan plan) {
+ /** Transmit {@link ConfigPhysicalReadPlan} to {@link ConfigPlanExecutor} */
+ protected DataSet read(final ConfigPhysicalReadPlan plan) {
DataSet result;
try {
result = executor.executeQueryPlan(plan);
- } catch (UnknownPhysicalPlanTypeException | AuthException e) {
+ } catch (final UnknownPhysicalPlanTypeException | AuthException e) {
LOGGER.error(e.getMessage());
result = null;
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
index 36c642f534e..552c2d44dce 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
@@ -61,8 +61,8 @@ import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
import org.apache.iotdb.confignode.conf.SystemPropertiesUtils;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.read.ainode.GetAINodeConfigurationPlan;
+import org.apache.iotdb.confignode.consensus.request.read.auth.AuthorReadPlan;
import org.apache.iotdb.confignode.consensus.request.read.database.CountDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
@@ -74,6 +74,7 @@ import org.apache.iotdb.confignode.consensus.request.read.partition.GetSchemaPar
import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionInfoListPlan;
import org.apache.iotdb.confignode.consensus.request.read.ttl.ShowTTLPlan;
import org.apache.iotdb.confignode.consensus.request.write.ainode.RemoveAINodePlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetDataReplicationFactorPlan;
@@ -1225,8 +1226,8 @@ public class ConfigManager implements IManager {
}
@Override
- public TSStatus operatePermission(AuthorPlan authorPlan) {
- TSStatus status = confirmLeader();
+ public TSStatus operatePermission(final AuthorPlan authorPlan) {
+ final TSStatus status = confirmLeader();
if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
return permissionManager.operatePermission(authorPlan, false);
} else {
@@ -1235,12 +1236,12 @@ public class ConfigManager implements IManager {
}
@Override
- public DataSet queryPermission(AuthorPlan authorPlan) {
- TSStatus status = confirmLeader();
+ public DataSet queryPermission(final AuthorReadPlan authorPlan) {
+ final TSStatus status = confirmLeader();
if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
return permissionManager.queryPermission(authorPlan);
} else {
- PermissionInfoResp dataSet = new PermissionInfoResp();
+ final PermissionInfoResp dataSet = new PermissionInfoResp();
dataSet.setStatus(status);
return dataSet;
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
index 8a38a9a77e3..013160923cb 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
@@ -30,8 +30,8 @@ import org.apache.iotdb.common.rpc.thrift.TShowConfigurationResp;
import org.apache.iotdb.commons.cluster.NodeStatus;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.commons.path.PathPatternTree;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.read.ainode.GetAINodeConfigurationPlan;
+import org.apache.iotdb.confignode.consensus.request.read.auth.AuthorReadPlan;
import org.apache.iotdb.confignode.consensus.request.read.database.CountDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
@@ -40,6 +40,7 @@ import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateD
import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionInfoListPlan;
import org.apache.iotdb.confignode.consensus.request.read.ttl.ShowTTLPlan;
import org.apache.iotdb.confignode.consensus.request.write.ainode.RemoveAINodePlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetDataReplicationFactorPlan;
@@ -465,14 +466,14 @@ public interface IManager {
*
* @return status
*/
- TSStatus operatePermission(AuthorPlan authorPlan);
+ TSStatus operatePermission(final AuthorPlan authorPlan);
/**
* Query Permission.
*
* @return PermissionInfoDataSet
*/
- DataSet queryPermission(AuthorPlan authorPlan);
+ DataSet queryPermission(final AuthorReadPlan authorPlan);
/** login. */
TPermissionInfoResp login(String username, String password);
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ModelManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ModelManager.java
index aa7ef2fb6e6..6121b30a886 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ModelManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ModelManager.java
@@ -70,18 +70,18 @@ public class ModelManager {
return configManager.getProcedureManager().dropModel(req.getModelId());
}
- public TShowModelResp showModel(TShowModelReq req) {
+ public TShowModelResp showModel(final TShowModelReq req) {
try {
- DataSet response = configManager.getConsensusManager().read(new ShowModelPlan(req));
+ final DataSet response = configManager.getConsensusManager().read(new ShowModelPlan(req));
return ((ModelTableResp) response).convertToThriftResponse();
- } catch (ConsensusException e) {
+ } catch (final ConsensusException e) {
LOGGER.warn(
String.format("Unexpected error happened while showing model %s: ", req.getModelId()), e);
// consensus layer related errors
- TSStatus res = new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode());
+ final TSStatus res = new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode());
res.setMessage(e.getMessage());
return new TShowModelResp(res, Collections.emptyList());
- } catch (IOException e) {
+ } catch (final IOException e) {
LOGGER.warn("Fail to get ModelTable", e);
return new TShowModelResp(
new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode())
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/PermissionManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/PermissionManager.java
index a6f0e23fcff..9592692d1bc 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/PermissionManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/PermissionManager.java
@@ -24,7 +24,8 @@ import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.auth.AuthException;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.read.auth.AuthorReadPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.response.auth.PermissionInfoResp;
import org.apache.iotdb.confignode.manager.consensus.ConsensusManager;
import org.apache.iotdb.confignode.persistence.AuthorInfo;
@@ -90,12 +91,12 @@ public class PermissionManager {
* @param authorPlan AuthorReq
* @return PermissionInfoResp
*/
- public PermissionInfoResp queryPermission(AuthorPlan authorPlan) {
+ public PermissionInfoResp queryPermission(final AuthorReadPlan authorPlan) {
try {
return (PermissionInfoResp) getConsensusManager().read(authorPlan);
- } catch (ConsensusException e) {
+ } catch (final ConsensusException e) {
LOGGER.warn("Failed in the read API executing the consensus layer due to: ", e);
- TSStatus res = new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode());
+ final TSStatus res = new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode());
res.setMessage(e.getMessage());
return new PermissionInfoResp(res);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java
index 27de22fe08f..de9ca92c8dc 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java
@@ -42,8 +42,8 @@ import org.apache.iotdb.commons.utils.StatusUtils;
import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.ainode.RemoveAINodePlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
import org.apache.iotdb.confignode.consensus.request.write.datanode.RemoveDataNodePlan;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
index 6133089d5a1..a339b461047 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
@@ -31,6 +31,7 @@ import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
import org.apache.iotdb.confignode.conf.SystemPropertiesUtils;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import org.apache.iotdb.confignode.consensus.statemachine.ConfigRegionStateMachine;
import org.apache.iotdb.confignode.exception.AddPeerException;
import org.apache.iotdb.confignode.manager.IManager;
@@ -332,7 +333,7 @@ public class ConsensusManager {
*
* @throws ConsensusException When read doesn't success
*/
- public DataSet read(ConfigPhysicalPlan plan) throws ConsensusException {
+ public DataSet read(final ConfigPhysicalReadPlan plan) throws ConsensusException {
return consensusImpl.read(DEFAULT_CONSENSUS_GROUP_ID, plan);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQManager.java
index ec27ec8cc92..5726b3ce826 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQManager.java
@@ -25,8 +25,8 @@ import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.cq.CQState;
import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
+import org.apache.iotdb.confignode.consensus.request.read.cq.ShowCQPlan;
import org.apache.iotdb.confignode.consensus.request.write.cq.DropCQPlan;
-import org.apache.iotdb.confignode.consensus.request.write.cq.ShowCQPlan;
import org.apache.iotdb.confignode.consensus.response.cq.ShowCQResp;
import org.apache.iotdb.confignode.manager.ConfigManager;
import org.apache.iotdb.confignode.persistence.cq.CQInfo;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
index e1a04a29007..e06d1889c12 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
@@ -326,15 +326,17 @@ public class PartitionManager {
/**
* Get DataPartition and create a new one if it does not exist.
*
- * @param req DataPartitionPlan with Map<StorageGroupName, Map<SeriesPartitionSlot,
- * List<TimePartitionSlot>>>
- * @return DataPartitionResp with DataPartition and TSStatus. SUCCESS_STATUS if all process
- * finish. NOT_ENOUGH_DATA_NODE if the DataNodes is not enough to create new Regions.
- * STORAGE_GROUP_NOT_EXIST if some StorageGroup don't exist.
+ * @param req DataPartitionPlan with Map{@literal <}StorageGroupName, Map{@literal
+ * <}SeriesPartitionSlot, List{@literal <}TimePartitionSlot{@literal >}{@literal >}{@literal
+ * >}
+ * @return DataPartitionResp with DataPartition and {@link TSStatus}. {@link
+ * TSStatusCode#SUCCESS_STATUS} if all process finish. {@link TSStatusCode#NO_ENOUGH_DATANODE}
+ * if the DataNodes is not enough to create new Regions. {@link
+ * TSStatusCode#DATABASE_NOT_EXIST} if some database does not exist.
*/
- public DataPartitionResp getOrCreateDataPartition(GetOrCreateDataPartitionPlan req) {
+ public DataPartitionResp getOrCreateDataPartition(final GetOrCreateDataPartitionPlan req) {
// Check if the related Databases exist
- for (String database : req.getPartitionSlotsMap().keySet()) {
+ for (final String database : req.getPartitionSlotsMap().keySet()) {
if (!isDatabaseExist(database)) {
return new DataPartitionResp(
new TSStatus(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode())
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/extractor/PipeConfigPhysicalPlanPatternParseVisitor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/extractor/PipeConfigPhysicalPlanPatternParseVisitor.java
index f789e3629a8..3d0602875bc 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/extractor/PipeConfigPhysicalPlanPatternParseVisitor.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/extractor/PipeConfigPhysicalPlanPatternParseVisitor.java
@@ -24,7 +24,7 @@ import org.apache.iotdb.commons.path.PathPatternTree;
import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePattern;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanVisitor;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DeleteDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java
index 0dd4c5c0e8d..8466f5fb16a 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java
@@ -33,7 +33,7 @@ import org.apache.iotdb.commons.schema.ttl.TTLCache;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DeleteDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/visitor/PipeConfigPhysicalPlanTSStatusVisitor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/visitor/PipeConfigPhysicalPlanTSStatusVisitor.java
index 2e028bf312e..a772ab77457 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/visitor/PipeConfigPhysicalPlanTSStatusVisitor.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/visitor/PipeConfigPhysicalPlanTSStatusVisitor.java
@@ -22,7 +22,7 @@ package org.apache.iotdb.confignode.manager.pipe.receiver.visitor;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanVisitor;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DeleteDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
index e993e40fbc2..61100f199f0 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
@@ -37,7 +37,8 @@ import org.apache.iotdb.commons.utils.AuthUtils;
import org.apache.iotdb.commons.utils.FileUtils;
import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.read.auth.AuthorReadPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.response.auth.PermissionInfoResp;
import org.apache.iotdb.confignode.rpc.thrift.TAuthizedPatternTreeResp;
import org.apache.iotdb.confignode.rpc.thrift.TPathPrivilege;
@@ -318,18 +319,18 @@ public class AuthorInfo implements SnapshotProcessor {
return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
}
- public PermissionInfoResp executeListUsers(AuthorPlan plan) throws AuthException {
- PermissionInfoResp result = new PermissionInfoResp();
- List<String> userList = authorizer.listAllUsers();
+ public PermissionInfoResp executeListUsers(final AuthorReadPlan plan) throws AuthException {
+ final PermissionInfoResp result = new PermissionInfoResp();
+ final List<String> userList = authorizer.listAllUsers();
if (!plan.getRoleName().isEmpty()) {
- Role role = authorizer.getRole(plan.getRoleName());
+ final Role role = authorizer.getRole(plan.getRoleName());
if (role == null) {
result.setStatus(
RpcUtils.getStatus(
TSStatusCode.ROLE_NOT_EXIST, "No such role : " + plan.getRoleName()));
return result;
}
- Iterator<String> itr = userList.iterator();
+ final Iterator<String> itr = userList.iterator();
while (itr.hasNext()) {
User userObj = authorizer.getUser(itr.next());
if (userObj == null || !userObj.hasRole(plan.getRoleName())) {
@@ -343,14 +344,14 @@ public class AuthorInfo implements SnapshotProcessor {
return result;
}
- public PermissionInfoResp executeListRoles(AuthorPlan plan) throws AuthException {
- PermissionInfoResp result = new PermissionInfoResp();
- List<String> permissionInfo = new ArrayList<>();
- List<String> roleList = new ArrayList<>();
+ public PermissionInfoResp executeListRoles(final AuthorReadPlan plan) throws AuthException {
+ final PermissionInfoResp result = new PermissionInfoResp();
+ final List<String> permissionInfo = new ArrayList<>();
+ final List<String> roleList = new ArrayList<>();
if (plan.getUserName().isEmpty()) {
roleList.addAll(authorizer.listAllRoles());
} else {
- User user = authorizer.getUser(plan.getUserName());
+ final User user = authorizer.getUser(plan.getUserName());
if (user == null) {
result.setStatus(
RpcUtils.getStatus(TSStatusCode.USER_NOT_EXIST, NO_USER_MSG + plan.getUserName()));
@@ -365,22 +366,23 @@ public class AuthorInfo implements SnapshotProcessor {
return result;
}
- public PermissionInfoResp executeListRolePrivileges(AuthorPlan plan) throws AuthException {
- PermissionInfoResp result = new PermissionInfoResp();
- List<String> permissionInfo = new ArrayList<>();
- Role role = authorizer.getRole(plan.getRoleName());
+ public PermissionInfoResp executeListRolePrivileges(final AuthorReadPlan plan)
+ throws AuthException {
+ final PermissionInfoResp result = new PermissionInfoResp();
+ final List<String> permissionInfo = new ArrayList<>();
+ final Role role = authorizer.getRole(plan.getRoleName());
if (role == null) {
result.setStatus(
RpcUtils.getStatus(TSStatusCode.ROLE_NOT_EXIST, "No such role : " + plan.getRoleName()));
result.setMemberInfo(permissionInfo);
return result;
}
- TPermissionInfoResp resp = new TPermissionInfoResp();
- TRoleResp roleResp = new TRoleResp();
+ final TPermissionInfoResp resp = new TPermissionInfoResp();
+ final TRoleResp roleResp = new TRoleResp();
roleResp.setRoleName(role.getName());
- List<TPathPrivilege> pathList = new ArrayList<>();
- for (PathPrivilege path : role.getPathPrivilegeList()) {
- TPathPrivilege pathPri = new TPathPrivilege();
+ final List<TPathPrivilege> pathList = new ArrayList<>();
+ for (final PathPrivilege path : role.getPathPrivilegeList()) {
+ final TPathPrivilege pathPri = new TPathPrivilege();
pathPri.setPriGrantOpt(path.getGrantOpt());
pathPri.setPriSet(path.getPrivileges());
pathPri.setPath(path.getPath().toString());
@@ -389,7 +391,7 @@ public class AuthorInfo implements SnapshotProcessor {
roleResp.setPrivilegeList(pathList);
roleResp.setSysPriSet(role.getSysPrivilege());
roleResp.setSysPriSetGrantOpt(role.getSysPriGrantOpt());
- Map<String, TRoleResp> roleInfo = new HashMap<>();
+ final Map<String, TRoleResp> roleInfo = new HashMap<>();
roleInfo.put(role.getName(), roleResp);
resp.setRoleInfo(roleInfo);
resp.setStatus(RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS));
@@ -400,15 +402,16 @@ public class AuthorInfo implements SnapshotProcessor {
return result;
}
- public PermissionInfoResp executeListUserPrivileges(AuthorPlan plan) throws AuthException {
- PermissionInfoResp result = new PermissionInfoResp();
- User user = authorizer.getUser(plan.getUserName());
+ public PermissionInfoResp executeListUserPrivileges(final AuthorReadPlan plan)
+ throws AuthException {
+ final PermissionInfoResp result = new PermissionInfoResp();
+ final User user = authorizer.getUser(plan.getUserName());
if (user == null) {
result.setStatus(
RpcUtils.getStatus(TSStatusCode.USER_NOT_EXIST, NO_USER_MSG + plan.getUserName()));
return result;
}
- TPermissionInfoResp resp = getUserPermissionInfo(plan.getUserName());
+ final TPermissionInfoResp resp = getUserPermissionInfo(plan.getUserName());
resp.setStatus(RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS));
result.setTag(ColumnHeaderConstant.PRIVILEGES);
result.setPermissionInfoResp(resp);
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
index a93196231c0..d1dc7420212 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
@@ -27,8 +27,9 @@ import org.apache.iotdb.commons.schema.node.MNodeType;
import org.apache.iotdb.commons.schema.ttl.TTLCache;
import org.apache.iotdb.commons.snapshot.SnapshotProcessor;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan;
import org.apache.iotdb.confignode.consensus.request.read.ainode.GetAINodeConfigurationPlan;
+import org.apache.iotdb.confignode.consensus.request.read.auth.AuthorReadPlan;
import org.apache.iotdb.confignode.consensus.request.read.database.CountDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
@@ -56,6 +57,7 @@ import org.apache.iotdb.confignode.consensus.request.read.ttl.ShowTTLPlan;
import org.apache.iotdb.confignode.consensus.request.write.ainode.RegisterAINodePlan;
import org.apache.iotdb.confignode.consensus.request.write.ainode.RemoveAINodePlan;
import org.apache.iotdb.confignode.consensus.request.write.ainode.UpdateAINodePlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.ApplyConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.UpdateClusterIdPlan;
@@ -266,7 +268,7 @@ public class ConfigPlanExecutor {
this.snapshotProcessorList.add(PipeConfigNodeAgent.runtime().listener());
}
- public DataSet executeQueryPlan(ConfigPhysicalPlan req)
+ public DataSet executeQueryPlan(final ConfigPhysicalReadPlan req)
throws UnknownPhysicalPlanTypeException, AuthException {
switch (req.getType()) {
case GetDataNodeConfiguration:
@@ -284,13 +286,13 @@ public class ConfigPlanExecutor {
case GetOrCreateSchemaPartition:
return partitionInfo.getSchemaPartition((GetSchemaPartitionPlan) req);
case ListUser:
- return authorInfo.executeListUsers((AuthorPlan) req);
+ return authorInfo.executeListUsers((AuthorReadPlan) req);
case ListRole:
- return authorInfo.executeListRoles((AuthorPlan) req);
+ return authorInfo.executeListRoles((AuthorReadPlan) req);
case ListUserPrivilege:
- return authorInfo.executeListUserPrivileges((AuthorPlan) req);
+ return authorInfo.executeListUserPrivileges((AuthorReadPlan) req);
case ListRolePrivilege:
- return authorInfo.executeListRolePrivileges((AuthorPlan) req);
+ return authorInfo.executeListRolePrivileges((AuthorReadPlan) req);
case GetNodePathsPartition:
return getSchemaNodeManagementPartition(req);
case GetRegionInfoList:
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/CNPhysicalPlanGenerator.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/CNPhysicalPlanGenerator.java
index 3469a3a5806..f949b765470 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/CNPhysicalPlanGenerator.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/CNPhysicalPlanGenerator.java
@@ -29,7 +29,7 @@ import org.apache.iotdb.commons.utils.PathUtils;
import org.apache.iotdb.commons.utils.ThriftConfigNodeSerDeUtils;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
import org.apache.iotdb.confignode.consensus.request.write.template.CommitSetSchemaTemplatePlan;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedure.java
index d8e999cd187..f8e0c9d2233 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedure.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedure.java
@@ -28,7 +28,7 @@ import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
import org.apache.iotdb.confignode.client.CnToDnRequestType;
import org.apache.iotdb.confignode.client.sync.SyncDataNodeClientPool;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeEnrichedPlan;
import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv;
import org.apache.iotdb.confignode.procedure.exception.ProcedureException;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
index d8f88184767..b509001b984 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
@@ -46,8 +46,8 @@ import org.apache.iotdb.confignode.conf.ConfigNodeConstant;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
import org.apache.iotdb.confignode.conf.SystemPropertiesUtils;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.read.ainode.GetAINodeConfigurationPlan;
+import org.apache.iotdb.confignode.consensus.request.read.auth.AuthorReadPlan;
import org.apache.iotdb.confignode.consensus.request.read.database.CountDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
@@ -56,6 +56,7 @@ import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateD
import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionInfoListPlan;
import org.apache.iotdb.confignode.consensus.request.read.ttl.ShowTTLPlan;
import org.apache.iotdb.confignode.consensus.request.write.ainode.RemoveAINodePlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetDataReplicationFactorPlan;
@@ -595,7 +596,7 @@ public class ConfigNodeRPCServiceProcessor implements IConfigNodeRPCService.Ifac
return showTTLResp.convertToRPCTShowTTLResp();
}
- public TSStatus callSpecialProcedure(TTestOperation operation) throws TException {
+ public TSStatus callSpecialProcedure(TTestOperation operation) {
switch (operation) {
case TEST_PROCEDURE_RECOVER:
return configManager.getProcedureManager().createManyDatabases();
@@ -686,7 +687,7 @@ public class ConfigNodeRPCServiceProcessor implements IConfigNodeRPCService.Ifac
final PermissionInfoResp dataSet =
(PermissionInfoResp)
configManager.queryPermission(
- new AuthorPlan(
+ new AuthorReadPlan(
ConfigPhysicalPlanType.values()[
req.getAuthorType() + ConfigPhysicalPlanType.CreateUser.ordinal()],
req.getUserName(),
diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
index f77148a0064..f5f2aa70574 100644
--- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
+++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
@@ -59,41 +59,13 @@ import org.apache.iotdb.commons.sync.PipeStatus;
import org.apache.iotdb.commons.sync.TsFilePipeInfo;
import org.apache.iotdb.commons.trigger.TriggerInformation;
import org.apache.iotdb.commons.udf.UDFInformation;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
-import org.apache.iotdb.confignode.consensus.request.read.database.CountDatabasePlan;
-import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePlan;
-import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
-import org.apache.iotdb.confignode.consensus.request.read.function.GetFunctionTablePlan;
-import org.apache.iotdb.confignode.consensus.request.read.function.GetUDFJarPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.CountTimeSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetNodePathsPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateDataPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateSchemaPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetSchemaPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetSeriesSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetTimeSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.pipe.plugin.GetPipePluginJarPlan;
-import org.apache.iotdb.confignode.consensus.request.read.pipe.plugin.GetPipePluginTablePlan;
-import org.apache.iotdb.confignode.consensus.request.read.pipe.task.ShowPipePlanV2;
-import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionIdPlan;
-import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionInfoListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.table.ShowTablePlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetAllSchemaTemplatePlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetAllTemplateSetInfoPlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetPathsSetTemplatePlan;
-import org.apache.iotdb.confignode.consensus.request.read.template.GetSchemaTemplatePlan;
-import org.apache.iotdb.confignode.consensus.request.read.trigger.GetTransferringTriggersPlan;
-import org.apache.iotdb.confignode.consensus.request.read.trigger.GetTriggerJarPlan;
-import org.apache.iotdb.confignode.consensus.request.read.trigger.GetTriggerLocationPlan;
-import org.apache.iotdb.confignode.consensus.request.read.trigger.GetTriggerTablePlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.ApplyConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
import org.apache.iotdb.confignode.consensus.request.write.confignode.UpdateClusterIdPlan;
import org.apache.iotdb.confignode.consensus.request.write.cq.ActiveCQPlan;
import org.apache.iotdb.confignode.consensus.request.write.cq.AddCQPlan;
import org.apache.iotdb.confignode.consensus.request.write.cq.DropCQPlan;
-import org.apache.iotdb.confignode.consensus.request.write.cq.ShowCQPlan;
import org.apache.iotdb.confignode.consensus.request.write.cq.UpdateCQLastExecTimePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.AdjustMaxRegionGroupNumPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
@@ -146,7 +118,6 @@ import org.apache.iotdb.confignode.consensus.request.write.sync.GetPipeSinkPlanV
import org.apache.iotdb.confignode.consensus.request.write.sync.PreCreatePipePlanV1;
import org.apache.iotdb.confignode.consensus.request.write.sync.RecordPipeMessagePlan;
import org.apache.iotdb.confignode.consensus.request.write.sync.SetPipeStatusPlanV1;
-import org.apache.iotdb.confignode.consensus.request.write.sync.ShowPipePlanV1;
import org.apache.iotdb.confignode.consensus.request.write.table.AddTableColumnPlan;
import org.apache.iotdb.confignode.consensus.request.write.table.CommitCreateTablePlan;
import org.apache.iotdb.confignode.consensus.request.write.table.PreCreateTablePlan;
@@ -172,8 +143,6 @@ import org.apache.iotdb.confignode.procedure.impl.schema.DeleteDatabaseProcedure
import org.apache.iotdb.confignode.rpc.thrift.TCreateCQReq;
import org.apache.iotdb.confignode.rpc.thrift.TDatabaseSchema;
import org.apache.iotdb.confignode.rpc.thrift.TPipeSinkInfo;
-import org.apache.iotdb.confignode.rpc.thrift.TShowRegionReq;
-import org.apache.iotdb.confignode.rpc.thrift.TTimeSlotList;
import org.apache.iotdb.confignode.rpc.thrift.TTriggerState;
import org.apache.iotdb.db.schemaengine.template.Template;
import org.apache.iotdb.db.schemaengine.template.alter.TemplateExtendInfo;
@@ -202,10 +171,8 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import static org.apache.iotdb.common.rpc.thrift.TConsensusGroupType.ConfigRegion;
import static org.apache.iotdb.common.rpc.thrift.TConsensusGroupType.DataRegion;
import static org.apache.iotdb.common.rpc.thrift.TConsensusGroupType.SchemaRegion;
-import static org.apache.iotdb.commons.schema.SchemaConstant.ALL_MATCH_SCOPE;
import static org.junit.Assert.assertEquals;
public class ConfigPhysicalPlanSerDeTest {
@@ -254,15 +221,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(plan0, plan1);
}
- @Test
- public void QueryDataNodeInfoPlanTest() throws IOException {
- GetDataNodeConfigurationPlan plan0 = new GetDataNodeConfigurationPlan(-1);
- GetDataNodeConfigurationPlan plan1 =
- (GetDataNodeConfigurationPlan)
- ConfigPhysicalPlan.Factory.create(plan0.serializeToByteBuffer());
- Assert.assertEquals(plan0, plan1);
- }
-
@Test
public void CreateDatabasePlanTest() throws IOException {
DatabaseSchemaPlan req0 =
@@ -353,22 +311,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(req0, req1);
}
- @Test
- public void CountStorageGroupPlanTest() throws IOException {
- CountDatabasePlan req0 = new CountDatabasePlan(Arrays.asList("root", "sg"), ALL_MATCH_SCOPE);
- CountDatabasePlan req1 =
- (CountDatabasePlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
- }
-
- @Test
- public void GetStorageGroupPlanTest() throws IOException {
- GetDatabasePlan req0 = new GetDatabasePlan(Arrays.asList("root", "sg"), ALL_MATCH_SCOPE);
- CountDatabasePlan req1 =
- (CountDatabasePlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
- }
-
@Test
public void CreateRegionsPlanTest() throws IOException {
TDataNodeLocation dataNodeLocation = new TDataNodeLocation();
@@ -458,35 +400,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(req0, req1);
}
- @Test
- public void GetSchemaPartitionPlanTest() throws IOException {
- String storageGroup = "root.sg0";
- TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(10);
-
- Map<String, List<TSeriesPartitionSlot>> partitionSlotsMap = new HashMap<>();
- partitionSlotsMap.put(storageGroup, Collections.singletonList(seriesPartitionSlot));
-
- GetSchemaPartitionPlan req0 = new GetSchemaPartitionPlan(partitionSlotsMap);
- GetSchemaPartitionPlan req1 =
- (GetSchemaPartitionPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
- }
-
- @Test
- public void GetOrCreateSchemaPartitionPlanTest() throws IOException {
- String storageGroup = "root.sg0";
- TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(10);
-
- Map<String, List<TSeriesPartitionSlot>> partitionSlotsMap = new HashMap<>();
- partitionSlotsMap.put(storageGroup, Collections.singletonList(seriesPartitionSlot));
-
- GetOrCreateSchemaPartitionPlan req0 = new GetOrCreateSchemaPartitionPlan(partitionSlotsMap);
- GetOrCreateSchemaPartitionPlan req1 =
- (GetOrCreateSchemaPartitionPlan)
- ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
- }
-
@Test
public void CreateDataPartitionPlanTest() throws IOException {
TDataNodeLocation dataNodeLocation = new TDataNodeLocation();
@@ -521,53 +434,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(req0, req1);
}
- @Test
- public void GetDataPartitionPlanTest() throws IOException {
- String storageGroup = "root.sg0";
- TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(10);
- TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot(100);
-
- Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> partitionSlotsMap = new HashMap<>();
- partitionSlotsMap.put(storageGroup, new HashMap<>());
- partitionSlotsMap
- .get(storageGroup)
- .put(seriesPartitionSlot, new TTimeSlotList().setTimePartitionSlots(new ArrayList<>()));
- partitionSlotsMap
- .get(storageGroup)
- .get(seriesPartitionSlot)
- .getTimePartitionSlots()
- .add(timePartitionSlot);
-
- GetDataPartitionPlan req0 = new GetDataPartitionPlan(partitionSlotsMap);
- GetDataPartitionPlan req1 =
- (GetDataPartitionPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
- }
-
- @Test
- public void GetOrCreateDataPartitionPlanTest() throws IOException {
- String storageGroup = "root.sg0";
- TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(10);
- TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot(100);
-
- Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> partitionSlotsMap = new HashMap<>();
- partitionSlotsMap.put(storageGroup, new HashMap<>());
- partitionSlotsMap
- .get(storageGroup)
- .put(seriesPartitionSlot, new TTimeSlotList().setTimePartitionSlots(new ArrayList<>()));
- partitionSlotsMap
- .get(storageGroup)
- .get(seriesPartitionSlot)
- .getTimePartitionSlots()
- .add(timePartitionSlot);
-
- GetOrCreateDataPartitionPlan req0 = new GetOrCreateDataPartitionPlan(partitionSlotsMap);
- GetOrCreateDataPartitionPlan req1 =
- (GetOrCreateDataPartitionPlan)
- ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
- }
-
@Test
public void AuthorPlanTest() throws IOException, IllegalPathException {
AuthorPlan req0;
@@ -732,118 +598,6 @@ public class ConfigPhysicalPlanSerDeTest {
new ArrayList<>());
req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
Assert.assertEquals(req0, req1);
-
- // list user
- req0 =
- new AuthorPlan(
- ConfigPhysicalPlanType.ListUser,
- "",
- "",
- "",
- "",
- new HashSet<>(),
- false,
- new ArrayList<>());
- req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
-
- // list role
- req0 =
- new AuthorPlan(
- ConfigPhysicalPlanType.ListRole,
- "",
- "",
- "",
- "",
- new HashSet<>(),
- false,
- new ArrayList<>());
- req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
-
- // list privileges user
- req0 =
- new AuthorPlan(
- ConfigPhysicalPlanType.ListUserPrivilege,
- "",
- "",
- "",
- "",
- new HashSet<>(),
- false,
- new ArrayList<>());
- req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
-
- // list privileges role
- req0 =
- new AuthorPlan(
- ConfigPhysicalPlanType.ListRolePrivilege,
- "",
- "",
- "",
- "",
- new HashSet<>(),
- false,
- new ArrayList<>());
- req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
-
- // list user privileges
- req0 =
- new AuthorPlan(
- ConfigPhysicalPlanType.ListUserPrivilege,
- "",
- "",
- "",
- "",
- new HashSet<>(),
- false,
- new ArrayList<>());
- req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
-
- // list role privileges
- req0 =
- new AuthorPlan(
- ConfigPhysicalPlanType.ListRolePrivilege,
- "",
- "",
- "",
- "",
- new HashSet<>(),
- false,
- new ArrayList<>());
- req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
-
- // list all role of user
- req0 =
- new AuthorPlan(
- ConfigPhysicalPlanType.ListUserRoles,
- "",
- "",
- "",
- "",
- new HashSet<>(),
- false,
- new ArrayList<>());
- req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
-
- // list all user of role
- req0 =
- new AuthorPlan(
- ConfigPhysicalPlanType.ListRoleUsers,
- "",
- "",
- "",
- "",
- new HashSet<>(),
- false,
- new ArrayList<>());
- req1 = (AuthorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0, req1);
}
@Test
@@ -938,24 +692,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(req0, req1);
}
- @Test
- public void GetRegionLocationsPlanTest() throws IOException {
- final GetRegionInfoListPlan req0 = new GetRegionInfoListPlan();
- final TShowRegionReq showRegionReq = new TShowRegionReq();
- req0.setShowRegionReq(showRegionReq);
- showRegionReq.setConsensusGroupType(TConsensusGroupType.DataRegion);
- final GetRegionInfoListPlan req1 =
- (GetRegionInfoListPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0.getType(), req1.getType());
- Assert.assertEquals(req0.getShowRegionReq(), req1.getShowRegionReq());
- final List<String> sgList = Collections.singletonList("root.sg1, root.sg2, root.*");
- showRegionReq.setDatabases(new ArrayList<>(sgList));
- final GetRegionInfoListPlan req2 =
- (GetRegionInfoListPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer());
- Assert.assertEquals(req0.getType(), req1.getType());
- Assert.assertEquals(req0.getShowRegionReq(), req2.getShowRegionReq());
- }
-
@Test
public void CreateSchemaTemplatePlanTest() throws IOException, IllegalPathException {
final Template template = newSchemaTemplate("template_name");
@@ -991,52 +727,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(plan, ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()));
}
- @Test
- public void GetSchemaTemplatePlanTest() throws IOException {
- final GetSchemaTemplatePlan getSchemaTemplatePlan = new GetSchemaTemplatePlan("template1");
- final GetSchemaTemplatePlan deserializedPlan =
- (GetSchemaTemplatePlan)
- ConfigPhysicalPlan.Factory.create(getSchemaTemplatePlan.serializeToByteBuffer());
- Assert.assertEquals("template1", deserializedPlan.getTemplateName());
- }
-
- @Test
- public void GetAllSchemaTemplatePlanTest() throws IOException {
- final GetAllSchemaTemplatePlan getAllSchemaTemplatePlan0 = new GetAllSchemaTemplatePlan();
- Assert.assertTrue(
- ConfigPhysicalPlan.Factory.create(getAllSchemaTemplatePlan0.serializeToByteBuffer())
- instanceof GetAllSchemaTemplatePlan);
- }
-
- @Test
- public void GetNodesInSchemaTemplatePlanTest() throws IOException {
- final GetSchemaTemplatePlan getSchemaTemplatePlan0 =
- new GetSchemaTemplatePlan("template_name_test");
- final GetSchemaTemplatePlan getSchemaTemplatePlan1 =
- (GetSchemaTemplatePlan)
- ConfigPhysicalPlan.Factory.create(getSchemaTemplatePlan0.serializeToByteBuffer());
- Assert.assertEquals(getSchemaTemplatePlan0, getSchemaTemplatePlan1);
- }
-
- @Test
- public void GetNodePathsPartitionPlanTest() throws IOException, IllegalPathException {
- final GetNodePathsPartitionPlan getNodePathsPartitionPlan0 = new GetNodePathsPartitionPlan();
- getNodePathsPartitionPlan0.setPartialPath(new PartialPath("root.sg1.**"));
- getNodePathsPartitionPlan0.setScope(ALL_MATCH_SCOPE);
- final GetNodePathsPartitionPlan getNodePathsPartitionPlan1 =
- (GetNodePathsPartitionPlan)
- ConfigPhysicalPlan.Factory.create(getNodePathsPartitionPlan0.serializeToByteBuffer());
- Assert.assertEquals(getNodePathsPartitionPlan0, getNodePathsPartitionPlan1);
- }
-
- @Test
- public void GetAllTemplateSetInfoPlanTest() throws IOException {
- final GetAllTemplateSetInfoPlan getAllTemplateSetInfoPlan = new GetAllTemplateSetInfoPlan();
- Assert.assertTrue(
- ConfigPhysicalPlan.Factory.create(getAllTemplateSetInfoPlan.serializeToByteBuffer())
- instanceof GetAllTemplateSetInfoPlan);
- }
-
@Test
public void SetSchemaTemplatePlanTest() throws IOException {
final SetSchemaTemplatePlan setSchemaTemplatePlanPlan0 =
@@ -1049,16 +739,6 @@ public class ConfigPhysicalPlanSerDeTest {
setSchemaTemplatePlanPlan0.getPath().equals(setSchemaTemplatePlanPlan1.getPath()));
}
- @Test
- public void ShowPathSetTemplatePlanTest() throws IOException {
- final GetPathsSetTemplatePlan getPathsSetTemplatePlan0 =
- new GetPathsSetTemplatePlan("template_name_test", ALL_MATCH_SCOPE);
- final GetPathsSetTemplatePlan getPathsSetTemplatePlan1 =
- (GetPathsSetTemplatePlan)
- ConfigPhysicalPlan.Factory.create(getPathsSetTemplatePlan0.serializeToByteBuffer());
- Assert.assertEquals(getPathsSetTemplatePlan0.getName(), getPathsSetTemplatePlan1.getName());
- }
-
@Test
public void DropSchemaTemplateTest() throws IOException {
final DropSchemaTemplatePlan dropSchemaTemplatePlan = new DropSchemaTemplatePlan("template");
@@ -1270,20 +950,6 @@ public class ConfigPhysicalPlanSerDeTest {
operateMultiplePipesPlanV2.getSubPlans(), operateMultiplePipesPlanV21.getSubPlans());
}
- @Test
- public void ShowPipePlanV1Test() throws IOException {
- final ShowPipePlanV1 showPipePlan = new ShowPipePlanV1("demo");
- final ShowPipePlanV1 showPipePlan1 =
- (ShowPipePlanV1) ConfigPhysicalPlan.Factory.create(showPipePlan.serializeToByteBuffer());
- Assert.assertEquals(showPipePlan.getPipeName(), showPipePlan1.getPipeName());
- final ShowPipePlanV1 showPipePlanWithNullName = new ShowPipePlanV1();
- final ShowPipePlanV1 showPipePlanWithNullName1 =
- (ShowPipePlanV1)
- ConfigPhysicalPlan.Factory.create(showPipePlanWithNullName.serializeToByteBuffer());
- Assert.assertEquals(
- showPipePlanWithNullName.getPipeName(), showPipePlanWithNullName1.getPipeName());
- }
-
@Test
public void CreatePipePluginPlanTest() throws IOException {
final CreatePipePluginPlan createPipePluginPlan =
@@ -1546,35 +1212,6 @@ public class ConfigPhysicalPlanSerDeTest {
setTablePropertiesPlan0.getProperties(), setTablePropertiesPlan1.getProperties());
}
- @Test
- public void showTablePlanTest() throws IOException {
- final ShowTablePlan showTablePlan = new ShowTablePlan("database");
- Assert.assertEquals(
- showTablePlan.getDatabase(),
- ((ShowTablePlan) ConfigPhysicalPlan.Factory.create(showTablePlan.serializeToByteBuffer()))
- .getDatabase());
- }
-
- @Test
- public void GetTriggerTablePlanTest() throws IOException {
- GetTriggerTablePlan getTriggerTablePlan0 = new GetTriggerTablePlan(true);
- GetTriggerTablePlan getTriggerTablePlan1 =
- (GetTriggerTablePlan)
- ConfigPhysicalPlan.Factory.create(getTriggerTablePlan0.serializeToByteBuffer());
- Assert.assertEquals(
- getTriggerTablePlan0.isOnlyStateful(), getTriggerTablePlan1.isOnlyStateful());
- }
-
- @Test
- public void GetTriggerLocationPlanTest() throws IOException {
- GetTriggerLocationPlan getTriggerLocationPlan0 = new GetTriggerLocationPlan("test1");
- GetTriggerLocationPlan getTriggerLocationPlan1 =
- (GetTriggerLocationPlan)
- ConfigPhysicalPlan.Factory.create(getTriggerLocationPlan0.serializeToByteBuffer());
- Assert.assertEquals(
- getTriggerLocationPlan0.getTriggerName(), getTriggerLocationPlan1.getTriggerName());
- }
-
@Test
public void AddTriggerInTablePlanTest() throws IOException, IllegalPathException {
TriggerInformation triggerInformation =
@@ -1674,15 +1311,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(dropCQPlan0, dropCQPlan1);
}
- @Test
- public void ShowCQPlanTest() throws IOException {
- ShowCQPlan showCQPlan0 = new ShowCQPlan();
- ShowCQPlan showCQPlan1 =
- (ShowCQPlan) ConfigPhysicalPlan.Factory.create(showCQPlan0.serializeToByteBuffer());
-
- Assert.assertEquals(showCQPlan0, showCQPlan1);
- }
-
@Test
public void UpdateCQLastExecTimePlanTest() throws IOException {
UpdateCQLastExecTimePlan updateCQLastExecTimePlan0 =
@@ -1694,86 +1322,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(updateCQLastExecTimePlan0, updateCQLastExecTimePlan1);
}
- @Test
- public void GetTriggerJarPlanTest() throws IOException {
- final List<String> jarNames = new ArrayList<>();
- jarNames.add("test1");
- jarNames.add("test2");
- final GetTriggerJarPlan getTriggerJarPlan0 = new GetTriggerJarPlan(jarNames);
-
- final GetTriggerJarPlan getTriggerJarPlan1 =
- (GetTriggerJarPlan)
- ConfigPhysicalPlan.Factory.create(getTriggerJarPlan0.serializeToByteBuffer());
- Assert.assertEquals(getTriggerJarPlan0.getJarNames(), getTriggerJarPlan1.getJarNames());
- }
-
- @Test
- public void GetRegionIdPlanTest() throws IOException {
- final GetRegionIdPlan getRegionIdPlan0 = new GetRegionIdPlan(ConfigRegion);
- final GetRegionIdPlan getRegionIdPlan1 =
- (GetRegionIdPlan)
- ConfigPhysicalPlan.Factory.create(getRegionIdPlan0.serializeToByteBuffer());
- Assert.assertEquals(getRegionIdPlan0, getRegionIdPlan1);
- }
-
- @Test
- public void GetTimeSlotListPlanTest() throws IOException {
- final GetTimeSlotListPlan getTimeSlotListPlan0 = new GetTimeSlotListPlan(0, Long.MAX_VALUE);
- final GetTimeSlotListPlan getTimeSlotListPlan1 =
- (GetTimeSlotListPlan)
- ConfigPhysicalPlan.Factory.create(getTimeSlotListPlan0.serializeToByteBuffer());
- Assert.assertEquals(getTimeSlotListPlan0, getTimeSlotListPlan1);
- }
-
- @Test
- public void CountTimeSlotListPlanTest() throws IOException {
- final CountTimeSlotListPlan countTimeSlotListPlan0 =
- new CountTimeSlotListPlan(0, Long.MAX_VALUE);
- final CountTimeSlotListPlan countTimeSlotListPlan1 =
- (CountTimeSlotListPlan)
- ConfigPhysicalPlan.Factory.create(countTimeSlotListPlan0.serializeToByteBuffer());
- Assert.assertEquals(countTimeSlotListPlan0, countTimeSlotListPlan1);
- }
-
- @Test
- public void GetSeriesSlotListPlanTest() throws IOException {
- final GetSeriesSlotListPlan getSeriesSlotListPlan0 =
- new GetSeriesSlotListPlan("root.test", SchemaRegion);
- final GetSeriesSlotListPlan getSeriesSlotListPlan1 =
- (GetSeriesSlotListPlan)
- ConfigPhysicalPlan.Factory.create(getSeriesSlotListPlan0.serializeToByteBuffer());
- Assert.assertEquals(getSeriesSlotListPlan0, getSeriesSlotListPlan1);
- }
-
- @Test
- public void GetPipePluginJarPlanTest() throws IOException {
- final List<String> jarNames = new ArrayList<>();
- jarNames.add("org.apache.testJar");
- jarNames.add("org.apache.testJar2");
- final GetPipePluginJarPlan getPipePluginJarPlan0 = new GetPipePluginJarPlan(jarNames);
- final GetPipePluginJarPlan getPipePluginJarPlan1 =
- (GetPipePluginJarPlan)
- ConfigPhysicalPlan.Factory.create(getPipePluginJarPlan0.serializeToByteBuffer());
- Assert.assertEquals(getPipePluginJarPlan0, getPipePluginJarPlan1);
- }
-
- @Test
- public void GetPipePluginTablePlanTest() throws IOException {
- final GetPipePluginTablePlan getPipePluginTablePlan0 = new GetPipePluginTablePlan();
- final GetPipePluginTablePlan getPipePluginTablePlan1 =
- (GetPipePluginTablePlan)
- ConfigPhysicalPlan.Factory.create(getPipePluginTablePlan0.serializeToByteBuffer());
- Assert.assertEquals(getPipePluginTablePlan0, getPipePluginTablePlan1);
- }
-
- @Test
- public void ShowPipePlanV2Test() throws IOException {
- final ShowPipePlanV2 showPipePlanV2 = new ShowPipePlanV2();
- final ShowPipePlanV2 showPipePlanV21 =
- (ShowPipePlanV2) ConfigPhysicalPlan.Factory.create(showPipePlanV2.serializeToByteBuffer());
- Assert.assertEquals(showPipePlanV2, showPipePlanV21);
- }
-
@Test
public void RemoveDataNodePlanTest() throws IOException {
List<TDataNodeLocation> locations = new ArrayList<>();
@@ -1851,34 +1399,6 @@ public class ConfigPhysicalPlanSerDeTest {
Assert.assertEquals(plan0.getDataNodeLocation(), plan1.getDataNodeLocation());
}
- @Test
- public void GetTransferringTriggersPlanTest() throws IOException {
- GetTransferringTriggersPlan getTransferringTriggerPlan0 = new GetTransferringTriggersPlan();
- Assert.assertTrue(
- ConfigPhysicalPlan.Factory.create(getTransferringTriggerPlan0.serializeToByteBuffer())
- instanceof GetTransferringTriggersPlan);
- }
-
- @Test
- public void GetUDFTablePlanTest() throws IOException {
- GetFunctionTablePlan getUDFTablePlan0 = new GetFunctionTablePlan();
- Assert.assertTrue(
- ConfigPhysicalPlan.Factory.create(getUDFTablePlan0.serializeToByteBuffer())
- instanceof GetFunctionTablePlan);
- }
-
- @Test
- public void GetUDFJarPlanTest() throws IOException {
- List<String> jarNames = new ArrayList<>();
- jarNames.add("test1");
- jarNames.add("test2");
- GetUDFJarPlan getUDFJarPlan0 = new GetUDFJarPlan(jarNames);
-
- GetUDFJarPlan getUDFJarPlan1 =
- (GetUDFJarPlan) ConfigPhysicalPlan.Factory.create(getUDFJarPlan0.serializeToByteBuffer());
- Assert.assertEquals(getUDFJarPlan0.getJarNames(), getUDFJarPlan1.getJarNames());
- }
-
@Test
public void CreateFunctionPlanTest() throws IOException {
UDFInformation udfInformation =
diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/extractor/PipeConfigPhysicalPlanPatternParseVisitorTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/extractor/PipeConfigPhysicalPlanPatternParseVisitorTest.java
index 0f3ac282533..16bf1e344ff 100644
--- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/extractor/PipeConfigPhysicalPlanPatternParseVisitorTest.java
+++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/extractor/PipeConfigPhysicalPlanPatternParseVisitorTest.java
@@ -24,7 +24,7 @@ import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.commons.path.PathPatternTree;
import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePattern;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DeleteDatabasePlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java
index 12bab54572a..963808bf7cc 100644
--- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java
+++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java
@@ -29,7 +29,8 @@ import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.commons.utils.AuthUtils;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.read.auth.AuthorReadPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.response.auth.PermissionInfoResp;
import org.apache.iotdb.confignode.rpc.thrift.TCheckUserPrivilegesReq;
import org.apache.iotdb.confignode.rpc.thrift.TPermissionInfoResp;
@@ -106,6 +107,7 @@ public class AuthorInfoTest {
roleList.add("role1");
AuthorPlan authorPlan;
+ AuthorReadPlan authorReadPlan;
TCheckUserPrivilegesReq checkUserPrivilegesReq;
Set<Integer> privilegeList = new HashSet<>();
@@ -167,8 +169,8 @@ public class AuthorInfoTest {
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
// list user
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListUser,
"",
"",
@@ -177,7 +179,7 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- PermissionInfoResp permissionInfoResp = authorInfo.executeListUsers(authorPlan);
+ PermissionInfoResp permissionInfoResp = authorInfo.executeListUsers(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
userList.remove("user1");
@@ -215,8 +217,8 @@ public class AuthorInfoTest {
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
// list role
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListRole,
"",
"",
@@ -225,7 +227,7 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- permissionInfoResp = authorInfo.executeListRoles(authorPlan);
+ permissionInfoResp = authorInfo.executeListRoles(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
roleList.remove("role1");
@@ -343,8 +345,8 @@ public class AuthorInfoTest {
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
// list privileges user
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListUserPrivilege,
"user0",
"",
@@ -353,15 +355,15 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- permissionInfoResp = authorInfo.executeListUserPrivileges(authorPlan);
+ permissionInfoResp = authorInfo.executeListUserPrivileges(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
Assert.assertEquals(
authorInfo.getUserPermissionInfo("user0"), permissionInfoResp.getPermissionInfoResp());
// list privileges role
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListRolePrivilege,
"",
"role0",
@@ -370,13 +372,13 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- permissionInfoResp = authorInfo.executeListRolePrivileges(authorPlan);
+ permissionInfoResp = authorInfo.executeListRolePrivileges(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
// list all role of user
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListRole,
"user0",
"",
@@ -385,15 +387,15 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- permissionInfoResp = authorInfo.executeListRoles(authorPlan);
+ permissionInfoResp = authorInfo.executeListRoles(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
roleList.remove("role1");
Assert.assertEquals(roleList, permissionInfoResp.getMemberList());
// list all user of role
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListUser,
"",
"role0",
@@ -402,7 +404,7 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- permissionInfoResp = authorInfo.executeListUsers(authorPlan);
+ permissionInfoResp = authorInfo.executeListUsers(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
userList.remove("user1");
@@ -427,9 +429,12 @@ public class AuthorInfoTest {
private void cleanUserAndRole() throws TException, AuthException {
TSStatus status;
+ AuthorPlan authorPlan;
+ AuthorReadPlan authorReadPlan;
+
// clean user
- AuthorPlan authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListUser,
"",
"",
@@ -438,7 +443,7 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- PermissionInfoResp permissionInfoResp = authorInfo.executeListUsers(authorPlan);
+ PermissionInfoResp permissionInfoResp = authorInfo.executeListUsers(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
@@ -461,8 +466,8 @@ public class AuthorInfoTest {
}
// clean role
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListRole,
"",
"",
@@ -471,7 +476,7 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- permissionInfoResp = authorInfo.executeListRoles(authorPlan);
+ permissionInfoResp = authorInfo.executeListRoles(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
@@ -506,8 +511,8 @@ public class AuthorInfoTest {
status = authorInfo.authorNonQuery(createUserReq);
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
- AuthorPlan listUserPlan =
- new AuthorPlan(
+ AuthorReadPlan listUserPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListUser,
"",
"",
@@ -516,8 +521,8 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- AuthorPlan listRolePlan =
- new AuthorPlan(
+ AuthorReadPlan listRolePlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListRole,
"",
"",
@@ -540,6 +545,7 @@ public class AuthorInfoTest {
TSStatus status;
AuthorPlan authorPlan;
+ AuthorReadPlan authorReadPlan;
Set<Integer> privilegeList = new HashSet<>();
privilegeList.add(PrivilegeType.WRITE_DATA.ordinal());
@@ -636,8 +642,8 @@ public class AuthorInfoTest {
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
// list privileges user
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListUserPrivilege,
"user0",
"",
@@ -647,13 +653,13 @@ public class AuthorInfoTest {
false,
new ArrayList<>());
PermissionInfoResp permissionInfoResp;
- permissionInfoResp = authorInfo.executeListUserPrivileges(authorPlan);
+ permissionInfoResp = authorInfo.executeListUserPrivileges(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
// list privileges role
- authorPlan =
- new AuthorPlan(
+ authorReadPlan =
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListRolePrivilege,
"",
"role0",
@@ -662,7 +668,7 @@ public class AuthorInfoTest {
new HashSet<>(),
false,
new ArrayList<>());
- permissionInfoResp = authorInfo.executeListRolePrivileges(authorPlan);
+ permissionInfoResp = authorInfo.executeListRolePrivileges(authorReadPlan);
status = permissionInfoResp.getStatus();
Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
}
@@ -737,7 +743,7 @@ public class AuthorInfoTest {
3,
authorInfo
.executeListUsers(
- new AuthorPlan(
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListUser,
"",
"",
@@ -766,7 +772,7 @@ public class AuthorInfoTest {
2,
authorInfo
.executeListUsers(
- new AuthorPlan(
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListUserDep,
"",
"",
@@ -851,7 +857,7 @@ public class AuthorInfoTest {
1,
authorInfo
.executeListRoles(
- new AuthorPlan(
+ new AuthorReadPlan(
ConfigPhysicalPlanType.ListRoleDep,
"",
"",
diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java
index 09645a6dbe6..960233dbba7 100644
--- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java
+++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java
@@ -28,7 +28,7 @@ import org.apache.iotdb.commons.utils.AuthUtils;
import org.apache.iotdb.commons.utils.FileUtils;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
import org.apache.iotdb.confignode.consensus.request.write.template.CommitSetSchemaTemplatePlan;
diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/ConfigRegionListeningQueueTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/ConfigRegionListeningQueueTest.java
index 937c1a9e2dd..dec72d181f1 100644
--- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/ConfigRegionListeningQueueTest.java
+++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/ConfigRegionListeningQueueTest.java
@@ -22,7 +22,7 @@ package org.apache.iotdb.confignode.persistence;
import org.apache.iotdb.commons.auth.AuthException;
import org.apache.iotdb.commons.pipe.datastructure.queue.ConcurrentIterableLinkedQueue;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeEnrichedPlan;
import org.apache.iotdb.confignode.manager.pipe.agent.PipeConfigNodeAgent;
diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java
index ebccd9f36e2..da57c1fd2a5 100644
--- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java
+++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java
@@ -27,7 +27,7 @@ import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand;
import org.apache.iotdb.commons.trigger.TriggerInformation;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan;
import org.apache.iotdb.confignode.procedure.impl.schema.AlterLogicalViewProcedure;
import org.apache.iotdb.confignode.procedure.impl.schema.DeactivateTemplateProcedure;
diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedureTest.java
index 78a1758f8ae..6a4c818c14a 100644
--- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedureTest.java
+++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedureTest.java
@@ -25,7 +25,7 @@ import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TNodeResource;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
-import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan;
+import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
import org.apache.iotdb.confignode.procedure.store.ProcedureFactory;
import org.apache.tsfile.utils.PublicBAOS;
@@ -45,10 +45,10 @@ public class AuthOperationProcedureTest {
@Test
public void serializeDeserializeTest() throws IOException {
- PublicBAOS byteArrayOutputStream = new PublicBAOS();
- DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream);
+ final PublicBAOS byteArrayOutputStream = new PublicBAOS();
+ final DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream);
- TDataNodeLocation dataNodeLocation = new TDataNodeLocation();
+ final TDataNodeLocation dataNodeLocation = new TDataNodeLocation();
dataNodeLocation.setDataNodeId(1);
dataNodeLocation.setClientRpcEndPoint(new TEndPoint("0.0.0.0", 6667));
dataNodeLocation.setInternalEndPoint(new TEndPoint("0.0.0.0", 10730));
@@ -56,19 +56,18 @@ public class AuthOperationProcedureTest {
dataNodeLocation.setDataRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10760));
dataNodeLocation.setSchemaRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10750));
- TDataNodeConfiguration dataNodeConfiguration = new TDataNodeConfiguration();
+ final TDataNodeConfiguration dataNodeConfiguration = new TDataNodeConfiguration();
dataNodeConfiguration.setLocation(dataNodeLocation);
dataNodeConfiguration.setResource(new TNodeResource(16, 34359738368L));
- List<TDataNodeConfiguration> datanodes = new ArrayList<>();
+ final List<TDataNodeConfiguration> datanodes = new ArrayList<>();
datanodes.add(dataNodeConfiguration);
try {
- int begin = ConfigPhysicalPlanType.CreateUser.ordinal();
- int end = ConfigPhysicalPlanType.ListRoleUsers.ordinal();
+ final int begin = ConfigPhysicalPlanType.CreateUser.ordinal();
+ final int end = ConfigPhysicalPlanType.UpdateUser.ordinal();
for (int i = begin; i <= end; i++) {
- PartialPath path = new PartialPath(new String("root.t1"));
- AuthOperationProcedure proc =
+ final AuthOperationProcedure proc =
new AuthOperationProcedure(
new AuthorPlan(
ConfigPhysicalPlanType.values()[i],
@@ -78,20 +77,20 @@ public class AuthOperationProcedureTest {
"123456",
Collections.singleton(1),
false,
- Collections.singletonList(path)),
+ Collections.singletonList(new PartialPath("root.t1"))),
datanodes,
false);
proc.serialize(outputStream);
- ByteBuffer buffer =
+ final ByteBuffer buffer =
ByteBuffer.wrap(byteArrayOutputStream.getBuf(), 0, byteArrayOutputStream.size());
- AuthOperationProcedure proc2 =
+ final AuthOperationProcedure proc2 =
(AuthOperationProcedure) ProcedureFactory.getInstance().create(buffer);
- Assert.assertTrue(proc.equals(proc2));
+ Assert.assertEquals(proc, proc2);
buffer.clear();
byteArrayOutputStream.reset();
}
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
fail();
}