Hi,

On 12/13/2015 08:38 PM, Tomas Vondra wrote:
Hi,

On 12/13/2015 06:13 AM, Amit Kapila wrote:
 >
...
 >
Is there a reason why you can't use existing function
GetFlushRecPtr() in xlog.c?

No, not really. I think I somehow missed that function when writing
the initial version of the patch. Will fix in v2 of the patch.

Hmm, so I've been looking at this, and I've realized that I've written it like this because that's pretty much what pg_current_xlog_location() does. It calls GetXLogWriteRecPtr which does this:

/*
 * Get latest WAL write pointer
 */
XLogRecPtr
GetXLogWriteRecPtr(void)
{
        SpinLockAcquire(&XLogCtl->info_lck);
        LogwrtResult = XLogCtl->LogwrtResult;
        SpinLockRelease(&XLogCtl->info_lck);

        return LogwrtResult.Write;
}

so the patch does the same thing, except that I've returned "Flush".

OTOH GetFlushRecPtr does this:

XLogRecPtr
GetFlushRecPtr(void)
{
        XLogRecPtr      recptr;

        SpinLockAcquire(&XLogCtl->info_lck);
        recptr = XLogCtl->LogwrtResult.Flush;
        SpinLockRelease(&XLogCtl->info_lck);

        return recptr;
}

i.e. it does not update LogwrtResult, the local private copy. Not sure what's appropriate here ...

regards

--
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to