Re: PATCH: add pg_current_xlog_flush_location function

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: PATCH: add pg_current_xlog_flush_location function
Дата
Msg-id 5692D447.2040300@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: PATCH: add pg_current_xlog_flush_location function  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Ответы Re: PATCH: add pg_current_xlog_flush_location function  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: ExecGather() + nworkers
Следующее
От: "Dickson S. Guedes"
Дата:
Сообщение: Apparently deprecated code in planner.c