Обсуждение: SerializableSnapshot removed from postgresql 8.4

Поиск
Список
Период
Сортировка

SerializableSnapshot removed from postgresql 8.4

От
Duarte Fonseca
Дата:
Hi list,

I'm currently upgrading from Postgresql 8.1 to 8.4 one of the steps of the process for me involves compiling the
replicationtoolkit we use against 8.4. 

I've just run into a problem since this replication code references SerializableSnapshot which as been removed in 8.4,
iwas wondering what should our code use instead, I found a thread[1] in the hackers mailing list where
GetActiveSnapshot()was recommended, i would greatly appreciate it if someone could point me in the right direction on
this.


The code in question goes something like:

if (SerializableSnapshot == NULL)
    elog(ERROR, "SerializableSnapshot is NULL ");

// Return the minxid from the current snapshot
PG_RETURN_TRANSACTIONID(SerializableSnapshot->xmin);

Thanks,

[1] - http://archives.postgresql.org/pgsql-hackers/2008-04/msg01556.php
--
Duarte Fonseca






Re: SerializableSnapshot removed from postgresql 8.4

От
Jeff Davis
Дата:
On Wed, 2011-07-13 at 18:10 +0100, Duarte Fonseca wrote:
> Hi list,
>
> I'm currently upgrading from Postgresql 8.1 to 8.4 one of the steps of the process for me involves compiling the
replicationtoolkit we use against 8.4. 
>
> I've just run into a problem since this replication code references SerializableSnapshot which as been removed in
8.4,i was wondering what should our code use instead, I found a thread[1] in the hackers mailing list where
GetActiveSnapshot()was recommended, i would greatly appreciate it if someone could point me in the right direction on
this.
>
>
> The code in question goes something like:
>
> if (SerializableSnapshot == NULL)
>     elog(ERROR, "SerializableSnapshot is NULL ");
>
> // Return the minxid from the current snapshot
> PG_RETURN_TRANSACTIONID(SerializableSnapshot->xmin);

I believe that equivalent code in 8.4 would look something like:

if (!IsXactIsoLevelSerializable || !ActiveSnapshotSet())
  elog(ERROR, "Could not find serializable snapshot");

PG_RETURN_TRANSACTIONID(GetActiveSnpashot()->xmin);


However, be careful! Some of this code changes again in 9.1. In 9.1, you
probably want to look for the "repeatable read" transaction.

Regards,
    Jeff Davis



Re: SerializableSnapshot removed from postgresql 8.4

От
Duarte Fonseca
Дата:
Thanks Jeff, that seems to have done it.

We are still evaluating the move to 8.4 and have no plans to move on to 9.x at the moment but I'll keep those changes
inmind. 

cheers,


On 13 Jul 2011, at 19:33, Jeff Davis wrote:

> On Wed, 2011-07-13 at 18:10 +0100, Duarte Fonseca wrote:
>> Hi list,
>>
>> I'm currently upgrading from Postgresql 8.1 to 8.4 one of the steps of the process for me involves compiling the
replicationtoolkit we use against 8.4. 
>>
>> I've just run into a problem since this replication code references SerializableSnapshot which as been removed in
8.4,i was wondering what should our code use instead, I found a thread[1] in the hackers mailing list where
GetActiveSnapshot()was recommended, i would greatly appreciate it if someone could point me in the right direction on
this.
>>
>>
>> The code in question goes something like:
>>
>> if (SerializableSnapshot == NULL)
>>    elog(ERROR, "SerializableSnapshot is NULL ");
>>
>> // Return the minxid from the current snapshot
>> PG_RETURN_TRANSACTIONID(SerializableSnapshot->xmin);
>
> I believe that equivalent code in 8.4 would look something like:
>
> if (!IsXactIsoLevelSerializable || !ActiveSnapshotSet())
>  elog(ERROR, "Could not find serializable snapshot");
>
> PG_RETURN_TRANSACTIONID(GetActiveSnpashot()->xmin);
>
>
> However, be careful! Some of this code changes again in 9.1. In 9.1, you
> probably want to look for the "repeatable read" transaction.
>
> Regards,
>     Jeff Davis
>
>

Duarte Fonseca
dfonseca@identitynetworks.com