MCPcopy Create free account
hub / github.com/apache/cloudberry / BackoffSweeperLoop

Function BackoffSweeperLoop

src/backend/postmaster/backoff.c:1219–1244  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

1217 * or not and re-calculates CPU usage among active backends.
1218 */
1219void
1220BackoffSweeperLoop(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.

Callers 1

BackoffSweeperMainFunction · 0.85

Calls 4

BackoffSweeperFunction · 0.85
WaitLatchFunction · 0.85
ResetLatchFunction · 0.85
proc_exitFunction · 0.85

Tested by

no test coverage detected