forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6301c3a
committed
Avoid O(N^2) behavior when the standby process releases many locks.
When replaying a transaction that held many exclusive locks on theprimary, a standby server's startup process would expend O(N^2)effort on manipulating the list of locks. This code was fine whenwritten, but commit1cff1b9 made repetitive list_delete_first()calls inefficient, as explained in its commit message. Fix by justiterating the list normally, and releasing storage only when done.(This'd be inadequate if we needed to recover from an error occurringpartway through; but we don't.)Back-patch to v13 where1cff1b9 came in.Nathan BossartDiscussion:https://postgr.es/m/CD2F0E7F-9822-45EC-A411-AE56F14DEA9F@amazon.com1 parentacb2d7d commit6301c3a
1 file changed
+6
-4
lines changedLines changed: 6 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
986 | 986 |
| |
987 | 987 |
| |
988 | 988 |
| |
989 |
| - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
990 | 992 |
| |
991 |
| - | |
| 993 | + | |
992 | 994 |
| |
993 | 995 |
| |
994 | 996 |
| |
| |||
1002 | 1004 |
| |
1003 | 1005 |
| |
1004 | 1006 |
| |
1005 |
| - | |
1006 |
| - | |
1007 | 1007 |
| |
| 1008 | + | |
| 1009 | + | |
1008 | 1010 |
| |
1009 | 1011 |
| |
1010 | 1012 |
| |
|
0 commit comments
Comments
(0)