diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-10-08 01:59:57 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-10-08 01:59:57 +0300 |
commit | 5962519b362d28ef02bc8ec135b9bf9b9a168263 (patch) | |
tree | 4613f765b1710f98ed0ab6efae205027a9368a07 /src/backend/access/transam/xlog.c | |
parent | 81fbbfe3352d3965ee3d8eaafe164b2335c43f72 (diff) | |
download | postgresql-5962519b362d28ef02bc8ec135b9bf9b9a168263.tar.gz postgresql-5962519b362d28ef02bc8ec135b9bf9b9a168263.zip |
TYPEALIGN doesn't work on int64 on 32-bit platforms.
The TYPEALIGN macro, and the related ones like MAXALIGN, don't work with
values larger than intptr_t, because TYPEALIGN casts the argument to
intptr_t to do the arithmetic. That's not a problem when dealing with
pointers or lengths or offsets related to pointers, but the XLogInsert
scaling patch added a call to MAXALIGN with an XLogRecPtr argument.
To fix, add wider variants of the macros, called TYPEALIGN64 and MAXALIGN64,
which are just like the existing variants but work with uint64 instead of
intptr_t.
Report and patch by David Rowley, analysis by Andres Freund.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index fc495d6a62d..06f5eb003cd 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -1482,7 +1482,7 @@ CopyXLogRecordToWAL(int write_len, bool isLogSwitch, XLogRecData *rdata, Assert(written == write_len); /* Align the end position, so that the next record starts aligned */ - CurrPos = MAXALIGN(CurrPos); + CurrPos = MAXALIGN64(CurrPos); /* * If this was an xlog-switch, it's not enough to write the switch record, |