gavinchou commented on code in PR #34354:
URL: https://github.com/apache/doris/pull/34354#discussion_r1595750923


##########
be/src/io/fs/hdfs_file_writer.cpp:
##########
@@ -44,7 +48,112 @@ bvar::Adder<uint64_t> 
hdfs_bytes_written_total("hdfs_file_writer_bytes_written")
 bvar::Adder<uint64_t> hdfs_file_created_total("hdfs_file_writer_file_created");
 bvar::Adder<uint64_t> 
hdfs_file_being_written("hdfs_file_writer_file_being_written");
 
+class HdfsMaxConnectionLimiter {
+public:
+    HdfsMaxConnectionLimiter() = default;
+    ~HdfsMaxConnectionLimiter() = default;
+
+    Status add_inflight_writer() {
+        int retry = config::hdfs_jni_write_max_retry_time;
+        std::unique_lock lck {_latch};
+        while (!_cv.wait_for(
+                lck, 
std::chrono::milliseconds(config::hdfs_jni_write_sleep_milliseconds), [&]() {
+                    return _cur_inflight_writer < 
config::max_inflight_hdfs_write_connection;
+                })) {
+            if (retry > 0) {
+                retry--;
+                continue;
+            }
+        }

Review Comment:
   LOG if no available connections



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to