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 2023/03/26 06:50:21 UTC

[iotdb] branch master updated: [IOTDB-5729] Fix RatisConsensus ResponseMessage conversion error (#9452)

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 f7e825bcca [IOTDB-5729] Fix RatisConsensus ResponseMessage conversion error  (#9452)
f7e825bcca is described below

commit f7e825bcca968063937411f1ac19c7256b5610b4
Author: William Song <48...@users.noreply.github.com>
AuthorDate: Sun Mar 26 14:50:11 2023 +0800

    [IOTDB-5729] Fix RatisConsensus ResponseMessage conversion error  (#9452)
---
 .../apache/iotdb/consensus/ratis/ApplicationStateMachineProxy.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/consensus/src/main/java/org/apache/iotdb/consensus/ratis/ApplicationStateMachineProxy.java b/consensus/src/main/java/org/apache/iotdb/consensus/ratis/ApplicationStateMachineProxy.java
index 80f11ac05e..44516072c2 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/ratis/ApplicationStateMachineProxy.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/ratis/ApplicationStateMachineProxy.java
@@ -26,6 +26,7 @@ import org.apache.iotdb.consensus.common.DataSet;
 import org.apache.iotdb.consensus.common.request.ByteBufferConsensusRequest;
 import org.apache.iotdb.consensus.common.request.IConsensusRequest;
 import org.apache.iotdb.consensus.ratis.metrics.RatisMetricsManager;
+import org.apache.iotdb.rpc.TSStatusCode;
 
 import org.apache.ratis.proto.RaftProtos;
 import org.apache.ratis.proto.RaftProtos.RaftConfigurationProto;
@@ -163,7 +164,10 @@ public class ApplicationStateMachineProxy extends BaseStateMachine {
         Thread.currentThread().interrupt();
       } catch (Throwable rte) {
         logger.error("application statemachine throws a runtime exception: ", rte);
-        ret = Message.valueOf("internal error. statemachine throws a runtime exception: " + rte);
+        ret =
+            new ResponseMessage(
+                new TSStatus(TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode())
+                    .setMessage("internal error. statemachine throws a runtime exception: " + rte));
         if (applicationStateMachine.isReadOnly()) {
           waitUntilSystemNotReadOnly();
           shouldRetry = true;