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/09/15 05:25:49 UTC

[iotdb] branch jira6156 created (now 55cad7b9116)

This is an automated email from the ASF dual-hosted git repository.

tanxinyu pushed a change to branch jira6156
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 55cad7b9116 fix

This branch includes the following new commits:

     new 55cad7b9116 fix

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: fix

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tanxinyu pushed a commit to branch jira6156
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 55cad7b91164e4e3aa128961976aa2d03044d2b2
Author: OneSizeFitQuorum <ta...@apache.org>
AuthorDate: Fri Sep 15 13:25:22 2023 +0800

    fix
    
    Signed-off-by: OneSizeFitQuorum <ta...@apache.org>
---
 .../org/apache/iotdb/rpc/RpcTransportFactory.java  | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/RpcTransportFactory.java b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/RpcTransportFactory.java
index d6d8ef2cb69..c7aeef8ec36 100644
--- a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/RpcTransportFactory.java
+++ b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/RpcTransportFactory.java
@@ -19,6 +19,7 @@
 
 package org.apache.iotdb.rpc;
 
+import org.apache.thrift.transport.TMemoryInputTransport;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
@@ -46,9 +47,33 @@ public class RpcTransportFactory extends TTransportFactory {
 
   @Override
   public TTransport getTransport(TTransport trans) throws TTransportException {
+    updateConfigurationForAsyncServerIfNecessary(trans);
     return inner.getTransport(trans);
   }
 
+  /**
+   * The Thrift AsyncServer uses TMemoryInputTransport (<a
+   * href="https://github.com/apache/thrift/blob/master/lib/java/src/main/java/org/apache/thrift/server/AbstractNonblockingServer.java#L291">...</a>),
+   * which employs the default configuration and performs size checks during the read and write
+   * processes. This behavior is not in line with our expectations of manually adjusting certain
+   * parameters. Therefore, special handling is required for it in this function.
+   *
+   * @param trans TTransport
+   */
+  private void updateConfigurationForAsyncServerIfNecessary(TTransport trans) {
+    if (trans instanceof TMemoryInputTransport) {
+      trans
+          .getConfiguration()
+          .setRecursionLimit(TConfigurationConst.defaultTConfiguration.getRecursionLimit());
+      trans
+          .getConfiguration()
+          .setMaxMessageSize(TConfigurationConst.defaultTConfiguration.getMaxMessageSize());
+      trans
+          .getConfiguration()
+          .setMaxFrameSize(TConfigurationConst.defaultTConfiguration.getMaxFrameSize());
+    }
+  }
+
   public TTransport getTransportWithNoTimeout(String ip, int port) throws TTransportException {
     return inner.getTransport(new TSocket(TConfigurationConst.defaultTConfiguration, ip, port));
   }