danny0405 commented on a change in pull request #3338:
URL: https://github.com/apache/hudi/pull/3338#discussion_r676378207



##########
File path: 
hudi-flink/src/main/java/org/apache/hudi/sink/transform/RowDataToHoodieFunction.java
##########
@@ -89,11 +96,19 @@ public void open(Configuration parameters) throws Exception 
{
         HoodieAvroKeyGeneratorFactory
             
.createKeyGenerator(flinkConf2TypedProperties(FlinkOptions.flatOptions(this.config)));
     this.payloadCreation = PayloadCreation.instance(config);
+    long totalLimit = this.config.getLong(FlinkOptions.WRITE_RATE_LIMIT);
+    if (totalLimit > 0) {
+      this.rateLimiter = RateLimiter.create((double) totalLimit / 
getRuntimeContext().getNumberOfParallelSubtasks());
+    }
   }
 
   @SuppressWarnings("unchecked")
   @Override
   public O map(I i) throws Exception {
+    // If rateLimiter is enabled, forward flow control is performed on the 
data.
+    if (rateLimiter != null) {

Review comment:
       Or better, we can use a different `RowDataToHoodieFunction` impl when 
rate limi turns on.




-- 
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