Skip site navigation (1) Skip section navigation (2)

LSN grouping within clog pages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: LSN grouping within clog pages
Date: 2007-07-27 02:37:45
Message-ID: 6450.1185503865@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
I've been looking at the way that the async-commit patch conserves
shared memory space by remembering async commit LSNs for groups of
transactions on a clog page, rather than having an LSN for each
individual transaction slot.  This seems like a good plan to me,
but I'm confused about one point.  The README text claims that each
LSN represents a contiguous group of transactions, that is, with the
proposed parameters each LSN would represent 256 sequential
transactions.  However, it looks to me that what the code is actually
doing:

#define GetLSNIndex(slotno, xid)    ((slotno) * CLOG_LSNS_PER_PAGE + \
                                     (xid) % (TransactionId) CLOG_XACTS_PER_LSN)

results in transactions that are spaced 256 XIDs apart sharing the same
LSN slot.  I'm not sure whether the code is good and the README is
bogus, or vice versa.  Sharing LSNs among contiguous groups of XIDs
seems appealing because you'd expect that such a group would have
relatively close LSNs, and so not much information is lost.  OTOH, the
modulo idea is interesting too, because if the transaction rate is less
than 256 commits per walwriter cycle, you'd effectively have exact
information for all the currently unflushed transactions.  But the
downside is that transactions that are really quite old might
transiently appear un-hintable because some later transaction that
happens to share that LSN slot isn't flushed yet.  Thoughts?

BTW, I don't think I believe at all the arguments given in the README
about what CLOG_LSNS_PER_PAGE should be, particularly since possible
changes in BLCKSZ weren't factored in.  I'm inclined to set it so
that the LSNs take up the same amount of space as the clog buffers
themselves, ie, BLCKSZ/8 LSNs per page.

			regards, tom lane

Responses

pgsql-hackers by date

Next:From: Satoshi NagayasuDate: 2007-07-27 03:13:36
Subject: Re: stats_block_level
Previous:From: ITAGAKI TakahiroDate: 2007-07-27 01:17:45
Subject: Re: Quick idea for reducing VACUUM contention

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group