Commit 1a3d104
committed
Avoid acquiring spinlock when checking if recovery has finished, for speed.
RecoveryIsInProgress() can be called very frequently. During normal
operation, it just checks a backend-local variable and returns quickly,
but during hot standby, it checks a spinlock-protected shared variable.
Those spinlock acquisitions can become a point of contention on a busy
hot standby system.
Replace the spinlock acquisition with a memory barrier.
Per discussion with Andres Freund, Ants Aasma and Merlin Moncure.1 parent f4482a5 commit 1a3d104
1 file changed
+17
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7367 | 7367 | | |
7368 | 7368 | | |
7369 | 7369 | | |
7370 | | - | |
| 7370 | + | |
| 7371 | + | |
| 7372 | + | |
| 7373 | + | |
7371 | 7374 | | |
7372 | 7375 | | |
7373 | | - | |
7374 | | - | |
7375 | 7376 | | |
7376 | | - | |
7377 | 7377 | | |
7378 | 7378 | | |
7379 | 7379 | | |
| |||
7382 | 7382 | | |
7383 | 7383 | | |
7384 | 7384 | | |
| 7385 | + | |
| 7386 | + | |
| 7387 | + | |
| 7388 | + | |
| 7389 | + | |
| 7390 | + | |
| 7391 | + | |
7385 | 7392 | | |
| 7393 | + | |
| 7394 | + | |
| 7395 | + | |
| 7396 | + | |
| 7397 | + | |
| 7398 | + | |
7386 | 7399 | | |
7387 | 7400 | | |
7388 | 7401 | | |
| |||
0 commit comments