← Back to team overview

launchpad-dev team mailing list archive

Re: Does our DB retry code need tweaks for the PG 9.1 upgrade?

 

Hi Jeroen,

On Thu, Jun 7, 2012 at 12:50 AM, Jeroen Vermeulen <jtv@xxxxxxxxxxxxx> wrote:
> It's important to tread carefully though.  Consider:
>
>  1. Start transaction.
>  2. Update data in the database.
>  3. Lose connection, and implicitly, abort transaction.
>  4. Restore connection and start new transaction.
>  5. Update more data in the database.
>  6. Commit.
>
> In this scenario, you get a paradox where there's no trace of step 2 in the
> database and yet step 5 has definitely been committed.  So recovering
> connections is not quite as simple as it seems!

Storm raises a DisconnectionError whenever #3 happens and it rolls
back the Store (to clear its internal cache in addition to resetting
the connection).  IOW, your application code gets a clear signal that
#3 happened and needs to be smart enough to redo #2.

Thanks,
J.


References