<entry>Waiting in an extension.</entry>
</row>
<row>
- <entry morerows="34"><literal>IPC</literal></entry>
+ <entry morerows="36"><literal>IPC</literal></entry>
<entry><literal>BgWorkerShutdown</literal></entry>
<entry>Waiting for background worker to shut down.</entry>
</row>
<entry><literal>BtreePage</literal></entry>
<entry>Waiting for the page number needed to continue a parallel B-tree scan to become available.</entry>
</row>
+ <row>
+ <entry><literal>CheckpointDone</literal></entry>
+ <entry>Waiting for a checkpoint to complete.</entry>
+ </row>
+ <row>
+ <entry><literal>CheckpointStart</literal></entry>
+ <entry>Waiting for a checkpoint to start.</entry>
+ </row>
<row>
<entry><literal>ClogGroupUpdate</literal></entry>
<entry>Waiting for group leader to update transaction status at transaction end.</entry>
int ckpt_flags; /* checkpoint flags, as defined in xlog.h */
+ ConditionVariable start_cv; /* signaled when ckpt_started advances */
+ ConditionVariable done_cv; /* signaled when ckpt_done advances */
+
uint32 num_backend_writes; /* counts user backend buffer writes */
uint32 num_backend_fsync; /* counts user backend fsync calls */
CheckpointerShmem->ckpt_started++;
SpinLockRelease(&CheckpointerShmem->ckpt_lck);
+ ConditionVariableBroadcast(&CheckpointerShmem->start_cv);
+
/*
* The end-of-recovery checkpoint is a real checkpoint that's
* performed while we're still in recovery.
CheckpointerShmem->ckpt_done = CheckpointerShmem->ckpt_started;
SpinLockRelease(&CheckpointerShmem->ckpt_lck);
+ ConditionVariableBroadcast(&CheckpointerShmem->done_cv);
+
if (ckpt_performed)
{
/*
MemSet(CheckpointerShmem, 0, size);
SpinLockInit(&CheckpointerShmem->ckpt_lck);
CheckpointerShmem->max_requests = NBuffers;
+ ConditionVariableInit(&CheckpointerShmem->start_cv);
+ ConditionVariableInit(&CheckpointerShmem->done_cv);
}
}
new_failed;
/* Wait for a new checkpoint to start. */
+ ConditionVariablePrepareToSleep(&CheckpointerShmem->start_cv);
for (;;)
{
SpinLockAcquire(&CheckpointerShmem->ckpt_lck);
if (new_started != old_started)
break;
- CHECK_FOR_INTERRUPTS();
- pg_usleep(100000L);
+ ConditionVariableSleep(&CheckpointerShmem->start_cv,
+ WAIT_EVENT_CHECKPOINT_START);
}
+ ConditionVariableCancelSleep();
/*
* We are waiting for ckpt_done >= new_started, in a modulo sense.
*/
+ ConditionVariablePrepareToSleep(&CheckpointerShmem->done_cv);
for (;;)
{
int new_done;
if (new_done - new_started >= 0)
break;
- CHECK_FOR_INTERRUPTS();
- pg_usleep(100000L);
+ ConditionVariableSleep(&CheckpointerShmem->done_cv,
+ WAIT_EVENT_CHECKPOINT_DONE);
}
+ ConditionVariableCancelSleep();
if (new_failed != old_failed)
ereport(ERROR,
case WAIT_EVENT_BTREE_PAGE:
event_name = "BtreePage";
break;
+ case WAIT_EVENT_CHECKPOINT_DONE:
+ event_name = "CheckpointDone";
+ break;
+ case WAIT_EVENT_CHECKPOINT_START:
+ event_name = "CheckpointStart";
+ break;
case WAIT_EVENT_CLOG_GROUP_UPDATE:
event_name = "ClogGroupUpdate";
break;
WAIT_EVENT_BGWORKER_STARTUP,
WAIT_EVENT_BTREE_PAGE,
WAIT_EVENT_CLOG_GROUP_UPDATE,
+ WAIT_EVENT_CHECKPOINT_DONE,
+ WAIT_EVENT_CHECKPOINT_START,
WAIT_EVENT_EXECUTE_GATHER,
WAIT_EVENT_HASH_BATCH_ALLOCATING,
WAIT_EVENT_HASH_BATCH_ELECTING,