Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9F352633F8A for ; Thu, 30 Jul 2009 19:18:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 71061-03 for ; Thu, 30 Jul 2009 22:18:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.250]) by mail.postgresql.org (Postfix) with ESMTP id 775ED633B86 for ; Thu, 30 Jul 2009 19:18:45 -0300 (ADT) Received: by an-out-0708.google.com with SMTP id c3so933708ana.28 for ; Thu, 30 Jul 2009 15:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=HjbNTcbhlNP+/ZB0RgBbZj8GH7HGRJwHeuCv0KuYqoQ=; b=DFKWsA7JwXx5jTLdAxOjRzls8G1F4tzrvAT1zoYR4HOgUjQfI5O5HSRxuk9WEeUZQR 1M9GZwMNmkdpY0DxYpqLTiJmYXAix7tDnKgqMBkEhbaS6Tfr1i6aXjARjcaM6sm/P43z UvMsv9lV6vnHFCX7AFi5TEA1mQPpr2ejvHYd8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=rFwNzKxJB+T7zJ0ATN1s4T5BTkK7LyeN9cZ3rYPFv4QnrpTlqVtQ0IfVG0wfe78pRO O9M+Hw4MzFlh9Bf7w599xXlofiDiu6tTv8b3wb26gW8bvh3o/IXq+9oxTlftYXLtkYxC LMNZm6rtB2vLcg/xCSqmEDemjD8VqzGiukK2U= MIME-Version: 1.0 Received: by 10.101.70.14 with SMTP id x14mr1267404ank.78.1248992324141; Thu, 30 Jul 2009 15:18:44 -0700 (PDT) Date: Thu, 30 Jul 2009 15:18:44 -0700 Message-ID: Subject: Request to check isolation level before throwing exception From: Ben Weber To: pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=0016369fa251cec40d046ff3af70 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=-10 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200907/81 X-Sequence-Number: 19849 --0016369fa251cec40d046ff3af70 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit I am using atomikos 3.5.6. with Postgres 8.4 and have ran into the following problem: Cannot change transaction isolation level in the middle of a transaction. Due to the way that Atomikos manages the Pool of XA connections, I cannot prevent setTransactionIsolation from being called in the middle of transactions. I would like to propose a simple fix for this issue. The setTransactionIsolation method should check the current isolation level before throwing an exception. Proposed fix in AbstractJdbc2Connection.java: public void setTransactionIsolation(int level) throws SQLException { // check current level before proceeding if (level == getTransactionIsolation()) { return; } ...... } I have tested this patch in my environment and it fixed the problem. Is it possible to get this change committed to the main build? Thanks, Ben Weber --0016369fa251cec40d046ff3af70 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I am using atomikos 3.5.6. with Postgres 8.4 and have ran into the followin= g problem: Cannot change transaction isolation level in the middle of a tra= nsaction. Due to the way that Atomikos manages the Pool of XA connections, = I cannot prevent setTransactionIsolation from being called in the middle of= transactions. I would like to propose a simple fix for this issue. The set= TransactionIsolation method should check the current isolation level before= throwing an exception.

Proposed fix in AbstractJdbc2Connection.java:

public void setTra= nsactionIsolation(int level) throws SQLException
{

=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 // check current level before proceeding
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (level =3D=3D getTransactionIsolati= on()) {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return;<= br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }

=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ......

}


I have tested this patch in my envi= ronment and it fixed the problem. Is it possible to get this change committ= ed to the main build?

Thanks,
Ben Weber
--0016369fa251cec40d046ff3af70--