[storm] Storm DB Disconnection/Reconnection

James Henstridge james at jamesh.id.au
Wed Jun 11 01:46:17 BST 2008


2008/6/11 Alex Richardson <alexrichardson at gmail.com>:
> I have noticed that in my application, (using Storm with MySql), that
> eventually my database connection seems to die. I did seem reading and
> noticed that it looks like there has been some ongoing work/discussion
> on how Storm could behave. For my usage, it would be nice to have teh
> database automatically reconnect.
>
> If I understand correctly, the reason Storm doesn't automatically
> reconnect is due to concern that any transaction that was in place
> before the connection failure would be aborted transparently? Are
> there other issues?
>
> Are there any good patterns for managing the disconnection issue fro a
> central facility? I am trying to avoid wrapping every use of a Storm
> object with a piece of reconnection code.....
>
> Also, as I do not rely on transaction support, is there any easy way
> to re-enable automatic reconnection?

If you do see a disconnection, the store will automatically reconnect
on the next transaction (i.e. after you call store.rollback()).  At
that point you can retry the work you were doing.  You can detect
disconnections by catching Storm's DisconnectionError exception.

Note that any work you were doing in a pending transaction when the
disconnection occurred has been lost, and Storm won't be able to get
it back for you.  Reconnecting anywhere other than on transaction
boundaries would lead to bugs where code built on top of Storm thought
it was performing a sequence of actions atomically, but the database
only sees the second half of the actions (due to the first half being
lost to a separate aborted transaction).

James.



More information about the storm mailing list