Subject Re: [Firebird-devel] external data sources
Author Roman Rokytskyy
> Any proposal? Currently I have two options in my mind:

After some thinking I came to conclusion that we try to approach the
problem from the wrong end.

It is clear that for distributed transaction we need some coordinator.
I believe that we falsely have assumed that Firebird will also act as
distributed transaction coordinator. In general this is wrong,
Firebird is just another resource manager enlisted in distributed
transaction.

So, my suggestion to the problem with external datasources is the
following:

- we implement approach a) for "lightweight" cases.
- for really distributed cases we make Firebird XA-compatible. I do
not know what does it mean for C/C++ applications, for Java
applications it means :
- internal transactions are mapped to a global one which is
identified by Xid.
- resource manager provides methods described in b) that takes Xid
as parameter.

For Firebird that would mean:

- we have to provide internal mapping between Xid and isc_tr_handle
(pretty easy thing);

- we have to provide implementation of the above mentioned methods
(also easy thing from my point of view);

- for each external procedure we provide access to Xid corresponding
to the distributed transaction in context of which this procedure is
executed. It is responsibility of the procedure (or more correctly,
external datasource resource manager) to allocate connection and
enlist it in the global transaction. Rest of the transaction handling
logic will be handled by external distributed transaction coordinator.

Opinions?

Roman