pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Prevent int128 from requiring more than MAXALIGN alignment. 4+ messages / 1 participants [nested] [flat]
* pgsql: Prevent int128 from requiring more than MAXALIGN alignment. @ 2017-11-14 20:04 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2017-11-14 20:04 UTC (permalink / raw) To: pgsql-committers Prevent int128 from requiring more than MAXALIGN alignment. Our initial work with int128 neglected alignment considerations, an oversight 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 chips sometimes enforce that. Raising MAXALIGN seems out of the question: the costs in wasted disk and memory space would be significant, and there would also be an on-disk compatibility break. Nor does it seem very practical to try to allow some data structures to have more-than-MAXALIGN alignment requirement, as we'd have to push knowledge of that throughout various code that copies data structures around. The only way out of the box is to make type int128 conform to the system's alignment assumptions. Fortunately, gcc supports that via its __attribute__(aligned()) pragma; and since we don't currently support int128 on non-gcc-workalike compilers, we shouldn't be losing any platform support this way. Although we could have just done pg_attribute_aligned(MAXIMUM_ALIGNOF) and called it a day, I did a little bit of extra work to make the code more portable than that: it will also support int128 on compilers without __attribute__(aligned()), if the native alignment of their 128-bit-int type is no more than that of int64. Add a regression test case that exercises the one known instance of the problem, in parallel aggregation over a bigint column. This will need to be back-patched, along with the preparatory commit 91aec93e6. But let's see what the buildfarm makes of it first. Discussion: https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/7518049980be1d90264addab003476ae105f70d4 Modified Files -------------- config/c-compiler.m4 | 9 ++++-- configure | 42 +++++++++++++++++++++++++-- configure.in | 7 +++-- src/include/c.h | 26 +++++++++++++---- src/include/pg_config.h.in | 3 ++ src/include/pg_config.h.win32 | 3 ++ src/test/regress/expected/select_parallel.out | 18 ++++++++++++ src/test/regress/sql/select_parallel.sql | 6 ++++ 8 files changed, 102 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Prevent int128 from requiring more than MAXALIGN alignment. @ 2017-11-14 22:50 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2017-11-14 22:50 UTC (permalink / raw) To: pgsql-committers Prevent int128 from requiring more than MAXALIGN alignment. Our initial work with int128 neglected alignment considerations, an oversight 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 chips sometimes enforce that. Raising MAXALIGN seems out of the question: the costs in wasted disk and memory space would be significant, and there would also be an on-disk compatibility break. Nor does it seem very practical to try to allow some data structures to have more-than-MAXALIGN alignment requirement, as we'd have to push knowledge of that throughout various code that copies data structures around. The only way out of the box is to make type int128 conform to the system's alignment assumptions. Fortunately, gcc supports that via its __attribute__(aligned()) pragma; and since we don't currently support int128 on non-gcc-workalike compilers, we shouldn't be losing any platform support this way. Although we could have just done pg_attribute_aligned(MAXIMUM_ALIGNOF) and called it a day, I did a little bit of extra work to make the code more portable than that: it will also support int128 on compilers without __attribute__(aligned()), if the native alignment of their 128-bit-int type is no more than that of int64. Add a regression test case that exercises the one known instance of the problem, in parallel aggregation over a bigint column. Back-patch of commit 751804998. The code known to be affected only exists in 9.6 and later, but we do have some stuff using int128 in 9.5, so patch back to 9.5. Discussion: https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/619a8c47da7279c186bb57cc16b26ad011366b73 Modified Files -------------- config/c-compiler.m4 | 9 ++++-- configure | 42 +++++++++++++++++++++++++-- configure.in | 7 +++-- src/include/c.h | 26 +++++++++++++---- src/include/pg_config.h.in | 3 ++ src/include/pg_config.h.win32 | 3 ++ src/test/regress/expected/select_parallel.out | 18 ++++++++++++ src/test/regress/sql/select_parallel.sql | 6 ++++ 8 files changed, 102 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Prevent int128 from requiring more than MAXALIGN alignment. @ 2017-11-14 22:50 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2017-11-14 22:50 UTC (permalink / raw) To: pgsql-committers Prevent int128 from requiring more than MAXALIGN alignment. Our initial work with int128 neglected alignment considerations, an oversight 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 chips sometimes enforce that. Raising MAXALIGN seems out of the question: the costs in wasted disk and memory space would be significant, and there would also be an on-disk compatibility break. Nor does it seem very practical to try to allow some data structures to have more-than-MAXALIGN alignment requirement, as we'd have to push knowledge of that throughout various code that copies data structures around. The only way out of the box is to make type int128 conform to the system's alignment assumptions. Fortunately, gcc supports that via its __attribute__(aligned()) pragma; and since we don't currently support int128 on non-gcc-workalike compilers, we shouldn't be losing any platform support this way. Although we could have just done pg_attribute_aligned(MAXIMUM_ALIGNOF) and called it a day, I did a little bit of extra work to make the code more portable than that: it will also support int128 on compilers without __attribute__(aligned()), if the native alignment of their 128-bit-int type is no more than that of int64. Add a regression test case that exercises the one known instance of the problem, in parallel aggregation over a bigint column. Back-patch of commit 751804998. The code known to be affected only exists in 9.6 and later, but we do have some stuff using int128 in 9.5, so patch back to 9.5. Discussion: https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4a15f87d22773ba208c441142ac53ddeb090d1b8 Modified Files -------------- config/c-compiler.m4 | 9 ++++-- configure | 42 +++++++++++++++++++++++++-- configure.in | 7 +++-- src/include/c.h | 26 +++++++++++++---- src/include/pg_config.h.in | 3 ++ src/include/pg_config.h.win32 | 3 ++ src/test/regress/expected/select_parallel.out | 24 +++++++++++++++ src/test/regress/sql/select_parallel.sql | 6 ++++ 8 files changed, 108 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Prevent int128 from requiring more than MAXALIGN alignment. @ 2017-11-14 22:50 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2017-11-14 22:50 UTC (permalink / raw) To: pgsql-committers Prevent int128 from requiring more than MAXALIGN alignment. Our initial work with int128 neglected alignment considerations, an oversight 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 chips sometimes enforce that. Raising MAXALIGN seems out of the question: the costs in wasted disk and memory space would be significant, and there would also be an on-disk compatibility break. Nor does it seem very practical to try to allow some data structures to have more-than-MAXALIGN alignment requirement, as we'd have to push knowledge of that throughout various code that copies data structures around. The only way out of the box is to make type int128 conform to the system's alignment assumptions. Fortunately, gcc supports that via its __attribute__(aligned()) pragma; and since we don't currently support int128 on non-gcc-workalike compilers, we shouldn't be losing any platform support this way. Although we could have just done pg_attribute_aligned(MAXIMUM_ALIGNOF) and called it a day, I did a little bit of extra work to make the code more portable than that: it will also support int128 on compilers without __attribute__(aligned()), if the native alignment of their 128-bit-int type is no more than that of int64. Add a regression test case that exercises the one known instance of the problem, in parallel aggregation over a bigint column. Back-patch of commit 751804998. The code known to be affected only exists in 9.6 and later, but we do have some stuff using int128 in 9.5, so patch back to 9.5. Discussion: https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d4e38489f98a186e1c783efd4844b956cf8d2d4d Modified Files -------------- config/c-compiler.m4 | 9 ++++++--- configure | 42 ++++++++++++++++++++++++++++++++++++++++-- configure.in | 7 +++++-- src/include/c.h | 26 +++++++++++++++++++++----- src/include/pg_config.h.in | 3 +++ src/include/pg_config.h.win32 | 3 +++ 6 files changed, 78 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2017-11-14 22:50 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-11-14 20:04 pgsql: Prevent int128 from requiring more than MAXALIGN alignment. Tom Lane <tgl@sss.pgh.pa.us> 2017-11-14 22:50 pgsql: Prevent int128 from requiring more than MAXALIGN alignment. Tom Lane <tgl@sss.pgh.pa.us> 2017-11-14 22:50 pgsql: Prevent int128 from requiring more than MAXALIGN alignment. Tom Lane <tgl@sss.pgh.pa.us> 2017-11-14 22:50 pgsql: Prevent int128 from requiring more than MAXALIGN alignment. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox