forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit197e4af
committed
Refactor pid, random seed and start time initialization.
Background workers, including parallel workers, were generatingthe same sequence of numbers in random(). This showed up as DSMhandle collisions when Parallel Hash created multiple segments,but any code that calls random() in background workers could beaffected if it cares about different backends generating differentnumbers.Repair by making sure that all new processes initialize the seedat the same time as they set MyProcPid and MyStartTime in a newfunction InitProcessGlobals(), called by the postmaster, itschildren and also standalone processes. Also add a new highresolution MyStartTimestamp as a potentially useful by-product,and remove SessionStartTime from struct Port as it is nowredundant.No back-patch for now, as the known consequences so far are justa bunch of harmless shm_open(O_EXCL) collisions.Author: Thomas MunroReviewed-by: Tom LaneDiscussion:https://postgr.es/m/CAEepm%3D2eJj_6%3DB%2B2tEpGu2nf1BjthCf9nXXUouYvJJ4C5WSwhg%40mail.gmail.com1 parente74dd00 commit197e4af
File tree
8 files changed
+37
-62
lines changed- src
- backend
- postmaster
- tcop
- utils/init
- include
- libpq
- postmaster
8 files changed
+37
-62
lines changedLines changed: 1 addition & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2784 | 2784 |
| |
2785 | 2785 |
| |
2786 | 2786 |
| |
2787 |
| - | |
2788 | 2787 |
| |
2789 | 2788 |
| |
2790 | 2789 |
| |
2791 | 2790 |
| |
2792 | 2791 |
| |
2793 | 2792 |
| |
2794 |
| - | |
2795 |
| - | |
2796 |
| - | |
2797 | 2793 |
| |
2798 |
| - | |
2799 |
| - | |
2800 |
| - | |
2801 |
| - | |
2802 | 2794 |
| |
2803 | 2795 |
| |
2804 | 2796 |
| |
| |||
2883 | 2875 |
| |
2884 | 2876 |
| |
2885 | 2877 |
| |
2886 |
| - | |
| 2878 | + | |
2887 | 2879 |
| |
2888 | 2880 |
| |
2889 | 2881 |
| |
|
Lines changed: 29 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
| 132 | + | |
132 | 133 |
| |
133 | 134 |
| |
134 | 135 |
| |
| |||
581 | 582 |
| |
582 | 583 |
| |
583 | 584 |
| |
584 |
| - | |
| 585 | + | |
585 | 586 |
| |
586 |
| - | |
| 587 | + | |
587 | 588 |
| |
588 | 589 |
| |
589 | 590 |
| |
| |||
597 | 598 |
| |
598 | 599 |
| |
599 | 600 |
| |
600 |
| - | |
601 |
| - | |
602 |
| - | |
603 |
| - | |
604 |
| - | |
605 |
| - | |
606 |
| - | |
607 |
| - | |
608 |
| - | |
609 |
| - | |
610 | 601 |
| |
611 | 602 |
| |
612 | 603 |
| |
| |||
2513 | 2504 |
| |
2514 | 2505 |
| |
2515 | 2506 |
| |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
2516 | 2533 |
| |
2517 | 2534 |
| |
2518 | 2535 |
| |
| |||
4154 | 4171 |
| |
4155 | 4172 |
| |
4156 | 4173 |
| |
4157 |
| - | |
4158 |
| - | |
4159 |
| - | |
4160 |
| - | |
4161 | 4174 |
| |
4162 | 4175 |
| |
4163 | 4176 |
| |
| |||
4315 | 4328 |
| |
4316 | 4329 |
| |
4317 | 4330 |
| |
4318 |
| - | |
4319 |
| - | |
4320 | 4331 |
| |
4321 | 4332 |
| |
4322 |
| - | |
4323 |
| - | |
4324 |
| - | |
4325 |
| - | |
4326 |
| - | |
4327 |
| - | |
4328 |
| - | |
4329 |
| - | |
4330 |
| - | |
4331 |
| - | |
4332 |
| - | |
4333 |
| - | |
4334 |
| - | |
4335 | 4333 |
| |
4336 | 4334 |
| |
4337 | 4335 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4632 | 4632 |
| |
4633 | 4633 |
| |
4634 | 4634 |
| |
4635 |
| - | |
| 4635 | + | |
4636 | 4636 |
| |
4637 | 4637 |
| |
4638 | 4638 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
42 | 43 |
| |
43 | 44 |
| |
44 | 45 |
| |
|
Lines changed: 2 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
274 | 274 |
| |
275 | 275 |
| |
276 | 276 |
| |
277 |
| - | |
278 |
| - | |
279 |
| - | |
| 277 | + | |
280 | 278 |
| |
281 | 279 |
| |
282 | 280 |
| |
| |||
321 | 319 |
| |
322 | 320 |
| |
323 | 321 |
| |
324 |
| - | |
325 |
| - | |
326 |
| - | |
327 |
| - | |
328 |
| - | |
329 |
| - | |
330 |
| - | |
331 |
| - | |
332 |
| - | |
333 |
| - | |
334 |
| - | |
| 322 | + | |
335 | 323 |
| |
336 | 324 |
| |
337 | 325 |
| |
|
Lines changed: 0 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
150 | 150 |
| |
151 | 151 |
| |
152 | 152 |
| |
153 |
| - | |
154 |
| - | |
155 |
| - | |
156 |
| - | |
157 |
| - | |
158 |
| - | |
159 |
| - | |
160 | 153 |
| |
161 | 154 |
| |
162 | 155 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| 28 | + | |
28 | 29 |
| |
29 | 30 |
| |
30 | 31 |
| |
| |||
163 | 164 |
| |
164 | 165 |
| |
165 | 166 |
| |
| 167 | + | |
166 | 168 |
| |
167 | 169 |
| |
168 | 170 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| 51 | + | |
51 | 52 |
| |
52 | 53 |
| |
53 | 54 |
| |
|
0 commit comments
Comments
(0)