Skip to content

Commit

Permalink
[BugFix] Acquire rowsets at querying (backport #13830)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiheLiu authored and wanpengfei-git committed Nov 25, 2022
1 parent b101696 commit 6c82c74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion be/src/exec/pipeline/olap_scan_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ Status OlapScanOperator::do_prepare(RuntimeState*) {
return Status::OK();
}

void OlapScanOperator::do_close(RuntimeState*) {}
void OlapScanOperator::do_close(RuntimeState*) {
for (const auto& rowsets_per_tablet : _tablet_rowsets) {
Rowset::release_readers(rowsets_per_tablet);
}
}

Status OlapScanOperator::_capture_tablet_rowsets() {
const auto& morsels = this->morsel_queue()->morsels();
Expand Down Expand Up @@ -74,6 +78,7 @@ Status OlapScanOperator::_capture_tablet_rowsets() {
{
std::shared_lock l(tablet->get_header_lock());
RETURN_IF_ERROR(tablet->capture_consistent_rowsets(Version(0, version), &_tablet_rowsets[i]));
Rowset::acquire_readers(_tablet_rowsets[i]);
}
}

Expand Down
5 changes: 5 additions & 0 deletions be/src/exec/vectorized/olap_scan_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ Status OlapScanNode::close(RuntimeState* state) {
release_large_columns<BinaryColumn>(runtime_state()->chunk_size() * 512);
}

for (const auto& rowsets_per_tablet : _tablet_rowsets) {
Rowset::release_readers(rowsets_per_tablet);
}

return ScanNode::close(state);
}

Expand Down Expand Up @@ -570,6 +574,7 @@ Status OlapScanNode::_capture_tablet_rowsets() {
{
std::shared_lock l(tablet->get_header_lock());
RETURN_IF_ERROR(tablet->capture_consistent_rowsets(Version(0, version), &_tablet_rowsets[i]));
Rowset::acquire_readers(_tablet_rowsets[i]);
}
}

Expand Down

0 comments on commit 6c82c74

Please sign in to comment.