File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,7 @@ InitProcGlobal(void)
186
186
ProcGlobal -> walwriterLatch = NULL ;
187
187
ProcGlobal -> checkpointerLatch = NULL ;
188
188
pg_atomic_init_u32 (& ProcGlobal -> procArrayGroupFirst , INVALID_PGPROCNO );
189
+ pg_atomic_init_flag (& ProcGlobal -> activeDeadlockCheck );
189
190
190
191
/*
191
192
* Create and initialize all the PGPROC structures we'll need. There are
@@ -1657,6 +1658,10 @@ CheckDeadLock(void)
1657
1658
{
1658
1659
int i ;
1659
1660
1661
+
1662
+ if (!pg_atomic_test_set_flag (& ProcGlobal -> activeDeadlockCheck ))
1663
+ return ;
1664
+
1660
1665
/*
1661
1666
* Acquire exclusive lock on the entire shared lock data structures. Must
1662
1667
* grab LWLocks in partition-number order to avoid LWLock deadlock.
@@ -1732,6 +1737,8 @@ CheckDeadLock(void)
1732
1737
check_done :
1733
1738
for (i = NUM_LOCK_PARTITIONS ; -- i >= 0 ;)
1734
1739
LWLockRelease (LockHashPartitionLockByIndex (i ));
1740
+
1741
+ pg_atomic_clear_flag (& ProcGlobal -> activeDeadlockCheck );
1735
1742
}
1736
1743
1737
1744
/*
Original file line number Diff line number Diff line change @@ -253,6 +253,8 @@ typedef struct PROC_HDR
253
253
int startupProcPid ;
254
254
/* Buffer id of the buffer that Startup process waits for pin on, or -1 */
255
255
int startupBufferPinWaitBufId ;
256
+ /* Deadlock detection is in progress */
257
+ pg_atomic_flag activeDeadlockCheck ;
256
258
} PROC_HDR ;
257
259
258
260
extern PGDLLIMPORT PROC_HDR * ProcGlobal ;
You can’t perform that action at this time.
0 commit comments