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

Attachment: 0002-Don-t-assign-xid-to-logical-decoding-snapshots.patch
Description: invalid/octet-stream

Attachment: 0001-Use-virtual-transaction-instead-of-normal-ones-in-ex.patch
Description: invalid/octet-stream

-- 
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