Re: Repeatable Read Isolation in SQL running via background worker - Mailing list pgsql-hackers

From Jeremy Finzel
Subject Re: Repeatable Read Isolation in SQL running via background worker
Date
Msg-id CAMa1XUhrn5PxPSo9M3NPE7dQPyyqCqeC7NV=aTstYFct1_TSKQ@mail.gmail.com
Whole thread Raw
In response to Repeatable Read Isolation in SQL running via background worker  (Jeremy Finzel <finzelj@gmail.com>)
Responses Re: Repeatable Read Isolation in SQL running via background worker  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Thu, Aug 9, 2018 at 4:34 PM, Jeremy Finzel <finzelj@gmail.com> wrote:
I am using worker_spi as a model to run a SQL statement inside a background worker.  From my browsing of the Postgres library, I believe that if I want repeatable read isolation level, the proper way for me to attain this is to add this line after StartTransactionCommand() in worker_spi_main:

XactIsoLevel = XACT_REPEATABLE_READ;

Or - am I mistaken?  Does PushActiveSnapshot already ensure I will get the same snapshot of the data within this transaction?

Can anyone help me if this is accurate or if there are any other gotchas I should be aware of?

The SQL statement will be run every minute for example, and each time with this isolation level.  At least, that is my goal.

Any help is much appreciated.

Thanks,
Jeremy

It seems to be working.  If anyone could provide any feedback though I would be very appreciative.

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: logical decoding / rewrite map vs. maxAllocatedDescs
Next
From: Andres Freund
Date:
Subject: Re: logical decoding / rewrite map vs. maxAllocatedDescs