Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](scanner) fix shared rowset reader in different scanners #47744

Merged
merged 3 commits into from
Feb 13, 2025
Merged
Changes from 2 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
8 changes: 7 additions & 1 deletion be/src/pipeline/exec/olap_scan_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ Status OlapScanLocalState::_init_scanners(std::list<vectorized::VScannerSPtr>* s
std::max(1, (int)ranges->size() /
std::min(scanners_per_tablet, size_based_scanners_per_tablet));
int64_t num_ranges = ranges->size();
std::vector<RowSetSplits> splits = _read_sources[scan_range_idx].rs_splits;
HappenLee marked this conversation as resolved.
Show resolved Hide resolved
for (int64_t i = 0; i < num_ranges;) {
std::vector<doris::OlapScanRange*> scanner_ranges;
scanner_ranges.push_back((*ranges)[i].get());
Expand All @@ -383,6 +384,11 @@ Status OlapScanLocalState::_init_scanners(std::list<vectorized::VScannerSPtr>* s
}

COUNTER_UPDATE(_key_range_counter, scanner_ranges.size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment and better be

for (auto& rs : _read_sources[scan_range_idx].rs_splits) { for ( auto& split : splits) { split.rs_reader = split.rs_reader->clone(); } }

here no need vector copy

_read_sources[scan_range_idx].rs_splits.clear();
for (auto& split : splits) {
_read_sources[scan_range_idx].rs_splits.emplace_back(
RowSetSplits(split.rs_reader->clone()));
}
auto scanner = vectorized::NewOlapScanner::create_shared(
this, vectorized::NewOlapScanner::Params {
state(),
Expand Down Expand Up @@ -452,7 +458,7 @@ Status OlapScanLocalState::hold_tablets() {
}
timer.stop();
double cost_secs = static_cast<double>(timer.elapsed_time()) / NANOS_PER_SEC;
if (cost_secs > 5) {
if (cost_secs > 1) {
LOG_WARNING(
"Try to hold tablets costs {} seconds, it costs too much. (Query-ID={}, NodeId={}, "
"ScanRangeNum={})",
Expand Down
Loading