MCPcopy Create free account
hub / github.com/documentdb/documentdb / IsTaskTimeBudgetExceeded

Function IsTaskTimeBudgetExceeded

pg_documentdb/src/ttl/ttl_index.c:575–596  ·  view source on GitHub ↗

Based on the task start time it checks if we have exceeded the ttl task budget defined in * the SingleTTLTaskTimeBudget GUC. */

Source from the content-addressed store, hash-verified

573/* Based on the task start time it checks if we have exceeded the ttl task budget defined in
574 * the SingleTTLTaskTimeBudget GUC. */
575static bool
576IsTaskTimeBudgetExceeded(instr_time startTime, double *elapsedTime, int budget)
577{
578 instr_time current;
579 INSTR_TIME_SET_CURRENT(current);
580 INSTR_TIME_SUBTRACT(current, startTime);
581 double elapsed = INSTR_TIME_GET_MILLISEC(current);
582
583 if (elapsedTime != NULL)
584 {
585 *elapsedTime = elapsed;
586 }
587
588 if (elapsed > (double) budget)
589 {
590 ereport(LOG, errmsg("TTL Index delete rows exceeded time budget: %dms.",
591 budget));
592 return true;
593 }
594
595 return false;
596}
597
598
599/* Deletes the rows that have expired for the given table name and ttl entry information.

Callers 2

delete_expired_rowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected