You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/12/07 12:22:02 UTC

[iotdb] branch master updated: fix bug that when rpc compression = true, sync client does not use compression mode. (#2197)

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

qiaojialin 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 aea5a8d  fix bug that when rpc compression = true, sync client does not use compression mode. (#2197)
aea5a8d is described below

commit aea5a8dcbfbd7129e70d6221d430d706ebb924cd
Author: Xiangdong Huang <hx...@apache.org>
AuthorDate: Mon Dec 7 20:21:49 2020 +0800

    fix bug that when rpc compression = true, sync client does not use compression mode. (#2197)
---
 .../java/org/apache/iotdb/db/sync/sender/transfer/SyncClient.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/sync/sender/transfer/SyncClient.java b/server/src/main/java/org/apache/iotdb/db/sync/sender/transfer/SyncClient.java
index a0e16ff..b07b2d4 100644
--- a/server/src/main/java/org/apache/iotdb/db/sync/sender/transfer/SyncClient.java
+++ b/server/src/main/java/org/apache/iotdb/db/sync/sender/transfer/SyncClient.java
@@ -74,6 +74,7 @@ import org.apache.iotdb.service.sync.thrift.SyncStatus;
 import org.apache.iotdb.tsfile.utils.BytesUtils;
 import org.apache.thrift.TException;
 import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TCompactProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TFastFramedTransport;
 import org.apache.thrift.transport.TSocket;
@@ -274,7 +275,12 @@ public class SyncClient implements ISyncClient {
   @Override
   public void establishConnection(String serverIp, int serverPort) throws SyncConnectionException {
     transport = new TFastFramedTransport(new TSocket(serverIp, serverPort, TIMEOUT_MS));
-    TProtocol protocol = new TBinaryProtocol(transport);
+    TProtocol protocol = null;
+    if (IoTDBDescriptor.getInstance().getConfig().isRpcThriftCompressionEnable()) {
+      protocol = new TBinaryProtocol(transport);
+    } else {
+      protocol = new TCompactProtocol(transport);
+    }
     serviceClient = new SyncService.Client(protocol);
     try {
       if (!transport.isOpen()) {