Return-Path: X-Original-To: apmail-cloudstack-dev-archive@www.apache.org Delivered-To: apmail-cloudstack-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8953510D80 for ; Thu, 17 Oct 2013 20:00:25 +0000 (UTC) Received: (qmail 83168 invoked by uid 500); 17 Oct 2013 20:00:24 -0000 Delivered-To: apmail-cloudstack-dev-archive@cloudstack.apache.org Received: (qmail 82955 invoked by uid 500); 17 Oct 2013 20:00:24 -0000 Mailing-List: contact dev-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list dev@cloudstack.apache.org Received: (qmail 82947 invoked by uid 99); 17 Oct 2013 20:00:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2013 20:00:23 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of trippie@gmail.com designates 209.85.215.169 as permitted sender) Received: from [209.85.215.169] (HELO mail-ea0-f169.google.com) (209.85.215.169) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2013 20:00:18 +0000 Received: by mail-ea0-f169.google.com with SMTP id k11so1372869eaj.14 for ; Thu, 17 Oct 2013 12:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:from:content-type:in-reply-to:message-id:date:to :content-transfer-encoding:mime-version; bh=IYG7Vko3bgJc3IpF7OMX9lMc6g07nMmcKc4EOdAOfXA=; b=nhsIICJIEQFBvkl0gELZfdOXazdspFF9LCGjIslVLrx+rFAZvZ0+RwOdi2BisB/nfD RakkJ3ax4tyrysUCN74A1pxlF+bGRyw/O/e4rVGQDfyWJJMT8X6RdEaEUzI56Sr3fz15 knFA4m6ZiR0rV9NiL3XztCxeNFFj1zU8FDPwPGE7hSqZvkbx0/9QIIakIzuPjLMLyY7i ooy9U7gGdca2itaTnmYPCI4DL9PB9jptlIx1l1IGByIoyp9uveherFn9Ya/ys+Npl10q e3L8RdCsL44dUOlKa9XkFpQdR9GNgGVme4cgeYGtr9QPQxTSeTJx72W5zVRUUd2BFgsv /5JQ== X-Received: by 10.15.32.7 with SMTP id z7mr5679528eeu.78.1382039997225; Thu, 17 Oct 2013 12:59:57 -0700 (PDT) Received: from [192.168.168.103] (53532F3A.cm-6-4a.dynamic.ziggo.nl. [83.83.47.58]) by mx.google.com with ESMTPSA id u46sm18719951eep.17.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Oct 2013 12:59:56 -0700 (PDT) Subject: Re: [MERGE] txn-refactor References: <2AD0D256-8418-4E6E-B5DE-FA456D18EC06@GMAIL.com> <84B0AECD-80EE-480E-AAA6-E3E769430B0C@GMAIL.com> <52602889.2080801@gmail.com> From: Hugo Trippaers Content-Type: text/plain; charset=us-ascii X-Mailer: iPhone Mail (11A501) In-Reply-To: <52602889.2080801@gmail.com> Message-Id: <2473D6CF-0FB9-4E1C-A9CA-C87691874A3C@gmail.com> Date: Thu, 17 Oct 2013 21:59:54 +0200 To: "dev@cloudstack.apache.org" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) X-Virus-Checked: Checked by ClamAV on apache.org Sent from my iPhone > On 17 okt. 2013, at 20:12, Darren Shepherd w= rote: >=20 >> On 10/17/2013 01:53 AM, Hugo Trippaers wrote: >> Hey Darren, >>=20 >> Looking through the code it looks like this more an API change than an ac= tual redesign of the transaction code? I like the resulting code a lot bette= r than the existing way of doing it. As far as i can see you wrapped the exi= sting TransactionLegacy way of doing it (txn.start / txn.commit) inside of t= he new Transaction functions execute and executeWithException. So if i under= stand it correctly, nothing changed in how transactions are actually handled= , except that the code can now be easily changed to use spring TX. >>=20 > Yes the purpose of this is to introduce a new API that will be compatible w= ith Spring TX. The internals are all still custom ACS transaction. This is= why I'm comfortable with this change, because nothing changed too much. Nice, that also makes it a lot easier to review the changes! >=20 > But know I do need to make this change because I found that people were in= consistently using the old API and it was causing problems with the spring m= odularization branch. In the spring modularization branch I've moved the AO= P logic for the transactions from custom ACS AOP to Spring AOP which has a s= lightly different semantics. >=20 > Also note I found tons of bugs in the transaction handling while doing thi= s. Having the anonymous class style has made error handling more consistent= . But, there a tons of places that people are catching Throwable/Exception w= here they shouldn't. That's a different discussion, I need to put together s= ome thoughts on more consistent error handling in ACS. >=20 >> Also you made that changes to a couple of classes to use the new api, but= the majority of the classes still need to be done. It might be nice to anno= tate the TransactionLegacy class with @Deprecated so we can easily identify w= hat needs to be done? >=20 > I updated all of the management non-DAO code. AWS, Usage and DAOs are sti= ll using the old API. I didn't touch DAOs because its not worth it in my mi= nd. DAOs should move to declarative transaction managment which will mean b= asically the whole method will be under a transactions. So I didn't want to= convert the code to the anonymous class style, and then when I do declarati= ve transactions go and change all the DAOs again. Sounds like a solid approach. Works for me. >=20 > I don't know if I want to actually put @Deprecated on TransactionLegacy ye= t because there are things you can do with it that you can't do in the new A= PI. Namely, prepared statements and switching databases. Maybe just mark start() as deprecated then. Would at least put a marker for a= nybody writing new code that they should think again about using it. >=20 >>=20 >> The new code is not covered by any new unit test yet? I couldn't check th= e cobertura result yet as there are some build and test failures. Can you ha= ve a look at this build : http://jenkins.buildacloud.org/job/cloudstack-mave= n-build-with-branch-parameter/3/. You can kick off that job yourself from j= enkins if you like to do the full test. Didn't do the noredist build test ye= t as the normal build failed. >>=20 >=20 > I can write a unit test that tests the new code. I started by altering th= e existing transaction unit test, but then later figured out they don't work= and are not being ran as part of the build. So I just did a bunch of manua= l testing. A unit test would be really nice to have for this piece of code. Especially n= ow we know there will be changes is this area for some time to come. The DB l= ayer is at the core of CloudStack so a test is a real requirement here. I kn= ow there is a bunch of stuff disabled, we decided long ago to fix those test= s when we would touch that bit of code, and you just hit the jackpot ;-) Did you have a look at the build link? The current build for your branch app= ears broken. One test failure and a compile error as far as I can tell. >=20 > Darren Cheers, Hugo=