Re: making the XARessource serializable

Lists: pgsql-jdbc
From: teknokrat <teknokrat(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: making the XARessource serializable
Date: 2007-09-17 09:26:41
Message-ID: fclh8h$q9e$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Is there any reason that the postgresql implementation of XAResource is
not serializable? We are having issues with XARecovery in Arjuna because
of this. What is required to make PGXAConnection serializable?

cheers


From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "teknokrat" <teknokrat(at)yahoo(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: making the XARessource serializable
Date: 2007-09-17 10:18:42
Message-ID: 46EE5482.9060603@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

teknokrat wrote:
> Is there any reason that the postgresql implementation of XAResource is
> not serializable? We are having issues with XARecovery in Arjuna because
> of this. What is required to make PGXAConnection serializable?

PGXAConnection represents a physical connection to the database, so you
certainly can't make that Serializable.

What kind of issues are you having in Arjuna? It can't depend on
serialization of XAResources; there's nothing in the spec saying an
XAResource implementation needs to be serializable, and a quick look at
other DBMS XAResource implementations suggests that they generally aren't.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: teknokrat <teknokrat(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: making the XARessource serializable
Date: 2007-09-17 11:15:33
Message-ID: fclnkm$fms$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Heikki Linnakangas wrote:
> teknokrat wrote:
>> Is there any reason that the postgresql implementation of XAResource is
>> not serializable? We are having issues with XARecovery in Arjuna because
>> of this. What is required to make PGXAConnection serializable?
>
> PGXAConnection represents a physical connection to the database, so you
> certainly can't make that Serializable.
>
> What kind of issues are you having in Arjuna? It can't depend on
> serialization of XAResources; there's nothing in the spec saying an
> XAResource implementation needs to be serializable, and a quick look at
> other DBMS XAResource implementations suggests that they generally aren't.
>

From what i have managed to make out, Arjuna has a xa recovery module
that can recover resources if the XAResource is serializable. Things get
more complicated if its not. I've recompiled the jdbc drivers, making
PGXAConnection serializable and it worked. This is a link illustrating
the behaviour we were getting
http://wiki.jboss.org/wiki/Wiki.jsp?page=TxNonSerializableXAResource


From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "teknokrat" <teknokrat(at)yahoo(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: making the XARessource serializable
Date: 2007-09-17 11:58:18
Message-ID: 46EE6BDA.5020503@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

teknokrat wrote:
> From what i have managed to make out, Arjuna has a xa recovery module
> that can recover resources if the XAResource is serializable. Things get
> more complicated if its not. I've recompiled the jdbc drivers, making
> PGXAConnection serializable and it worked.

What exactly did you do to "make PGXAConnection serializable"? If you
just add "implements Serializable", you'll get an
NotSerializableException when you actually try to serialize it.

> This is a link illustrating
> the behaviour we were getting
> http://wiki.jboss.org/wiki/Wiki.jsp?page=TxNonSerializableXAResource

According to that, you need to provide an implementation of
com.arjuna.ats.jta.recovery.XAResourceRecovery. Apparently there's a
simple implementation that looks up the XADataSource implementation with
JNDI. See JBoss Transaction API Programmers Guide, chapter 4, title
"Shipped XAResourceRecovery implementations".

I'm surprised Arjuna/JBoss doesn't just connect to every database listed
in JNDI, or at least all those that were used in the transactions that
need recovery. That's what other app servers do, I believe.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: teknokrat <teknokrat(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: making the XARessource serializable
Date: 2007-09-17 12:58:53
Message-ID: fcltmc$56s$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Heikki Linnakangas wrote:
> teknokrat wrote:
>> From what i have managed to make out, Arjuna has a xa recovery module
>> that can recover resources if the XAResource is serializable. Things get
>> more complicated if its not. I've recompiled the jdbc drivers, making
>> PGXAConnection serializable and it worked.
>
> What exactly did you do to "make PGXAConnection serializable"? If you
> just add "implements Serializable", you'll get an
> NotSerializableException when you actually try to serialize it.
>

belive or not, thats exactly what i did. I thought that the
BaseConnection instance would stuff things up but it hasn't. No idea why.

>> This is a link illustrating
>> the behaviour we were getting
>> http://wiki.jboss.org/wiki/Wiki.jsp?page=TxNonSerializableXAResource
>
> According to that, you need to provide an implementation of
> com.arjuna.ats.jta.recovery.XAResourceRecovery. Apparently there's a
> simple implementation that looks up the XADataSource implementation with
> JNDI. See JBoss Transaction API Programmers Guide, chapter 4, title
> "Shipped XAResourceRecovery implementations".

yeah, the JDBCXARecovery module. I guess I'll have to llok into that.
The problem for us being that our password can't be in plaintext.

> I'm surprised Arjuna/JBoss doesn't just connect to every database listed
> in JNDI, or at least all those that were used in the transactions that
> need recovery. That's what other app servers do, I believe.
>

that would be good.