Re: two-phase commit / distributed transaction

2016-12-02 Thread Mateusz Mikołajczyk
If anybody is interested, I created a proof of concept code for PostgreSQL which extends existing Atomic context: https://github.com/toudi/django-tpc-proof-of-concept the actual implementation can be found inside tpc/atomic_tpc.py and there are two commands available: ./manage.py prepare

Re: two-phase commit / distributed transaction

2016-12-02 Thread Aymeric Augustin
Hello, To be honest I’m pessimistic about the feasibility of emulating transactional behavior — pretty much the most complicated and low level thing databases do — in the application. I don’t think that would be considered suitable for Django. Usually Django handles such cases with a database

Re: two-phase commit / distributed transaction

2016-12-02 Thread Mateusz Mikołajczyk
Well, I suppose that it would either lead to very obfuscated implementation code, or very weird syntax (client code). As for your first argument ( promise that the transaction is unlikely to fail ): from django.db import distributed: with distributed('foo') as foo:

Re: two-phase commit / distributed transaction

2016-12-02 Thread Patryk Zawadzki
W dniu piątek, 2 grudnia 2016 12:05:11 UTC+1 użytkownik Mateusz Mikołajczyk napisał: > > What would you say about checking which CRUD operations were executed > within atomic() call (in order to serialize them and save into a special > model for databases which don't support this functionality)

Re: two-phase commit / distributed transaction

2016-12-02 Thread Mateusz Mikołajczyk
What would you say about checking which CRUD operations were executed within atomic() call (in order to serialize them and save into a special model for databases which don't support this functionality) ? Is it realistic? What I mean by that is that when you do: from django.db import

Re: two-phase commit / distributed transaction

2016-12-01 Thread Florian Apolloner
On Thursday, December 1, 2016 at 2:04:53 PM UTC+1, Aymeric Augustin wrote: > > The person who will write and test that code has all my sympathy :-) > I'll second that, I have no idea how Aymeric managed to keep his sanity while rewriting the transaction code :D -- You received this message

Re: two-phase commit / distributed transaction

2016-12-01 Thread Aymeric Augustin
> On 1 Dec 2016, at 13:29, Shai Berger wrote: > > On Thursday 01 December 2016 13:52:41 Aymeric Augustin wrote: >> >> I’m proposing a separate context manager because I’m worried about >> increasing again the complexity of transaction.atomic. There will be a >> significant

Re: two-phase commit / distributed transaction

2016-12-01 Thread Shai Berger
On Thursday 01 December 2016 13:52:41 Aymeric Augustin wrote: > > I’m proposing a separate context manager because I’m worried about > increasing again the complexity of transaction.atomic. There will be a > significant amount of duplication between the two implementations, though. > I believe

Re: two-phase commit / distributed transaction

2016-12-01 Thread Aymeric Augustin
Hello, Currently you cannot do this: from django.db import connection connection.xid() # or any other TPC method Adding implementations of TPC methods in BaseDatabaseWrapper() that simply forward to the underlying connection object is the first step for a database agnostic implementation in