Re: [HACKERS] logical replication busy-waiting on a lock

Поиск
Список
Период
Сортировка
От Petr Jelinek
Тема Re: [HACKERS] logical replication busy-waiting on a lock
Дата
Msg-id 8532a452-bc7d-65cd-90d0-5a004c58833e@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] logical replication busy-waiting on a lock  (Andres Freund <andres@anarazel.de>)
Ответы Re: [HACKERS] logical replication busy-waiting on a lock  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On 03/06/17 03:25, Andres Freund wrote:
> 
>> That should solve the original problem reported here.
> 
> Did you verify that?
>

Yes, I tried to manually create multiple exported logical decoding
snapshots in parallel and read data from them and it worked fine, while
it blocked before.

> 
>> @@ -1741,17 +1741,17 @@ GetSerializableTransactionSnapshotInt(Snapshot snapshot,
>>      } while (!sxact);
>>  
>>      /* Get the snapshot, or check that it's safe to use */
>> -    if (!TransactionIdIsValid(sourcexid))
>> +    if (!sourcevxid)
>>          snapshot = GetSnapshotData(snapshot);
>> -    else if (!ProcArrayInstallImportedXmin(snapshot->xmin, sourcexid))
>> +    else if (!ProcArrayInstallImportedXmin(snapshot->xmin, sourcevxid))
>>      {
>>          ReleasePredXact(sxact);
>>          LWLockRelease(SerializableXactHashLock);
>>          ereport(ERROR,
>>                  (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
>>                   errmsg("could not import the requested snapshot"),
>> -               errdetail("The source transaction %u is not running anymore.",
>> -                         sourcexid)));
>> +       errdetail("The source virtual transaction %d/%u is not running anymore.",
>> +                     sourcevxid->backendId, sourcevxid->localTransactionId)));
> 
> Hm, this is a harder to read.  Wonder if we should add a pid field, that'd
> make it a bit easier to interpret?
> 

Agreed, see attached. We have to pass the pid around a bit but I don't
think it's too bad.

One thing I don't like is the GetLastLocalTransactionId() that I had to
add because we clear the proc->lxid before we get to AtEOXact_Snapshot()
but I don't have better solution there.

-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, 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

Вложения

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

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: Re: [HACKERS] logical replication - still unstable after all thesemonths
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: [HACKERS] logical replication - still unstable after all thesemonths