- Notifications
You must be signed in to change notification settings - Fork5
Commit2040bb4
committed
Clean up manipulations of hash indexes' hasho_flag field.
Standardize on testing a hash index page's type by doing(opaque->hasho_flag & LH_PAGE_TYPE) == LH_xxx_PAGEVarious places were taking shortcuts likeopaque->hasho_flag & LH_BUCKET_PAGEwhich while not actually wrong, is still bad practice becauseit encourages use ofopaque->hasho_flag & LH_UNUSED_PAGEwhich *is* wrong (LH_UNUSED_PAGE == 0, so the above is constant false).hash_xlog.c's hash_mask() contained such an incorrect test.This also ensures that we mask out the additional flag bits thathasho_flag has accreted since 9.6. pgstattuple's pgstat_hash_page(),for one, was failing to do that and was thus actively broken.Also fix assorted comments that hadn't been updated to reflect theextended usage of hasho_flag, and fix some macros that were testingjust "(hasho_flag & bit)" to use the less dangerous, project-approvedform "((hasho_flag & bit) != 0)".Coverity found the bug in hash_mask(); I noted the one inpgstat_hash_page() through code reading.1 parent1dffabe commit2040bb4
File tree
6 files changed
+29
-25
lines changed- contrib
- pageinspect
- pgstattuple
- src
- backend/access/hash
- include/access
6 files changed
+29
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
| 188 | + | |
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
| |||
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
| 204 | + | |
| 205 | + | |
204 | 206 | | |
205 | | - | |
| 207 | + | |
206 | 208 | | |
207 | | - | |
| 209 | + | |
208 | 210 | | |
209 | | - | |
| 211 | + | |
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
| 456 | + | |
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1234 | 1234 | | |
1235 | 1235 | | |
1236 | 1236 | | |
| 1237 | + | |
1237 | 1238 | | |
1238 | 1239 | | |
1239 | 1240 | | |
| |||
1242 | 1243 | | |
1243 | 1244 | | |
1244 | 1245 | | |
1245 | | - | |
| 1246 | + | |
| 1247 | + | |
1246 | 1248 | | |
1247 | 1249 | | |
1248 | 1250 | | |
1249 | 1251 | | |
1250 | 1252 | | |
1251 | 1253 | | |
1252 | | - | |
1253 | | - | |
| 1254 | + | |
| 1255 | + | |
1254 | 1256 | | |
1255 | 1257 | | |
1256 | 1258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
| 221 | + | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
0 commit comments
Comments
(0)