pgsql: Allow SetHintBits() to succeed if the buffer's LSN is new enough

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow SetHintBits() to succeed if the buffer's LSN is new enough
Date: 2016-02-15 22:01:12
Message-ID: E1aVRCi-0004t8-CH@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow SetHintBits() to succeed if the buffer's LSN is new enough.

Previously we only allowed SetHintBits() to succeed if the commit LSN of
the last transaction touching the page has already been flushed to
disk. We can't generally change the LSN of the page, because we don't
necessarily have the required locks on the page. But the required LSN
interlock does not mean the commit record has to be flushed immediately,
it just requires that the commit record will be flushed before the page is
written out. Therefore if the buffer LSN is newer than the commit LSN,
the hint bit can be safely set.

In a number of scenarios (e.g. pgbench) this noticeably increases the
number of hint bits are set. But more importantly it also keeps the
success rate up when flushing WAL less frequently. That was the original
reason for commit 4de82f7d7, which has negative performance consequences
in a number of scenarios. This will allow a followup commit to reduce
the flush rate.

Discussion: 20160118163908(dot)GW10941(at)awork2(dot)anarazel(dot)de

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/db76b1efbbab2441428a9ef21f7ac9ba43c52482

Modified Files
--------------
src/backend/utils/time/tqual.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-02-15 22:12:25 pgsql: Suppress compiler warnings about useless comparison of unsigned
Previous Message Tom Lane 2016-02-15 21:29:26 Re: Re: [COMMITTERS] pgsql: Add some isolation tests for deadlock detection and resolution.