aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2021-01-13 22:59:17 +0900
committerFujii Masao <fujii@postgresql.org>2021-01-13 22:59:17 +0900
commit39b03690b529935a3c33024ee68f08e2d347cf4f (patch)
tree535e89716c5be4aebec5debb1db1e37e6f0d43c3 /src/backend/storage/buffer/bufmgr.c
parent6ecaaf810b8b9e3132f00549e630400f38a7ca37 (diff)
downloadpostgresql-39b03690b529935a3c33024ee68f08e2d347cf4f.tar.gz
postgresql-39b03690b529935a3c33024ee68f08e2d347cf4f.zip
Log long wait time on recovery conflict when it's resolved.
This is a follow-up of the work done in commit 0650ff2303. This commit extends log_recovery_conflict_waits so that a log message is produced also when recovery conflict has already been resolved after deadlock_timeout passes, i.e., when the startup process finishes waiting for recovery conflict after deadlock_timeout. This is useful in investigating how long recovery conflicts prevented the recovery from applying WAL. Author: Fujii Masao Reviewed-by: Kyotaro Horiguchi, Bertrand Drouvot Discussion: https://postgr.es/m/9a60178c-a853-1440-2cdc-c3af916cff59@amazon.com
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r--src/backend/storage/buffer/bufmgr.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index c46b8abad12..561c212092f 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -4034,6 +4034,16 @@ LockBufferForCleanup(Buffer buffer)
/* Successfully acquired exclusive lock with pincount 1 */
UnlockBufHdr(bufHdr, buf_state);
+ /*
+ * Emit the log message if recovery conflict on buffer pin was
+ * resolved but the startup process waited longer than
+ * deadlock_timeout for it.
+ */
+ if (logged_recovery_conflict)
+ LogRecoveryConflict(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
+ waitStart, GetCurrentTimestamp(),
+ NULL, false);
+
/* Report change to non-waiting status */
if (new_status)
{
@@ -4088,7 +4098,7 @@ LockBufferForCleanup(Buffer buffer)
DeadlockTimeout))
{
LogRecoveryConflict(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
- waitStart, now, NULL);
+ waitStart, now, NULL, true);
logged_recovery_conflict = true;
}
}