* Main loop of the sweeper process. It wakes up once in a while, marks backends as active * or not and re-calculates CPU usage among active backends. */
| 1217 | * or not and re-calculates CPU usage among active backends. |
| 1218 | */ |
| 1219 | void |
| 1220 | BackoffSweeperLoop(void) |
| 1221 | { |
| 1222 | for (;;) |
| 1223 | { |
| 1224 | int rc; |
| 1225 | |
| 1226 | if (gp_enable_resqueue_priority) |
| 1227 | BackoffSweeper(); |
| 1228 | |
| 1229 | Assert(gp_resqueue_priority_sweeper_interval > 0.0); |
| 1230 | |
| 1231 | /* Sleep a while. */ |
| 1232 | rc = WaitLatch(&MyProc->procLatch, |
| 1233 | WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, |
| 1234 | gp_resqueue_priority_sweeper_interval, |
| 1235 | WAIT_EVENT_BACKOFF_MAIN); |
| 1236 | ResetLatch(&MyProc->procLatch); |
| 1237 | |
| 1238 | /* emergency bailout if postmaster has died */ |
| 1239 | if (rc & WL_POSTMASTER_DEATH) |
| 1240 | proc_exit(1); |
| 1241 | } /* end server loop */ |
| 1242 | |
| 1243 | return; |
| 1244 | } |
| 1245 | |
| 1246 | /** |
| 1247 | * Set returning function to inspect current state of query prioritization. |
no test coverage detected