vagetablechicken commented on a change in pull request #3143: Non blocking
OlapTableSink
URL: https://github.com/apache/incubator-doris/pull/3143#discussion_r395959565
##########
File path: be/src/exec/tablet_sink.cpp
##########
@@ -877,5 +920,24 @@ int OlapTableSink::_validate_data(RuntimeState* state,
RowBatch* batch, Bitmap*
return filtered_rows;
}
+void OlapTableSink::_send_batch_process() {
+ SCOPED_RAW_TIMER(&_non_blocking_send_ns);
+ while (true) {
+ int running_channels_num = 0;
+ for (auto index_channel : _channels) {
+ index_channel->for_each_node_channel([&](NodeChannel* ch) {
+ running_channels_num += ch->try_send_and_fetch_status();
+ });
+ }
+
+ if (running_channels_num == 0) {
+ LOG(INFO) << "all node channels are stopped(maybe
finished/offending/cancelled), "
+ "consumer thread exit.";
+ return;
+ }
+ std::this_thread::yield();
Review comment:
Yes, it's the easiest to implement, but not good enough. I've consider about
writing an algorithm that can choose the property sleep interval, e.g. if every
channel is empty, we can sleep for a while. bla bla bla
But taking the trouble to do this may lead to small gains.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]