Fixing bug: PX hangs due to calling get_next_batch after coordinater being drained.

This commit is contained in:
obdev
2023-11-28 12:47:30 +00:00
committed by ob-robot
parent df4375fa1b
commit 511eb3f076
4 changed files with 75 additions and 1 deletions

View File

@ -886,6 +886,9 @@ int ObOperator::inner_rescan()
if (br_it_) {
br_it_->rescan();
}
// If an operator rescan after drained, the exch_drained_ must be reset
// so it can be drained again.
exch_drained_ = false;
batch_reach_end_ = false;
row_reach_end_ = false;
clear_batch_end_flag();
@ -1445,6 +1448,14 @@ int ObOperator::do_drain_exch()
} else if (!exch_drained_) {
int tmp_ret = inner_drain_exch();
exch_drained_ = true;
// If an operator is drained, it means that the parent operator will never call its
// get_next_batch function again theoretically. However, we cannot guarantee that there won't be
// any bugs that call get_next_batch again after drain. To prevent this situation, we set the
// all iter end flags here.
// For specific case, refer to issue:
brs_.end_ = true;
batch_reach_end_ = true;
row_reach_end_ = true;
if (!spec_.is_receive()) {
for (int64_t i = 0; i < child_cnt_ && OB_SUCC(ret); i++) {
if (OB_ISNULL(children_[i])) {

View File

@ -1169,7 +1169,10 @@ int ObSubPlanFilterOp::inner_get_next_batch(const int64_t max_row_cnt)
int ret = OB_SUCCESS;
int64_t op_max_batch_size = min(max_row_cnt, MY_SPEC.max_batch_size_);
int64_t params_size = 0;
if (need_init_before_get_row_) {
if (iter_end_) {
brs_.size_ = 0;
brs_.end_ = true;
} else if (need_init_before_get_row_) {
OZ(prepare_onetime_exprs());
}
//从主表中获取一行数据