| 2596 | } |
| 2597 | |
| 2598 | void AdmissionController::PoolStats::UpdateMemTrackerStats() { |
| 2599 | // May be NULL if no queries have ever executed in this pool on this node but another |
| 2600 | // node sent stats for this pool. |
| 2601 | MemTracker* tracker = |
| 2602 | parent_->pool_mem_trackers_->GetRequestPoolMemTracker(name_, false); |
| 2603 | |
| 2604 | if (tracker) { |
| 2605 | // Update local_stats_ with the query Ids of the top 5 queries, plus the min, the max, |
| 2606 | // the total memory consumption, and the number of all queries running on this |
| 2607 | // host tracked by this pool. |
| 2608 | tracker->UpdatePoolStatsForQueries(5 /*limit*/, this->local_stats_); |
| 2609 | } |
| 2610 | |
| 2611 | const int64_t current_reserved = |
| 2612 | tracker == nullptr ? static_cast<int64_t>(0) : tracker->GetPoolMemReserved(); |
| 2613 | if (current_reserved != local_stats_.backend_mem_reserved) { |
| 2614 | parent_->pools_for_updates_.insert(name_); |
| 2615 | local_stats_.backend_mem_reserved = current_reserved; |
| 2616 | metrics_.local_backend_mem_reserved->SetValue(current_reserved); |
| 2617 | } |
| 2618 | |
| 2619 | const int64_t current_usage = |
| 2620 | tracker == nullptr ? static_cast<int64_t>(0) : tracker->consumption(); |
| 2621 | metrics_.local_backend_mem_usage->SetValue(current_usage); |
| 2622 | } |
| 2623 | |
| 2624 | void AdmissionController::AddPoolAndPerHostStatsUpdates( |
| 2625 | vector<TTopicDelta>* topic_updates) { |