forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3e60c6f
committed
Code review for shm_toc.h/.c.
Declare the toc_nentry field as uint32 not Size. Since shm_toc_lookup()reads the field without any lock, it has to be atomically readable, andwe do not assume that for fields wider than 32 bits. Performance wouldbe impossibly bad for entry counts approaching 2^32 anyway, so there isno need to try to preserve maximum width here.This is probably an academic issue, because even if reading int64 isn'tatomic, the high order half would never change in practice. Still, it'sa coding rule violation, so let's fix it.Adjust some other not-terribly-well-chosen data types too, and copy-editsome comments. Make shm_toc_attach's Asserts consistent withshm_toc_create's.None of this looks to be a live bug, so no need for back-patch.Discussion:https://postgr.es/m/16984.1496679541@sss.pgh.pa.us1 parent614350a commit3e60c6f
2 files changed
+30
-25
lines changedLines changed: 22 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 |
| - | |
| 9 | + | |
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
| 23 | + | |
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 |
| - | |
| 28 | + | |
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
| |||
64 | 64 |
| |
65 | 65 |
| |
66 | 66 |
| |
67 |
| - | |
| 67 | + | |
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
79 |
| - | |
| 79 | + | |
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
| |||
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
143 |
| - | |
| 143 | + | |
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
| |||
155 | 155 |
| |
156 | 156 |
| |
157 | 157 |
| |
158 |
| - | |
| 158 | + | |
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
162 | 162 |
| |
163 | 163 |
| |
164 |
| - | |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 |
| - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
169 | 169 |
| |
170 | 170 |
| |
171 | 171 |
| |
| |||
181 | 181 |
| |
182 | 182 |
| |
183 | 183 |
| |
184 |
| - | |
| 184 | + | |
| 185 | + | |
185 | 186 |
| |
186 | 187 |
| |
187 | 188 |
| |
| |||
220 | 221 |
| |
221 | 222 |
| |
222 | 223 |
| |
223 |
| - | |
224 |
| - | |
| 224 | + | |
| 225 | + | |
225 | 226 |
| |
226 |
| - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
227 | 231 |
| |
228 | 232 |
| |
229 | 233 |
| |
|
Lines changed: 8 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
25 |
| - | |
| 25 | + | |
26 | 26 |
| |
27 |
| - | |
| 27 | + | |
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
39 |
| - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
40 | 42 |
| |
41 | 43 |
| |
42 | 44 |
| |
| |||
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
50 |
| - | |
51 |
| - | |
| 52 | + | |
52 | 53 |
| |
53 |
| - | |
| 54 | + | |
54 | 55 |
| |
55 |
| - | |
| 56 | + | |
56 | 57 |
| |
57 | 58 |
|
0 commit comments
Comments
(0)