pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Confusing comment in TransactionIdIsInProgress
3+ messages / 3 participants
[nested] [flat]

* Confusing comment in TransactionIdIsInProgress
@ 2011-01-18 05:15 Jim Nasby <jim@nasby.net>
  2011-01-18 08:51 ` Re: Confusing comment in TransactionIdIsInProgress Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Jim Nasby @ 2011-01-18 05:15 UTC (permalink / raw)
  To: 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@nasby.net
512.569.9461 (cell)                         http://jim.nasby.net





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Confusing comment in TransactionIdIsInProgress
  2011-01-18 05:15 Confusing comment in TransactionIdIsInProgress Jim Nasby <jim@nasby.net>
@ 2011-01-18 08:51 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2011-01-19 10:06   ` Re: Confusing comment in TransactionIdIsInProgress Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Heikki Linnakangas @ 2011-01-18 08:51 UTC (permalink / raw)
  To: Jim Nasby <jim@nasby.net>; +Cc: 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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Confusing comment in TransactionIdIsInProgress
  2011-01-18 05:15 Confusing comment in TransactionIdIsInProgress Jim Nasby <jim@nasby.net>
  2011-01-18 08:51 ` Re: Confusing comment in TransactionIdIsInProgress Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
@ 2011-01-19 10:06   ` Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Simon Riggs @ 2011-01-19 10:06 UTC (permalink / raw)
  To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; +Cc: Jim Nasby <jim@nasby.net>; 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
 




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-01-19 10:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-01-18 05:15 Confusing comment in TransactionIdIsInProgress Jim Nasby <jim@nasby.net>
2011-01-18 08:51 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-01-19 10:06   ` Simon Riggs <simon@2ndQuadrant.com>

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