Re: minor fix in CancelVirtualTransaction

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: minor fix in CancelVirtualTransaction
Дата
Msg-id c80a4866-00fc-b012-9b77-80c3e7e69be8@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: minor fix in CancelVirtualTransaction  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: minor fix in CancelVirtualTransaction  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
On 06/12/2018 21:37, Alvaro Herrera wrote:
> When scanning the list of virtual transactions looking for one
> particular vxid, we cancel the transaction *and* break out of the loop
> only if both backendId and localTransactionId matches us.  The canceling
> part is okay, but limiting the break to that case is pointless: if we
> found the correct backendId, there cannot be any other entry with the
> same backendId.  Rework the loop so that we break out of it if backendId
> matches even if the localTransactionId part doesn't.

Your reasoning seems correct to me.

Maybe add a code comment along the lines of "once we have found the
right ... we don't need to check the remaining ...".

Or, you can make this even more clear by comparing the backendId
directly with the proc entry:

if (vxid.backendId == proc->backendId)
{
    if (vxid.localTransactionId == proc->lxid)
    {

    }
    break;
}

Then the logic your are trying to achieve would be obvious.

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


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [PATCH] Pass COPT and PROFILE to CXXFLAGS as well
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Feature: triggers on materialized views