Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 15632 invoked from network); 21 Feb 2007 01:50:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Feb 2007 01:50:47 -0000 Received: (qmail 49602 invoked by uid 500); 21 Feb 2007 01:50:49 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 49570 invoked by uid 500); 21 Feb 2007 01:50:49 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 49558 invoked by uid 99); 21 Feb 2007 01:50:48 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Feb 2007 17:50:48 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: 32.97.110.150 is neither permitted nor denied by domain of Stan.Bradbury@gmail.com) Received: from [32.97.110.150] (HELO e32.co.us.ibm.com) (32.97.110.150) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Feb 2007 17:50:35 -0800 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e32.co.us.ibm.com (8.12.11.20060308/8.13.8) with ESMTP id l1L1nRoA025447 for ; Tue, 20 Feb 2007 20:49:27 -0500 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by westrelay02.boulder.ibm.com (8.13.8/8.13.8/NCO v8.2) with ESMTP id l1L1oE3g503786 for ; Tue, 20 Feb 2007 18:50:14 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l1L1oDBE001701 for ; Tue, 20 Feb 2007 18:50:13 -0700 Received: from [127.0.0.1] (bradbury-lt1.usca.ibm.com [9.72.133.177]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l1L1oCI2001653 for ; Tue, 20 Feb 2007 18:50:13 -0700 Message-ID: <45DBA554.10809@gmail.com> Date: Tue, 20 Feb 2007 17:50:12 -0800 From: Stanley Bradbury User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Derby Discussion Subject: Re: Container 2,385 not found References: <000a01c7553d$4895c790$8700a8c0@referentia.com> In-Reply-To: <000a01c7553d$4895c790$8700a8c0@referentia.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Jim Newsham wrote: > > Hi, > > I got a curious error message and was wondering if there was an > explanation for the cause, or if this was due to a bug. This is the > first time I�ve seen it, so I�m not sure how often it occurs. Here is > relevant portion of the stack trace: > > Caused by: java.sql.SQLException: Container 2,385 not found. > > at > org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown > Source) > > at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) > > at > org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown > Source) > > at > org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown > Source) > > at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown > Source) > > at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown > Source) > > at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown > Source) > > at > org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown > Source) > > at > org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown > Source) > > Here is some background on the app and what I was recently doing: > > My application is data-intensive� there are very frequent > transactional inserts and queries from multiple threads. Insert > transactions are largish (several hundred records). I have found that > transactions occasionally time out, perhaps due to concurrent access > and locking, so I have retry logic to handle the failure. The retry > could perhaps use some refining, but currently: when an exception (of > any type) occurs, I log an error message and retry, up to two more > times, with no intervening delay; after that, I give up and log a > stack trace. I occasionally see a logged retry message, but I > typically don�t see failure and a logged stack trace. > > Now, I am in the process of adding functionality to allow the user to > invoke a command to compact the database (derby calls this compress, > but compact seems more appropriate). The compact command calls > syscs_util.syscs_compress_table(schema_name, table_name, 1) for each > table in the database, one at a time. When I invoked this command, a > concurrently running insert transaction failed with the above stack > trace. As described above, I need to fail three times to get the stack > trace, so I can�t be certain what the previous two failures for that > transaction were. I did see logged retries for other insert > transactions, but no stack trace, indicating that those eventually > succeeded. > > Regards, > > Jim Newsham > Hi Jim - I think you have encountered a bug. COMPRESS TABLE should acquire an exclusive lock on the table and not allow any activity against the table until the process is complete. The error you are getting could mean that not everything was ready to go when your insert began. In Derby a database file is referred to as a container - assuming that space is freed by COMPRESS TABLE, empty database files will be removed. The message: Container 2,385 not found. implies (to me, anyway) that a reference to one of the files removed by COMPRESS TABLE was 'found' by your INSERT but subsequent activity (a write to disk?) did NOT file the file thus causing the failure. I am hoping that this is a transient, in-memory problem and does not indicate database corruption but would recommend you run CHECKTABLE to insure that everything cleaned up nicely and not permanent problems exist. Please report this to derby-dev where you can get advice from a Derby developer. I suspect they will ask you to file a JIRA entry - could you provide a test case for this problem?