From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | Andres Freund <andres(at)2ndquadrant(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [COMMITTERS] pgsql: Move WAL continuation record information to WAL page header. |
Date: | 2012-06-27 15:09:46 |
Message-ID: | 4FEB223A.3060707@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
On 27.06.2012 17:53, Andres Freund wrote:
> I had noticed one thing when reviewing the patches before:
>
> @@ -717,6 +719,15 @@ XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata)
> bool doPageWrites;
> bool isLogSwitch = (rmid == RM_XLOG_ID&& info == XLOG_SWITCH);
> uint8 info_orig = info;
> + static XLogRecord *rechdr;
> +
> + if (rechdr == NULL)
> + {
> + rechdr = malloc(SizeOfXLogRecord);
> + if (rechdr == NULL)
> + elog(ERROR, "out of memory");
> + MemSet(rechdr, 0, SizeOfXLogRecord);
> + }
>
> /* cross-check on whether we should be here or not */
> if (!XLogInsertAllowed())
>
> Why do you allocate this dynamically? XLogRecord is 32bytes, there doesn't
> seem to be much point in this?
On 64-bit architectures, the struct needs padding at the end to make the
size MAXALIGNed to 32 bytes; a simple "XLogRecord rechdr" local variable
would not include that. You could do something like:
union
{
XLogRecord rechdr;
char bytes[SizeOfXLogRecord];
}
but that's quite ugly too.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2012-06-27 16:10:31 | Re: [COMMITTERS] pgsql: Move WAL continuation record information to WAL page header. |
Previous Message | Heikki Linnakangas | 2012-06-27 14:54:49 | pgsql: I neglected many comments in the log+seg -> 64-bit segno patch. |
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2012-06-27 15:21:16 | Re: warning handling in Perl scripts |
Previous Message | Heikki Linnakangas | 2012-06-27 14:56:13 | Re: Regarding WAL Format Changes |