This is an automated email from the ASF dual-hosted git repository.
zyk 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 ca307b14ce [IOTDB-5685] Fix error msg of failing to create a
timeseries on an existing path when ReadOnly state (#9382)
ca307b14ce is described below
commit ca307b14cef12ea863a173f930818ee02c746865
Author: Marcos_Zyk <[email protected]>
AuthorDate: Mon Mar 20 18:44:37 2023 +0800
[IOTDB-5685] Fix error msg of failing to create a timeseries on an existing
path when ReadOnly state (#9382)
---
.../db/mpp/execution/executor/RegionWriteExecutor.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
index 69ca7a4f3b..1d4d1a7c1c 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
@@ -20,6 +20,7 @@
package org.apache.iotdb.db.mpp.execution.executor;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
+import org.apache.iotdb.commons.conf.CommonDescriptor;
import org.apache.iotdb.commons.consensus.ConsensusGroupId;
import org.apache.iotdb.commons.consensus.DataRegionId;
import org.apache.iotdb.commons.consensus.SchemaRegionId;
@@ -147,6 +148,16 @@ public class RegionWriteExecutor {
public RegionExecutionResult visitPlan(PlanNode node,
WritePlanNodeExecutionContext context) {
RegionExecutionResult response = new RegionExecutionResult();
+ if (CommonDescriptor.getInstance().getConfig().isReadOnly()) {
+ response.setAccepted(false);
+ response.setMessage("Fail to do non-query operations because system is
read-only.");
+ response.setStatus(
+ RpcUtils.getStatus(
+ TSStatusCode.SYSTEM_READ_ONLY,
+ "Fail to do non-query operations because system is
read-only."));
+ return response;
+ }
+
ConsensusWriteResponse writeResponse =
executePlanNodeInConsensusLayer(context.getRegionId(), node);
// TODO need consider more status
@@ -161,7 +172,9 @@ public class RegionWriteExecutor {
writeResponse.getException());
response.setAccepted(false);
response.setMessage(writeResponse.getException().toString());
-
response.setStatus(RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR));
+ response.setStatus(
+ RpcUtils.getStatus(
+ TSStatusCode.EXECUTE_STATEMENT_ERROR,
writeResponse.getErrorMessage()));
}
return response;
}