| 205 | } |
| 206 | |
| 207 | uint64_t HashJoinMemoryReclaimer::reclaim( |
| 208 | memory::MemoryPool* pool, |
| 209 | uint64_t targetBytes, |
| 210 | uint64_t maxWaitMs, |
| 211 | memory::MemoryReclaimer::Stats& stats) { |
| 212 | uint64_t reclaimedBytes{0}; |
| 213 | pool->visitChildren([&](memory::MemoryPool* child) { |
| 214 | BOLT_CHECK_EQ(child->kind(), memory::MemoryPool::Kind::kLeaf); |
| 215 | // The hash probe operator do not support memory reclaim. |
| 216 | if (!isHashBuildMemoryPool(*child)) { |
| 217 | return true; |
| 218 | } |
| 219 | // We only need to reclaim from any one of the hash build operators |
| 220 | // which will reclaim from all the peer hash build operators. |
| 221 | reclaimedBytes = child->reclaim(targetBytes, maxWaitMs, stats); |
| 222 | return false; |
| 223 | }); |
| 224 | return reclaimedBytes; |
| 225 | } |
| 226 | |
| 227 | bool isHashBuildMemoryPool(const memory::MemoryPool& pool) { |
| 228 | return folly::StringPiece(pool.name()).endsWith("HashBuild"); |
nothing calls this directly
no test coverage detected