Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 84658 invoked from network); 6 Apr 2010 18:11:55 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Apr 2010 18:11:55 -0000 Received: (qmail 80469 invoked by uid 500); 6 Apr 2010 18:11:55 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 80442 invoked by uid 500); 6 Apr 2010 18:11:55 -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 80435 invoked by uid 99); 6 Apr 2010 18:11:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Apr 2010 18:11:55 +0000 X-ASF-Spam-Status: No, hits=-1231.5 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Apr 2010 18:11:54 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 79975234C48C for ; Tue, 6 Apr 2010 18:11:33 +0000 (UTC) Message-ID: <392404823.20381270577493497.JavaMail.jira@brutus.apache.org> Date: Tue, 6 Apr 2010 18:11:33 +0000 (UTC) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-4607) HeapScan test commits wrong connection In-Reply-To: <145989465.3241270543173690.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-4607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen updated DERBY-4607: -------------------------------------- Attachment: commit.diff Attached is a patch that makes setUp() initialize the select statement with the helper method BaseJDBCTestCase.prepareStatement() in HeapScan and its sub-class CoveredIdxScan. The helper method uses the getConnection() method to obtain the connection, so now the calls to getConnection().commit() commit on the correct connection. Using the helper method also removes the need to close the statement explicitly in tearDown(). Also, getConnection().commit() was simplified to commit() (helper in BaseJDBCTestCase) which does the same thing. The patch doesn't appear change the results of the tests in any noticeable way. This is as expected, since there shouldn't be much work required on commit for read-only transactions with read committed isolation level (no log records to flush, and all locks should have been released prior to commit). > HeapScan test commits wrong connection > -------------------------------------- > > Key: DERBY-4607 > URL: https://issues.apache.org/jira/browse/DERBY-4607 > Project: Derby > Issue Type: Bug > Components: Test > Affects Versions: 10.6.0.0 > Reporter: Knut Anders Hatlen > Assignee: Knut Anders Hatlen > Priority: Minor > Attachments: commit.diff > > > The SELECT query in HeapScan is initialized like this: > select = openDefaultConnection().prepareStatement("SELECT * FROM "+tableName); > The test cases commit the transaction like this: > getConnection().commit(); > openDefaultConnection() opens and returns a new connection to the default database, whereas getConnection() returns a cached default connection, so the two connections are not the same, and the transaction that's being committed is not the executing transaction. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.