Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 12198 invoked from network); 3 Aug 2005 16:57:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Aug 2005 16:57:31 -0000 Received: (qmail 25069 invoked by uid 500); 3 Aug 2005 15:10:30 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 25025 invoked by uid 500); 3 Aug 2005 15:10:29 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 25012 invoked by uid 99); 3 Aug 2005 15:10:29 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2005 08:10:29 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=HTML_20_30,HTML_MESSAGE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of msatoor@gmail.com designates 64.233.184.205 as permitted sender) Received: from [64.233.184.205] (HELO wproxy.gmail.com) (64.233.184.205) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2005 08:10:20 -0700 Received: by wproxy.gmail.com with SMTP id i2so149878wra for ; Wed, 03 Aug 2005 08:10:27 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=oBUIwaYg3Iuqy3gatBkK9Xi/bSwMmFnobK6/YpwfMwuI5Sq+kwg7BKQetGblmVJWevH02VIVcR3QQsy00lECwE12yPYTTLz5c5oGzERVyz3Qo7vX3BHfuQWvqdtHuMzAjiQ2Dl9kENXlyMRC4g3k59WqbJTRVMfD8ePfq7Am6vI= Received: by 10.54.56.69 with SMTP id e69mr692609wra; Wed, 03 Aug 2005 08:10:27 -0700 (PDT) Received: by 10.54.146.11 with HTTP; Wed, 3 Aug 2005 08:10:27 -0700 (PDT) Message-ID: Date: Wed, 3 Aug 2005 08:10:27 -0700 From: Mamta Satoor To: Derby Development Subject: XA transactions and state information Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_589_31066933.1123081827077" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_589_31066933.1123081827077 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, From Dan's explanation on Derby-421 (starting an XA transaction resets the= =20 isolation level set with SET CURRENT ISOLATION) about various transaction= =20 states, what I understand is that local transaction and global transaction= =20 have to maintain their own states. I wrote a simple test program to check= =20 this behavior and it seems like Derby is not doing so.=20 My test program gets a XA connection which is part of the local=20 transaction. Derby's default isolation level is CS and that is what the=20 connection object has at this point. I change the isolation level to UR=20 within the local transaction. Now, the XA connection joins a global=20 transaction. I had expected that the isolation level of the connection=20 inside the global transaction would be the default isolation level CS but= =20 that is not the case, instead, it is set to the isolation level UR which is= =20 what the local transaction had it. Within the global transaction, I change= =20 the isolation level to RS and then exit the global transaction so the=20 connection is now attached to the local transaction. The isolation level at= =20 this point is set to RS rather than UR. This seems incorrect. Any comments? Following is the code snippet =20 EmbeddedXADataSource dscsx =3D new EmbeddedXADataSource(); dscsx.setDatabaseName("c:/dellater/db1"); XADataSource dsx =3D dscsx; XAConnection xac =3D dsx.getXAConnection(); con =3D xac.getConnection(); s =3D con.createStatement(); System.out.println("default isolation level should be CS? " +=20 con.getTransactionIsolation()); dumpRS(s.executeQuery("VALUES CURRENT ISOLATION")); System.out.println("change the isolation level with=20 setTransactionIsolation"); con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); System.out.println("new isolation level should be UR? " +=20 con.getTransactionIsolation()); dumpRS(s.executeQuery("VALUES CURRENT ISOLATION")); XAResource xar =3D xac.getXAResource(); Xid xid =3D new cdsXid(1, (byte) 35, (byte) 47); xar.start(xid, XAResource.TMNOFLAGS); s =3D con.createStatement(); System.out.println("isolation level inside global transaction is " +=20 con.getTransactionIsolation()); dumpRS(s.executeQuery("VALUES CURRENT ISOLATION")); System.out.println("change the isolation level inside global transaction=20 with setTransactionIsolation"); con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); System.out.println("new isolation level should be RS? " +=20 con.getTransactionIsolation()); dumpRS(s.executeQuery("VALUES CURRENT ISOLATION")); xar.end(xid, XAResource.TMSUCCESS); xar.rollback(xid); System.out.println("isolation level outside global transaction should be UR= ?=20 " + con.getTransactionIsolation()); dumpRS(s.executeQuery("VALUES CURRENT ISOLATION")); thanks, Mamta ------=_Part_589_31066933.1123081827077 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi,
 
From Dan's explanation on Derby-421 (starting an XA transaction resets= the isolation level set with SET CURRENT ISOLATION) about various tra= nsaction states, what I understand is that local transaction and global tra= nsaction have to maintain their own states. I wrote a simple test program t= o check this behavior and it seems like Derby is not doing so.=20
 
My test program gets a XA connection which is part of the local transa= ction. Derby's default isolation level is CS and that is what the conn= ection object has at this point. I change the isolation level to UR within = the local transaction. Now, the XA connection joins a global transaction. I= had expected that the isolation level of the connection inside the global = transaction would be the default isolation level CS but that is not the cas= e, instead, it is set to the isolation level UR which is what the local tra= nsaction had it. Within the global transaction, I change the isolation leve= l to RS and then exit the global transaction so the connection is now attac= hed to the local transaction. The isolation level at this point is set to R= S rather than UR. This seems incorrect. Any comments?
 
Following is the code snippet

  EmbeddedXADataSource dscsx =3D new EmbeddedXADataSource();  dscsx.setDatabaseName("c:/dellater/db1");
 =  XADataSource dsx =3D dscsx;
  XAConnection xac =3D dsx.g= etXAConnection();
  con =3D xac.getConnection ();
  s =3D con.createStatement();
  System.out.p= rintln("default isolation level should be CS? " + con.getTransact= ionIsolation());
  dumpRS(s.executeQuery("VALUES CURRENT = ISOLATION"));
  System.out.println ("change the isolation level with setTransactionIsolation");
&= nbsp; con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMIT= TED);
  System.out.println("new isolation level should be= UR? " + con.getTransactionIsolation ());
  dumpRS(s.executeQuery("VALUES CURRENT ISOLATION&qu= ot;));

  XAResource xar =3D xac.getXAResource();
  Xid x= id =3D new cdsXid(1, (byte) 35, (byte) 47);
  xar.start(xid, X= AResource.TMNOFLAGS);

  s =3D con.createStatement();
  System.out.print= ln("isolation level inside global transaction is " + con.getTrans= actionIsolation());
  dumpRS(s.executeQuery("VALUES CURRE= NT ISOLATION"));
   System.out.println("change the isolation level inside global transacti= on with setTransactionIsolation");
  con.setTransactionIs= olation(Connection.TRANSACTION_REPEATABLE_READ);
  System.out.= println("new isolation level should be RS? " +=20 con.getTransactionIsolation());
  dumpRS(s.executeQuery("= VALUES CURRENT ISOLATION"));

  xar.end(xid, XAResource.TMSUCCESS);
  xar.rollb= ack(xid);

  System.out.println("isolation level outside global tran= saction should be UR? " + con.getTransactionIsolation());
 &nb= sp;dumpRS(s.executeQuery("VALUES CURRENT ISOLATION"));

thanks,
Mamta
------=_Part_589_31066933.1123081827077--