forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite369f37
committed
Reduce the number of GetFlushRecPtr() calls done by walsenders.
Since the WAL flush position only moves forward, it's safe to cacheits previous value within each walsender process, and update fromshared memory only once we've caught up to the previously-seen value.When there are many active walsenders, this makes for a very significantreduction in the amount of contention on the XLogCtl->info_lck spinlock.This patch also adjusts the logic so that we update our idea of theflush position after processing a WAL record, rather than beforehand.This may cause us to realize we're not caught up when the precedingcoding would've thought that we were, but that seems all to the good;it may avoid a useless sleep-and-wakeup cycle.Back-patch to v12. The contention problem exists in prior branches,but it's much less severe (due to inefficiencies elsewhere) so thereseems no need to take any risk of back-patching further.Pierre Ducroquet, reviewed by Julien RouhaudDiscussion:https://postgr.es/m/2931018.Vxl9zapr77@pierred-pdoc1 parent20d6225 commite369f37
1 file changed
+18
-7
lines changedLines changed: 18 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2774 | 2774 |
| |
2775 | 2775 |
| |
2776 | 2776 |
| |
2777 |
| - | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
2778 | 2785 |
| |
2779 | 2786 |
| |
2780 | 2787 |
| |
| |||
2791 | 2798 |
| |
2792 | 2799 |
| |
2793 | 2800 |
| |
2794 |
| - | |
2795 |
| - | |
2796 |
| - | |
2797 |
| - | |
2798 |
| - | |
2799 | 2801 |
| |
2800 | 2802 |
| |
2801 | 2803 |
| |
| |||
2808 | 2810 |
| |
2809 | 2811 |
| |
2810 | 2812 |
| |
2811 |
| - | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
2812 | 2823 |
| |
2813 | 2824 |
| |
2814 | 2825 |
| |
|
0 commit comments
Comments
(0)