Обсуждение: 2-phase commit

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

2-phase commit

От
richard excite
Дата:
Hello,

Is there any open source implementation of 2-phase commit out there using
Postgres ?
The basic logic says :

MASTER                               SLAVE
------                               ------
begin atomic action
send request 1-n
send "prepare to commit message"
                                     if action_can_be_performed
                                        lock data
                                        store initial state on disk
                                        store request on disk
                                        send "ok" message
                                     else
                                        send "failure" message
if all slaves said "ok"
     send "commit" message
else
     send "rollback" message
Wait for acknowledgements
                                     if master said commit
                                       do work
                                       unlock data

                                     Send "acknowledgement" message


How can I check "action_can_be_performed" (i.e. what conditions satisfy an
"ok" vote ?)
thanks for your time.
-richard





_______________________________________________________
Say Bye to Slow Internet!
http://www.home.com/xinbox/signup.html


Re: 2-phase commit

От
Gilles DAROLD
Дата:
richard excite wrote:

> Hello,
>
> Is there any open source implementation of 2-phase commit out there using
> Postgres ?

I think this is the common implementation of all network interface to
PostgreSQL.
You can use DBI/DBD::Pg for example.

When you pass a query to the backend you can use the return status to commit
or rollback
your transactions... Just wait that all you slaves return their status.

This kind of development can be done in one day with Perl.... but for your
question I don't
know any existing programs doing that.

Regards