Caideyipi commented on code in PR #12543:
URL: https://github.com/apache/iotdb/pull/12543#discussion_r1613457872


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/thrift/sync/IoTDBDataRegionSyncConnector.java:
##########
@@ -176,10 +178,13 @@ private void doTransfer(Pair<TEndPoint, PipeEventBatch> 
endPointAndBatch) {
 
     final TPipeTransferResp resp;
     try {
-      resp =
-          clientAndStatus
-              .getLeft()
-              
.pipeTransfer(compressIfNeeded(batchToTransfer.toTPipeTransferReq()));
+      final TPipeTransferReq req = 
compressIfNeeded(batchToTransfer.toTPipeTransferReq());
+      for (final Map.Entry<String, Long> entry :
+          batchToTransfer.getPipeName2BytesAccumulated().entrySet()) {
+        rateLimitIfNeeded(

Review Comment:
   Should be divided by the compression ratio if compressed.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/thrift/async/handler/PipeTransferTabletBatchEventHandler.java:
##########
@@ -60,16 +63,22 @@ public PipeTransferTabletBatchEventHandler(
     // Deep copy to keep Ids' and events' reference
     requestCommitIds = batch.deepCopyRequestCommitIds();
     events = batch.deepCopyEvents();
+    pipeName2BytesAccumulated = batch.deepCopyPipeName2BytesAccumulated();
+
     req =
         connector.isRpcCompressionEnabled()
-            ? batch.toTPipeTransferReq()
-            : PipeTransferCompressedReq.toTPipeTransferReq(
-                batch.toTPipeTransferReq(), connector.getCompressors());
+            ? PipeTransferCompressedReq.toTPipeTransferReq(
+                batch.toTPipeTransferReq(), connector.getCompressors())
+            : batch.toTPipeTransferReq();
 
     this.connector = connector;
   }
 
   public void transfer(final AsyncPipeDataTransferServiceClient client) throws 
TException {
+    for (final Map.Entry<String, Long> entry : 
pipeName2BytesAccumulated.entrySet()) {
+      connector.rateLimitIfNeeded(entry.getKey(), client.getEndPoint(), 
entry.getValue());

Review Comment:
   Should be divided by the compression ratio if compressed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to