forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4a15f87
committed
Prevent int128 from requiring more than MAXALIGN alignment.
Our initial work with int128 neglected alignment considerations, anoversight that came back to bite us in bug #14897 from Vincent Lachenal.It is unsurprising that int128 might have a 16-byte alignment requirement;what's slightly more surprising is that even notoriously lax Intel chipssometimes enforce that.Raising MAXALIGN seems out of the question: the costs in wasted disk andmemory space would be significant, and there would also be an on-diskcompatibility break. Nor does it seem very practical to try to allow somedata structures to have more-than-MAXALIGN alignment requirement, as we'dhave to push knowledge of that throughout various code that copies datastructures around.The only way out of the box is to make type int128 conform to the system'salignment assumptions. Fortunately, gcc supports that via its__attribute__(aligned()) pragma; and since we don't currently supportint128 on non-gcc-workalike compilers, we shouldn't be losing any platformsupport this way.Although we could have just done pg_attribute_aligned(MAXIMUM_ALIGNOF) andcalled it a day, I did a little bit of extra work to make the code moreportable than that: it will also support int128 on compilers without__attribute__(aligned()), if the native alignment of their 128-bit-inttype is no more than that of int64.Add a regression test case that exercises the one known instance of theproblem, in parallel aggregation over a bigint column.Back-patch of commit7518049. The code known to be affected only existsin 9.6 and later, but we do have some stuff using int128 in 9.5, so patchback to 9.5.Discussion:https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org1 parent6c35b3a commit4a15f87
File tree
8 files changed
+108
-12
lines changed- config
- src
- include
- test/regress
- expected
- sql
8 files changed
+108
-12
lines changedLines changed: 6 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
97 |
| - | |
98 |
| - | |
99 |
| - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
100 | 102 |
| |
101 | 103 |
| |
102 | 104 |
| |
| |||
126 | 128 |
| |
127 | 129 |
| |
128 | 130 |
| |
| 131 | + | |
129 | 132 |
| |
130 | 133 |
| |
131 | 134 |
| |
|
Lines changed: 40 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14275 | 14275 |
| |
14276 | 14276 |
| |
14277 | 14277 |
| |
14278 |
| - | |
| 14278 | + | |
| 14279 | + | |
| 14280 | + | |
| 14281 | + | |
14279 | 14282 |
| |
14280 | 14283 |
| |
14281 | 14284 |
| |
| |||
14335 | 14338 |
| |
14336 | 14339 |
| |
14337 | 14340 |
| |
14338 |
| - | |
| 14341 | + | |
14339 | 14342 |
| |
14340 | 14343 |
| |
14341 | 14344 |
| |
| |||
14385 | 14388 |
| |
14386 | 14389 |
| |
14387 | 14390 |
| |
| 14391 | + | |
| 14392 | + | |
| 14393 | + | |
| 14394 | + | |
| 14395 | + | |
| 14396 | + | |
| 14397 | + | |
| 14398 | + | |
| 14399 | + | |
| 14400 | + | |
| 14401 | + | |
| 14402 | + | |
| 14403 | + | |
| 14404 | + | |
| 14405 | + | |
| 14406 | + | |
| 14407 | + | |
| 14408 | + | |
| 14409 | + | |
| 14410 | + | |
| 14411 | + | |
| 14412 | + | |
| 14413 | + | |
| 14414 | + | |
| 14415 | + | |
| 14416 | + | |
| 14417 | + | |
| 14418 | + | |
| 14419 | + | |
| 14420 | + | |
| 14421 | + | |
| 14422 | + | |
| 14423 | + | |
| 14424 | + | |
| 14425 | + | |
14388 | 14426 |
| |
14389 | 14427 |
| |
14390 | 14428 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1848 | 1848 |
| |
1849 | 1849 |
| |
1850 | 1850 |
| |
1851 |
| - | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
1852 | 1855 |
| |
1853 | 1856 |
| |
1854 | 1857 |
| |
| |||
1865 | 1868 |
| |
1866 | 1869 |
| |
1867 | 1870 |
| |
1868 |
| - | |
| 1871 | + | |
1869 | 1872 |
| |
1870 | 1873 |
| |
1871 | 1874 |
| |
|
Lines changed: 21 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
355 | 355 |
| |
356 | 356 |
| |
357 | 357 |
| |
358 |
| - | |
359 |
| - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
360 | 363 |
| |
361 | 364 |
| |
362 |
| - | |
363 |
| - | |
364 |
| - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
365 | 381 |
| |
366 | 382 |
| |
367 | 383 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 |
| |
31 | 34 |
| |
32 | 35 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 |
| |
38 | 41 |
| |
39 | 42 |
| |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
99 | 99 |
| |
100 | 100 |
| |
101 | 101 |
| |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
102 | 126 |
| |
103 | 127 |
| |
104 | 128 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 |
| |
43 | 49 |
| |
44 | 50 |
| |
|
0 commit comments
Comments
(0)