forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork0
Commit7518049
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.This will need to be back-patched, along with the preparatory commit91aec93. But let's see what the buildfarm makes of it first.Discussion:https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org1 parent91aec93 commit7518049
File tree
8 files changed
+102
-12
lines changed- config
- src
- include
- test/regress
- expected
- sql
8 files changed
+102
-12
lines changedLines changed: 6 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
99 |
| - | |
100 |
| - | |
101 |
| - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
102 | 104 |
| |
103 | 105 |
| |
104 | 106 |
| |
| |||
128 | 130 |
| |
129 | 131 |
| |
130 | 132 |
| |
| 133 | + | |
131 | 134 |
| |
132 | 135 |
| |
133 | 136 |
| |
|
Lines changed: 40 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14864 | 14864 |
| |
14865 | 14865 |
| |
14866 | 14866 |
| |
14867 |
| - | |
| 14867 | + | |
| 14868 | + | |
| 14869 | + | |
| 14870 | + | |
14868 | 14871 |
| |
14869 | 14872 |
| |
14870 | 14873 |
| |
| |||
14924 | 14927 |
| |
14925 | 14928 |
| |
14926 | 14929 |
| |
14927 |
| - | |
| 14930 | + | |
14928 | 14931 |
| |
14929 | 14932 |
| |
14930 | 14933 |
| |
| |||
14974 | 14977 |
| |
14975 | 14978 |
| |
14976 | 14979 |
| |
| 14980 | + | |
| 14981 | + | |
| 14982 | + | |
| 14983 | + | |
| 14984 | + | |
| 14985 | + | |
| 14986 | + | |
| 14987 | + | |
| 14988 | + | |
| 14989 | + | |
| 14990 | + | |
| 14991 | + | |
| 14992 | + | |
| 14993 | + | |
| 14994 | + | |
| 14995 | + | |
| 14996 | + | |
| 14997 | + | |
| 14998 | + | |
| 14999 | + | |
| 15000 | + | |
| 15001 | + | |
| 15002 | + | |
| 15003 | + | |
| 15004 | + | |
| 15005 | + | |
| 15006 | + | |
| 15007 | + | |
| 15008 | + | |
| 15009 | + | |
| 15010 | + | |
| 15011 | + | |
| 15012 | + | |
| 15013 | + | |
| 15014 | + | |
14977 | 15015 |
| |
14978 | 15016 |
| |
14979 | 15017 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1820 | 1820 |
| |
1821 | 1821 |
| |
1822 | 1822 |
| |
1823 |
| - | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
1824 | 1827 |
| |
1825 | 1828 |
| |
1826 | 1829 |
| |
| |||
1837 | 1840 |
| |
1838 | 1841 |
| |
1839 | 1842 |
| |
1840 |
| - | |
| 1843 | + | |
1841 | 1844 |
| |
1842 | 1845 |
| |
1843 | 1846 |
| |
|
Lines changed: 21 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
376 | 376 |
| |
377 | 377 |
| |
378 | 378 |
| |
379 |
| - | |
380 |
| - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
381 | 384 |
| |
382 | 385 |
| |
383 |
| - | |
384 |
| - | |
385 |
| - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
386 | 402 |
| |
387 | 403 |
| |
388 | 404 |
| |
|
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: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
444 | 444 |
| |
445 | 445 |
| |
446 | 446 |
| |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
447 | 465 |
| |
448 | 466 |
| |
449 | 467 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
178 | 184 |
| |
179 | 185 |
| |
180 | 186 |
| |
|
0 commit comments
Comments
(0)