Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions be/src/runtime/routine_load/data_consumer_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ Status DataConsumerPool::get_consumer(
std::unique_lock<std::mutex> l(_lock);

// check if there is an available consumer.
// if has, return it
for (auto& c : _pool) {
if (c->match(ctx)) {
VLOG(3) << "get an available data consumer from pool: " << c->id();
c->reset();
*ret = c;
// if has, return it, also remove it from the pool
auto iter = std::begin(_pool);
while (iter != std::end(_pool)) {
if ((*iter)->match(ctx)) {
VLOG(3) << "get an available data consumer from pool: " << (*iter)->id();
(*iter)->reset();
*ret = *iter;
iter = _pool.erase(iter);
return Status::OK;
} else {
++iter;
}
}

Expand Down
2 changes: 1 addition & 1 deletion be/test/runtime/routine_load_task_executor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ TEST_F(RoutineLoadTaskExecutorTest, exec_task) {
ASSERT_TRUE(st.ok());

sleep(10);
k_info.brokers = "127.0.0.2:9092";
k_info.brokers = "127.0.0.1:9092";
task.__set_kafka_load_info(k_info);
st = executor.submit_task(task);
ASSERT_TRUE(st.ok());
Expand Down