morningman commented on code in PR #34032:
URL: https://github.com/apache/doris/pull/34032#discussion_r1579367249


##########
be/src/common/config.cpp:
##########
@@ -241,6 +241,7 @@ DEFINE_Validator(doris_scanner_thread_pool_thread_num, 
[](const int config) -> b
     }
     return true;
 });
+DEFINE_Int32(remote_split_source_batch_size, "1024");

Review Comment:
   Rethink this default value. if it is too large, all ranges may be fetched by 
one instance, and other instances may have no range to run



##########
be/src/vec/exec/scan/split_source_connector.cpp:
##########
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/exec/scan/split_source_connector.h"
+
+#include "runtime/exec_env.h"
+#include "runtime/query_context.h"
+
+namespace doris::vectorized {
+
+using apache::thrift::transport::TTransportException;
+
+Status LocalSplitSourceConnector::get_next(bool* has_next, TFileRangeDesc* 
range) {
+    std::lock_guard<std::mutex> l(_range_lock);
+    *has_next = false;
+    if (_scan_index < _scan_ranges.size()) {
+        auto& ranges = 
_scan_ranges[_scan_index].scan_range.ext_scan_range.file_scan_range.ranges;
+        if (_range_index < ranges.size()) {
+            *has_next = true;
+            *range = ranges[_range_index++];
+            if (_range_index == ranges.size()) {
+                _scan_index++;
+                _range_index = 0;
+            }
+        }
+    }
+    return Status::OK();
+}
+
+Status RemoteSplitSourceConnector::get_next(bool* has_next, TFileRangeDesc* 
range) {
+    std::lock_guard<std::mutex> l(_range_lock);
+    *has_next = false;
+    if (_scan_index == _scan_ranges.size() && !_last_batch) {
+        Status coord_status;
+        FrontendServiceConnection 
coord(_state->exec_env()->frontend_client_cache(),
+                                        _state->get_query_ctx()->coord_addr, 
&coord_status);
+        RETURN_IF_ERROR(coord_status);
+        TFetchSplitBatchRequest request;
+        request.__set_split_source_id(_split_source_id);
+        request.__set_max_num_splits(config::remote_split_source_batch_size);
+        TFetchSplitBatchResult result;
+        try {
+            coord->fetchSplitBatch(result, request);
+        } catch (TTransportException& e1) {
+            LOG(WARNING) << "Failed to get batch of split source: {}, try to 
reopen" << e1.what();
+            RETURN_IF_ERROR(coord.reopen());
+            try {
+                coord->fetchSplitBatch(result, request);
+            } catch (TTransportException& e2) {
+                return Status::IOError("Failed to get batch of split source: 
{}", e2.what());
+            }
+        }
+        LOG(WARNING) << "Get batch of split source, id=" << _split_source_id

Review Comment:
   debug lvl



##########
fe/fe-common/src/main/java/org/apache/doris/common/Config.java:
##########
@@ -2246,6 +2246,11 @@ public class Config extends ConfigBase {
             "Default hive file format for creating table."})
     public static String hive_default_file_format = "orc";
 
+    @ConfField(mutable = true, masterOnly = false, description = {
+            "如果切片数量超过阈值,BE将通过batch方式获取scan ranges",
+            "If the number of splits exceeds the threshold, scan ranges will 
be got through batch mode."})
+    public static int num_splits_in_batch_mode = 4096;

Review Comment:
   Use a large default, how about 10000.
   And better change it to GloableVariable



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