Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 14736 invoked from network); 10 Jun 2010 04:24:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Jun 2010 04:24:42 -0000 Received: (qmail 67058 invoked by uid 500); 10 Jun 2010 04:24:42 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 67019 invoked by uid 500); 10 Jun 2010 04:24:39 -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: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 67012 invoked by uid 99); 10 Jun 2010 04:24:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jun 2010 04:24:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jun 2010 04:24:36 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o5A4OEBW024663 for ; Thu, 10 Jun 2010 04:24:14 GMT Message-ID: <8618859.16581276143854231.JavaMail.jira@thor> Date: Thu, 10 Jun 2010 00:24:14 -0400 (EDT) From: "Lily Wei (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-4653) Avoid unnecessary round-trip for commit/rollback in the client driver In-Reply-To: <24948508.21491273652092856.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-4653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Lily Wei updated DERBY-4653: ---------------------------- Attachment: DERBY-4653-6_withflowcommitrollback.diff I was looking at why StatementPoolingTest.test.doTestResultSetCloseorHoldability failure issue. When the first time it gets to this signature, conn.rollback() will flow. At that time CachingLoginalConnection40.physicalConnection_.isUnitofWork_ is false which is expected. However, when it gets to conn.close() which call StatementCacheInteractor.closeOpenLogicalStatements line 224 logicalStatement.close() the variable isUnitofWork_ become true. I am not familiar with closeOpenLogicalStatements synchronized method. Does this only get change in some sort of multi-thread situation? When StatementPoolingTest get to doTestResultSetCloseorHoldability() the second time, the variable of physicalConnection_.isUnitofWork_ remains false when close are completely done. What need to change so we can rely on isUnitofWork_ to be the flag to decide whether we can flow rollback or not? > Avoid unnecessary round-trip for commit/rollback in the client driver > --------------------------------------------------------------------- > > Key: DERBY-4653 > URL: https://issues.apache.org/jira/browse/DERBY-4653 > Project: Derby > Issue Type: Improvement > Components: JDBC, Network Client > Affects Versions: 10.7.0.0 > Reporter: Kristian Waagan > Assignee: Lily Wei > Priority: Minor > Attachments: _sds_0, DERBY-4653-1.diff, DERBY-4653-2.diff, DERBY-4653-3_withrollback.diff, DERBY-4653-4_withcommitrollbacktest.diff, DERBY-4653-5_withflowcommitrollback.diff, DERBY-4653-6_withflowcommitrollback.diff, SaveRoundClientDS.java, SaveRoundClientDS.java > > > The methods Connection.commit() and Connection.rollback() in the client driver cause a round-trip to the server even if the commit/rollback is unnecessary (i.e. there is nothing to commit or roll back). > Comments suggest (see below) that this can be optimized, such that the commands are flowed to the server only when required. It can be seen that this optimization has been used other places in the client driver. Never the less, it must be checked that this optimization doesn't have side-effects. > This issue came up in connection with connection pooling, where a pool implementation always issued a rollback to make sure there was no active transaction on the connection handed out. > From Connection.flowCommit: > // Per JDBC specification (see javadoc for Connection.commit()): > // "This method should be used only when auto-commit mode has been disabled." > // However, some applications do this anyway, it is harmless, so > // if they ask to commit, we could go ahead and flow a commit. > // But note that rollback() is less harmless, rollback() shouldn't be used in auto-commit mode. > // This behavior is subject to further review. > // if (!this.inUnitOfWork) > // return; > // We won't try to be "too smart", if the user requests a commit, we'll flow a commit, > // regardless of whether or not we're in a unit of work or in auto-commit mode. > // -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.