dataroaring commented on code in PR #56361:
URL: https://github.com/apache/doris/pull/56361#discussion_r2428546340
##########
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:
If advice above is not applicable, we should put these code in below
function in tablet_info.cpp to put preparing together.
`Status VOlapTablePartitionParam::generate_partition_from(const
TOlapTablePartition& t_part,
VOlapTablePartition*& part_result) {
DCHECK(part_result == nullptr);
// here we set the default value of partition bounds first! if it
doesn't have some key, it will be -1.
part_result = _obj_pool.add(new VOlapTablePartition(&_partition_block));
part_result->id = t_part.id;
part_result->is_mutable = t_part.is_mutable;
// only load_to_single_tablet = true will set load_tablet_idx
if (t_part.__isset.load_tablet_idx) {
part_result->load_tablet_idx = t_part.load_tablet_idx;
}`
--
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]