[fix](audit) Fix the error of peakMemoryBytes in the audit log (#20449)
This commit is contained in:
@ -93,8 +93,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: The value of query peak mem usage in fe.audit.log comes from a random BE,
|
||||
// not the BE with the largest peak mem usage
|
||||
void update_max_peak_memory_bytes() {
|
||||
if (_query_statistics != nullptr) {
|
||||
int64_t max_peak_memory_bytes = _query_statistics->calculate_max_peak_memory_bytes();
|
||||
|
||||
@ -390,7 +390,7 @@ void PlanFragmentExecutor::_collect_node_statistics() {
|
||||
DCHECK(_runtime_state->backend_id() != -1);
|
||||
NodeStatistics* node_statistics =
|
||||
_query_statistics->add_nodes_statistics(_runtime_state->backend_id());
|
||||
node_statistics->add_peak_memory(_runtime_state->query_mem_tracker()->peak_consumption());
|
||||
node_statistics->set_peak_memory(_runtime_state->query_mem_tracker()->peak_consumption());
|
||||
}
|
||||
|
||||
void PlanFragmentExecutor::report_profile() {
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
namespace doris {
|
||||
|
||||
void NodeStatistics::merge(const NodeStatistics& other) {
|
||||
peak_memory_bytes += other.peak_memory_bytes;
|
||||
peak_memory_bytes = std::max(other.peak_memory_bytes, peak_memory_bytes);
|
||||
}
|
||||
|
||||
void NodeStatistics::to_pb(PNodeStatistics* node_statistics) {
|
||||
@ -72,13 +72,13 @@ void QueryStatistics::from_pb(const PQueryStatistics& statistics) {
|
||||
}
|
||||
|
||||
int64_t QueryStatistics::calculate_max_peak_memory_bytes() {
|
||||
int64_t max_peak_memory_bytes = 0;
|
||||
int64_t max_peak_memory = 0;
|
||||
for (auto iter = _nodes_statistics_map.begin(); iter != _nodes_statistics_map.end(); ++iter) {
|
||||
if (max_peak_memory_bytes < iter->second->peak_memory_bytes) {
|
||||
max_peak_memory_bytes = iter->second->peak_memory_bytes;
|
||||
if (max_peak_memory < iter->second->peak_memory_bytes) {
|
||||
max_peak_memory = iter->second->peak_memory_bytes;
|
||||
}
|
||||
}
|
||||
return max_peak_memory_bytes;
|
||||
return max_peak_memory;
|
||||
}
|
||||
|
||||
void QueryStatistics::merge(QueryStatisticsRecvr* recvr) {
|
||||
|
||||
@ -36,7 +36,9 @@ class NodeStatistics {
|
||||
public:
|
||||
NodeStatistics() : peak_memory_bytes(0) {}
|
||||
|
||||
void add_peak_memory(int64_t peak_memory) { this->peak_memory_bytes += peak_memory; }
|
||||
void set_peak_memory(int64_t peak_memory) {
|
||||
this->peak_memory_bytes = std::max(this->peak_memory_bytes, peak_memory);
|
||||
}
|
||||
|
||||
void merge(const NodeStatistics& other);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user