More 'About Storm'

Stuart Bishop stuart.bishop at canonical.com
Thu Jul 12 06:47:06 BST 2007


Elliot Murphy wrote:

>>  * Distributed database integrity using two-phase commit (if your Python
>> driver and database backend support it).
> 
> Can you tell me about how I would use this? Does it work with postgres?

When you are dealing with multiple databases, your application will often
need to commit changes to more than one of them. So you commit changes to
one, and then attempt to commit changes to another but this second attempt
fails for some reason. You now have data in the first database that is
inconsistent to all the others.

Two-phase commit is the solution databases give us to resolve this situation
(Well, some databases. Others just make you hope the situation never
happens.) Instead of just having a COMMIT, it gives you a 'prepare to be
committed' command. So you iterate over all your databases telling them 'get
ready to commit and give me an error *now* if there is going to be any
problem. If they are all happy, you issue the final commit on all the
backends which is almost certainly guaranteed to work (how certain depends
on how well the feature is implemented, but at a minimum you should have no
trouble with stuff like deferred constraints or conflicts with another
transaction).

PostgreSQL now offers this feature (since 8.2 I think), but it is pretty new
so I don't think any of the Python drivers expose it yet. So no, Storms
two-phase commit is currently just a no-op with PostgreSQL (but as soon as
psycopg or one of the other PostgreSQL database adapters support it, it will
provide the data integrity required for ensuring data integrity over a
cluster of PostgreSQL databases without requiring any sort of proxy like
pgpool-II, and if you are using the API you won't even need to change any code).

For psycopg: http://www.initd.org/tracker/psycopg/ticket/172

Hmm... perhaps that item doesn't belong on the front page - I don't know if
any of the backends Storm currently supports supports it so it could count
almost as vapourware. The API is still relevant though, as it gives a
concrete use for the feature to the driver maintainers.

-- 
Stuart Bishop <stuart.bishop at canonical.com>   http://www.canonical.com/
Canonical Ltd.                                http://www.ubuntu.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/mailman/private/storm/attachments/20070712/2f80e878/attachment.pgp 


More information about the storm mailing list