| 1117 | } |
| 1118 | |
| 1119 | void Operator::MemoryReclaimer::enterArbitration() { |
| 1120 | DriverThreadContext* driverThreadCtx = driverThreadContext(); |
| 1121 | if (FOLLY_UNLIKELY(driverThreadCtx == nullptr)) { |
| 1122 | // Skips the driver suspension handling if this memory arbitration request |
| 1123 | // is not issued from a driver thread. For example, async streaming shuffle |
| 1124 | // and table scan prefetch execution path might initiate memory arbitration |
| 1125 | // request from non-driver thread. |
| 1126 | return; |
| 1127 | } |
| 1128 | |
| 1129 | Driver* const runningDriver = driverThreadCtx->driverCtx()->driver; |
| 1130 | if (!FLAGS_bolt_memory_pool_capacity_transfer_across_tasks) { |
| 1131 | if (auto opDriver = ensureDriver()) { |
| 1132 | // NOTE: the current running driver might not be the driver of the |
| 1133 | // operator that requests memory arbitration. The reason is that an |
| 1134 | // operator might extend the buffer allocated from the other operator |
| 1135 | // either from the same or different drivers. But they must be from the |
| 1136 | // same task. |
| 1137 | BOLT_CHECK_EQ( |
| 1138 | runningDriver->task()->taskId(), |
| 1139 | opDriver->task()->taskId(), |
| 1140 | "The current running driver and the request driver must be from the same task"); |
| 1141 | } |
| 1142 | } |
| 1143 | if (runningDriver->task()->enterSuspended(runningDriver->state()) != |
| 1144 | StopReason::kNone) { |
| 1145 | // There is no need for arbitration if the associated task has already |
| 1146 | // terminated. |
| 1147 | BOLT_FAIL("Terminate detected when entering suspension"); |
| 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | void Operator::MemoryReclaimer::leaveArbitration() noexcept { |
| 1152 | DriverThreadContext* driverThreadCtx = driverThreadContext(); |
nothing calls this directly
no test coverage detected