Lists: | pgsql-hackers |
---|
From: | Jim Nasby <jim(at)nasby(dot)net> |
---|---|
To: | pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Confusing comment in TransactionIdIsInProgress |
Date: | 2011-01-18 05:15:59 |
Message-ID: | 60BA971A-52A4-4A11-9AA1-0839BB6F15A3@nasby.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Shouldn't the comment read "If first time through"?
/*
* If not first time through, get workspace to remember main XIDs in. We
* malloc it permanently to avoid repeated palloc/pfree overhead.
*/
if (xids == NULL)
{
...
xids = (TransactionId *) malloc(maxxids * sizeof(TransactionId));
--
Jim C. Nasby, Database Architect jim(at)nasby(dot)net
512.569.9461 (cell) http://jim.nasby.net
From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | Jim Nasby <jim(at)nasby(dot)net> |
Cc: | pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Confusing comment in TransactionIdIsInProgress |
Date: | 2011-01-18 08:51:44 |
Message-ID: | 4D3554A0.5040205@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 18.01.2011 07:15, Jim Nasby wrote:
> Shouldn't the comment read "If first time through"?
>
> /*
> * If not first time through, get workspace to remember main XIDs in. We
> * malloc it permanently to avoid repeated palloc/pfree overhead.
> */
> if (xids == NULL)
> {
> ...
> xids = (TransactionId *) malloc(maxxids * sizeof(TransactionId));
Huh, yes, I'm amazed that no-one have noticed. I must've read that piece
of code dozens of times in the last couple of years myself, and that
sentence was even copy-pasted to GetConflictingVirtualXIDs() later in
that file, including that thinko.
Thanks, fixed both copies.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
---|---|
To: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
Cc: | Jim Nasby <jim(at)nasby(dot)net>, pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Confusing comment in TransactionIdIsInProgress |
Date: | 2011-01-19 10:06:09 |
Message-ID: | 1295431569.3282.8710.camel@ebony |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, 2011-01-18 at 10:51 +0200, Heikki Linnakangas wrote:
> On 18.01.2011 07:15, Jim Nasby wrote:
> > Shouldn't the comment read "If first time through"?
> >
> > /*
> > * If not first time through, get workspace to remember main XIDs in. We
> > * malloc it permanently to avoid repeated palloc/pfree overhead.
> > */
> > if (xids == NULL)
> > {
> > ...
> > xids = (TransactionId *) malloc(maxxids * sizeof(TransactionId));
>
> Huh, yes, I'm amazed that no-one have noticed. I must've read that piece
> of code dozens of times in the last couple of years myself, and that
> sentence was even copy-pasted to GetConflictingVirtualXIDs() later in
> that file, including that thinko.
Yes, I laughed when I saw that, having camped out in that code many
nights.
--
Simon Riggs http://www.2ndQuadrant.com/books/
PostgreSQL Development, 24x7 Support, Training and Services