pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
XADataSource implementation
5+ messages / 2 participants
[nested] [flat]

* XADataSource implementation
@ 2005-08-28 07:34 Heikki Linnakangas <hlinnaka@iki.fi>
  2005-08-28 10:39 ` Re: XADataSource implementation Oliver Jowett <oliver@opencloud.com>
  2005-09-12 02:00 ` Re: XADataSource implementation Oliver Jowett <oliver@opencloud.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2005-08-28 07:34 UTC (permalink / raw)
  To: pgsql-jdbc; +Cc: Michael Allman <msa@allman.ms>

Hi,

I've been working on the XADataSource implementation. Patch attached. Test case 
is in the separate zip file, because I couldn't get cvs to include it in the 
diff.

I looked at Micheal Allman's implementation, but decided to continue working on 
my original version instead. Michael's implementation was perhaps more 
ambitious, it had more thorough bookkeeping for resource associations and xids. 
Unfortunately there's no straightforward way to implement the full XA interface 
in a spec-compliant way. I did copy some snippets and test cases from Michael's 
code that were useful, though.

Thanks Michael for your hard work, it was a lot of help anyway!

This implementation doesn't try to support transaction interleaving as required 
by the XA spec. Instead, it throws an exception saying it's not supported.

I tested it with the JOnAS application server (after fixing some recovery bugs 
in JOnAS itself :), and it seems to be fine with the limitations. It needs 
testing with other application servers to see if the limitations matter for 
them.

Anyone with access to WebLogic, WebSphere etc: please help! I can send the 
simple servlet I used to test JOnAS if you're interested.

BTW: How does the translation work? What strings need to be translated?

- Heikki

Attachments:

  testcase.zip (application/zip, 2.3K) download

  xadatasource-heikki-20050827.diff.zip (application/zip, 15.4K) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: XADataSource implementation
  2005-08-28 07:34 XADataSource implementation Heikki Linnakangas <hlinnaka@iki.fi>
@ 2005-08-28 10:39 ` Oliver Jowett <oliver@opencloud.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Oliver Jowett @ 2005-08-28 10:39 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnaka@iki.fi>; +Cc: pgsql-jdbc; Michael Allman <msa@allman.ms>

Heikki Linnakangas wrote:

> BTW: How does the translation work? What strings need to be translated?

Usually the only user-visible strings are exception messages. For simple
cases, just wrap the string in a call to org.postgresql.util.GT.tr(). If
there are variable parts to the string, use {0} {1} etc and use the
PSQLException ctor that takes separate substitution values. See the
existing code for examples.

-O



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: XADataSource implementation
  2005-08-28 07:34 XADataSource implementation Heikki Linnakangas <hlinnaka@iki.fi>
@ 2005-09-12 02:00 ` Oliver Jowett <oliver@opencloud.com>
  2005-09-12 20:43   ` Re: XADataSource implementation Heikki Linnakangas <hlinnaka@iki.fi>
  1 sibling, 1 reply; 5+ messages in thread

From: Oliver Jowett @ 2005-09-12 02:00 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnaka@iki.fi>; +Cc: pgsql-jdbc; Michael Allman <msa@allman.ms>

Heikki Linnakangas wrote:
> I've been working on the XADataSource implementation. Patch attached.
> Test case is in the separate zip file, because I couldn't get cvs to
> include it in the diff.

This looks good to me. A few comments:

- we'll need to wrap translatable strings in GT.tr() calls
- there are some places where you compare Xids by identity (==) --
shouldn't these be using .equals()?
- do we really need all of that Base64 encoder/decoder class? Seems like
we could get away with something much more simple.

-O



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: XADataSource implementation
  2005-08-28 07:34 XADataSource implementation Heikki Linnakangas <hlinnaka@iki.fi>
  2005-09-12 02:00 ` Re: XADataSource implementation Oliver Jowett <oliver@opencloud.com>
@ 2005-09-12 20:43   ` Heikki Linnakangas <hlinnaka@iki.fi>
  0 siblings, 0 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2005-09-12 20:43 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc; Michael Allman <msa@allman.ms>

On Mon, 12 Sep 2005, Oliver Jowett wrote:

> Heikki Linnakangas wrote:
>> I've been working on the XADataSource implementation. Patch attached.
>> Test case is in the separate zip file, because I couldn't get cvs to
>> include it in the diff.
>
> This looks good to me. A few comments:
>
> - we'll need to wrap translatable strings in GT.tr() calls

Ok.

> - there are some places where you compare Xids by identity (==) --
> shouldn't these be using .equals()?

Hmm. At those places, the user of the XAResource interface has supplied 
both of the Xids being compared, within the same transaction. In 
principle, I guess you're right. Nothing in the spec says that it's safe 
to assume that the same Xid object is used for start/end/prepare calls. 
I would be very surprised if it didn't work in practice, however.

I'll fix it. Premature optimization is not good..

> - do we really need all of that Base64 encoder/decoder class? Seems like
> we could get away with something much more simple.

Yeah, it's bloated for our purposes. I'll strip out all the gzip stuff 
etc.

Thanks for your comments.

- Heikki



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: XADataSource implementation
@ 2005-09-29 17:43 Heikki Linnakangas <hlinnaka@iki.fi>
  0 siblings, 0 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2005-09-29 17:43 UTC (permalink / raw)
  To: pgsql-jdbc

(Reposting to pgsql-jdbc@postgresql.org, since it haven't shown up yet).

On Mon, 12 Sep 2005, Oliver Jowett wrote:

> Heikki Linnakangas wrote:
>> I've been working on the XADataSource implementation. Patch attached.
>> Test case is in the separate zip file, because I couldn't get cvs to
>> include it in the diff.
> 
> This looks good to me. A few comments:
> 
> - we'll need to wrap translatable strings in GT.tr() calls
> - there are some places where you compare Xids by identity (==) --
> shouldn't these be using .equals()?
> - do we really need all of that Base64 encoder/decoder class? Seems like
> we could get away with something much more simple.

Ok, I finally got around fixing these.

Updated patch can be found at:

http://users.tkk.fi/hlinnaka/pgsql/twophase_jdbc_20050921.diff

I now also tested it with JBoss. It seems that JBoss does utilise transaction 
interleaving by default, which we don't support. However, it can easily be 
turned off by setting the "track-connection-by-tx"-parameter in the datasource 
configuration. The configuration examples also set it for Oracle, MSSQL and 
Facets (what is it, BTW?), so it seems acceptable to me.

- Heikki



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2005-09-29 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-28 07:34 XADataSource implementation Heikki Linnakangas <hlinnaka@iki.fi>
2005-08-28 10:39 ` Oliver Jowett <oliver@opencloud.com>
2005-09-12 02:00 ` Oliver Jowett <oliver@opencloud.com>
2005-09-12 20:43   ` Heikki Linnakangas <hlinnaka@iki.fi>
2005-09-29 17:43 Re: XADataSource implementation Heikki Linnakangas <hlinnaka@iki.fi>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox