forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitab355e3
committed
Redefine backend ID to be an index into the proc array
Previously, backend ID was an index into the ProcState array, in theshared cache invalidation manager (sinvaladt.c). The entry in theProcState array was reserved at backend startup by scanning the arrayfor a free entry, and that was also when the backend got its backendID. Things become slightly simpler if we redefine backend ID to be theindex into the PGPROC array, and directly use it also as an index tothe ProcState array. This uses a little more memory, as we reserve afew extra slots in the ProcState array for aux processes that don'tneed them, but the simplicity is worth it.Aux processes now also have a backend ID. This simplifies thereservation of BackendStatusArray and ProcSignal slots.You can now convert a backend ID into an index into the PGPROC arraysimply by subtracting 1. We still use 0-based "pgprocnos" in variousplaces, for indexes into the PGPROC array, but the only difference nowis that backend IDs start at 1 while pgprocnos start at 0. (The nextcommmit will get rid of the term "backend ID" altogether and makeeverything 0-based.)There is still a 'backendId' field in PGPROC, now part of 'vxid' whichencapsulates the backend ID and local transaction ID together. It'sneeded for prepared xacts. For regular backends, the backendId isalways equal to pgprocno + 1, but for prepared xact PGPROC entries,it's the ID of the original backend that processed the transaction.Reviewed-by: Andres Freund, Reid ThompsonDiscussion:https://www.postgresql.org/message-id/8171f1aa-496f-46a6-afc3-c46fe7a9b407@iki.fi1 parent30b8d6e commitab355e3
File tree
28 files changed
+282
-322
lines changed- src
- backend
- access/transam
- catalog
- commands
- executor
- postmaster
- storage
- ipc
- lmgr
- utils
- activity
- adt
- error
- init
- time
- include
- storage
- pl/plpgsql/src
28 files changed
+282
-322
lines changedLines changed: 11 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
154 |
| - | |
155 | 154 |
| |
156 | 155 |
| |
157 | 156 |
| |
| |||
285 | 284 |
| |
286 | 285 |
| |
287 | 286 |
| |
288 |
| - | |
289 |
| - | |
290 |
| - | |
291 |
| - | |
292 |
| - | |
293 |
| - | |
294 |
| - | |
295 |
| - | |
296 |
| - | |
297 |
| - | |
298 |
| - | |
299 |
| - | |
300 |
| - | |
301 |
| - | |
302 | 287 |
| |
303 | 288 |
| |
304 | 289 |
| |
| |||
457 | 442 |
| |
458 | 443 |
| |
459 | 444 |
| |
460 |
| - | |
| 445 | + | |
461 | 446 |
| |
462 | 447 |
| |
463 | 448 |
| |
464 | 449 |
| |
465 | 450 |
| |
466 |
| - | |
| 451 | + | |
467 | 452 |
| |
468 | 453 |
| |
469 |
| - | |
470 |
| - | |
| 454 | + | |
| 455 | + | |
471 | 456 |
| |
472 | 457 |
| |
473 | 458 |
| |
474 | 459 |
| |
475 | 460 |
| |
476 |
| - | |
477 |
| - | |
| 461 | + | |
| 462 | + | |
478 | 463 |
| |
479 | 464 |
| |
480 | 465 |
| |
| |||
522 | 507 |
| |
523 | 508 |
| |
524 | 509 |
| |
525 |
| - | |
| 510 | + | |
526 | 511 |
| |
527 | 512 |
| |
528 | 513 |
| |
| |||
559 | 544 |
| |
560 | 545 |
| |
561 | 546 |
| |
562 |
| - | |
| 547 | + | |
563 | 548 |
| |
564 | 549 |
| |
565 | 550 |
| |
| |||
583 | 568 |
| |
584 | 569 |
| |
585 | 570 |
| |
586 |
| - | |
| 571 | + | |
587 | 572 |
| |
588 | 573 |
| |
589 | 574 |
| |
| |||
884 | 869 |
| |
885 | 870 |
| |
886 | 871 |
| |
887 |
| - | |
| 872 | + | |
888 | 873 |
| |
889 | 874 |
| |
890 | 875 |
| |
| |||
919 | 904 |
| |
920 | 905 |
| |
921 | 906 |
| |
922 |
| - | |
| 907 | + | |
923 | 908 |
| |
924 | 909 |
| |
925 | 910 |
| |
|
Lines changed: 6 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
600 | 600 |
| |
601 | 601 |
| |
602 | 602 |
| |
603 |
| - | |
| 603 | + | |
604 | 604 |
| |
605 |
| - | |
| 605 | + | |
606 | 606 |
| |
607 | 607 |
| |
608 | 608 |
| |
| |||
2099 | 2099 |
| |
2100 | 2100 |
| |
2101 | 2101 |
| |
2102 |
| - | |
2103 |
| - | |
| 2102 | + | |
| 2103 | + | |
2104 | 2104 |
| |
2105 | 2105 |
| |
2106 | 2106 |
| |
| |||
2289 | 2289 |
| |
2290 | 2290 |
| |
2291 | 2291 |
| |
2292 |
| - | |
| 2292 | + | |
2293 | 2293 |
| |
2294 | 2294 |
| |
2295 | 2295 |
| |
| |||
2840 | 2840 |
| |
2841 | 2841 |
| |
2842 | 2842 |
| |
2843 |
| - | |
| 2843 | + | |
2844 | 2844 |
| |
2845 | 2845 |
| |
2846 | 2846 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
52 |
| - | |
| 52 | + | |
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1077 | 1077 |
| |
1078 | 1078 |
| |
1079 | 1079 |
| |
1080 |
| - | |
| 1080 | + | |
1081 | 1081 |
| |
1082 | 1082 |
| |
1083 | 1083 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
799 | 799 |
| |
800 | 800 |
| |
801 | 801 |
| |
802 |
| - | |
| 802 | + | |
803 | 803 |
| |
804 | 804 |
| |
805 | 805 |
| |
| |||
1081 | 1081 |
| |
1082 | 1082 |
| |
1083 | 1083 |
| |
1084 |
| - | |
| 1084 | + | |
1085 | 1085 |
| |
1086 | 1086 |
| |
1087 | 1087 |
| |
|
Lines changed: 1 addition & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 |
| - | |
| 110 | + | |
121 | 111 |
| |
122 | 112 |
| |
123 | 113 |
| |
|
Lines changed: 68 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
701 | 701 |
| |
702 | 702 |
| |
703 | 703 |
| |
704 |
| - | |
| 704 | + | |
705 | 705 |
| |
706 | 706 |
| |
707 | 707 |
| |
| |||
743 | 743 |
| |
744 | 744 |
| |
745 | 745 |
| |
746 |
| - | |
| 746 | + | |
747 | 747 |
| |
748 | 748 |
| |
749 | 749 |
| |
| |||
930 | 930 |
| |
931 | 931 |
| |
932 | 932 |
| |
933 |
| - | |
| 933 | + | |
934 | 934 |
| |
935 | 935 |
| |
936 | 936 |
| |
| |||
2536 | 2536 |
| |
2537 | 2537 |
| |
2538 | 2538 |
| |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
2539 | 2544 |
| |
2540 | 2545 |
| |
2541 | 2546 |
| |
| |||
2548 | 2553 |
| |
2549 | 2554 |
| |
2550 | 2555 |
| |
2551 |
| - | |
| 2556 | + | |
2552 | 2557 |
| |
2553 |
| - | |
| 2558 | + | |
2554 | 2559 |
| |
2555 | 2560 |
| |
2556 | 2561 |
| |
| |||
3099 | 3104 |
| |
3100 | 3105 |
| |
3101 | 3106 |
| |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
| 3116 | + | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
| 3142 | + | |
| 3143 | + | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
3102 | 3165 |
| |
3103 | 3166 |
| |
3104 | 3167 |
| |
|
Lines changed: 11 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
87 | 87 |
| |
88 | 88 |
| |
89 | 89 |
| |
90 |
| - | |
| 90 | + | |
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
| |||
154 | 154 |
| |
155 | 155 |
| |
156 | 156 |
| |
157 |
| - | |
158 |
| - | |
159 |
| - | |
160 | 157 |
| |
161 | 158 |
| |
162 |
| - | |
| 159 | + | |
163 | 160 |
| |
164 | 161 |
| |
165 | 162 |
| |
166 | 163 |
| |
167 |
| - | |
168 |
| - | |
169 |
| - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
170 | 169 |
| |
171 | 170 |
| |
172 | 171 |
| |
173 | 172 |
| |
174 |
| - | |
| 173 | + | |
175 | 174 |
| |
176 | 175 |
| |
177 | 176 |
| |
| |||
200 | 199 |
| |
201 | 200 |
| |
202 | 201 |
| |
203 |
| - | |
| 202 | + | |
204 | 203 |
| |
205 | 204 |
| |
206 | 205 |
| |
| |||
212 | 211 |
| |
213 | 212 |
| |
214 | 213 |
| |
215 |
| - | |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
| 214 | + | |
220 | 215 |
| |
221 | 216 |
| |
222 | 217 |
| |
| |||
233 | 228 |
| |
234 | 229 |
| |
235 | 230 |
| |
236 |
| - | |
| 231 | + | |
237 | 232 |
| |
238 | 233 |
| |
239 | 234 |
| |
|
0 commit comments
Comments
(0)