Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktengg committed Jan 14, 2025
1 parent 2cd951f commit ee9ecf3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
5 changes: 3 additions & 2 deletions be/src/pipeline/pipeline_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ Status PipelineTask::execute(bool* eos) {
const auto reserve_size = _root->get_reserve_mem_size(_state);
_root->reset_reserve_mem_size(_state);

if (workload_group && _state->enable_reserve_memory() && reserve_size > 0) {
if (workload_group && _state->get_query_ctx()->enable_reserve_memory() &&
reserve_size > 0) {
auto st = thread_context()->try_reserve_memory(reserve_size);

COUNTER_UPDATE(_memory_reserve_times, 1);
Expand Down Expand Up @@ -445,7 +446,7 @@ Status PipelineTask::execute(bool* eos) {
DEFER_RELEASE_RESERVED();
COUNTER_UPDATE(_memory_reserve_times, 1);
auto workload_group = _state->get_query_ctx()->workload_group();
if (_state->enable_reserve_memory() && workload_group &&
if (_state->get_query_ctx()->enable_reserve_memory() && workload_group &&
!(wake_up_early() || _dry_run)) {
const auto sink_reserve_size = _sink->get_reserve_mem_size(_state, *eos);
status = sink_reserve_size != 0
Expand Down
5 changes: 4 additions & 1 deletion be/src/runtime/query_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ class QueryContext : public std::enable_shared_from_this<QueryContext> {

void disable_reserve_memory() { _enable_reserve_memory = false; }

bool enable_reserve_memory() { return _enable_reserve_memory; }
bool enable_reserve_memory() const {
return _query_options.__isset.enable_reserve_memory &&
_query_options.enable_reserve_memory && _enable_reserve_memory;
}

void update_paused_reason(const Status& st) {
std::lock_guard l(_paused_mutex);
Expand Down
5 changes: 0 additions & 5 deletions be/src/runtime/runtime_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,4 @@ std::vector<std::shared_ptr<RuntimeProfile>> RuntimeState::build_pipeline_profil
}
return _pipeline_id_to_profile;
}

bool RuntimeState::enable_reserve_memory() const {
return _query_options.__isset.enable_reserve_memory && _query_options.enable_reserve_memory &&
_query_ctx->enable_reserve_memory();
}
} // end namespace doris
2 changes: 0 additions & 2 deletions be/src/runtime/runtime_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,6 @@ class RuntimeState {
return _query_options.__isset.enable_force_spill && _query_options.enable_force_spill;
}

bool enable_reserve_memory() const;

int64_t spill_min_revocable_mem() const {
if (_query_options.__isset.min_revocable_mem) {
return std::max(_query_options.min_revocable_mem, (int64_t)1);
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exec/scan/scanner_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
if (first_read) {
free_block = ctx->get_free_block(first_read);
} else {
if (state->enable_reserve_memory()) {
if (state->get_query_ctx()->enable_reserve_memory()) {
size_t block_avg_bytes = scanner->get_block_avg_bytes();
auto st = thread_context()->try_reserve_memory(block_avg_bytes);
if (!st.ok()) {
Expand Down

0 comments on commit ee9ecf3

Please sign in to comment.