dataroaring commented on code in PR #56361:
URL: https://github.com/apache/doris/pull/56361#discussion_r2428538624


##########
be/src/vec/sink/writer/vtablet_writer.cpp:
##########
@@ -1468,6 +1468,26 @@ Status VTabletWriter::_init(RuntimeState* state, 
RuntimeProfile* profile) {
     _tablet_finder = std::make_unique<OlapTabletFinder>(_vpartition, 
find_tablet_mode);
     RETURN_IF_ERROR(_vpartition->init());
 
+    if (table_sink.partition.distributed_columns.empty()) {
+        int64_t threshold = 
(table_sink.__isset.random_tablet_switching_threshold &&
+                             table_sink.random_tablet_switching_threshold > 0)
+                                    ? 
table_sink.random_tablet_switching_threshold
+                                    : 
config::random_distribution_tablet_switching_threshold;
+
+        // Initialize each partition with a random starting tablet and local 
state
+        for (auto& partition : _vpartition->get_partitions()) {
+            const_cast<VOlapTablePartition*>(partition)->switching_threshold = 
threshold;

Review Comment:
   switching_threshold in tablet_finder is enough.
   load_tablet_idx should assigned from be to avoid imbalance of hash.
   current_tablet_rows can be set in constructor.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to