Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 26386 invoked from network); 17 Jun 2005 20:17:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Jun 2005 20:17:59 -0000 Received: (qmail 96876 invoked by uid 500); 17 Jun 2005 20:17:58 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 96833 invoked by uid 500); 17 Jun 2005 20:17:57 -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 96812 invoked by uid 99); 17 Jun 2005 20:17:57 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from over.ny.us.ibm.com (HELO over.ny.us.ibm.com) (32.97.182.150) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jun 2005 13:17:48 -0700 Received: from e3.ny.us.ibm.com ([192.168.1.103]) by pokfb.esmtp.ibm.com (8.12.11/8.12.11) with ESMTP id j5H3VAXD028875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Jun 2005 23:31:10 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e3.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id j5H3S1Sk009161 for ; Thu, 16 Jun 2005 23:28:01 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.12.10/NCO/VERS6.7) with ESMTP id j5H3S1Ck149088 for ; Thu, 16 Jun 2005 23:28:01 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11/8.13.3) with ESMTP id j5H3S1WQ018606 for ; Thu, 16 Jun 2005 23:28:01 -0400 Received: from [127.0.0.1] (sig-9-48-117-35.mts.ibm.com [9.48.117.35]) by d01av01.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j5H3RxBt018591 for ; Thu, 16 Jun 2005 23:28:00 -0400 Message-ID: <42B2433D.3010402@debrunners.com> Date: Thu, 16 Jun 2005 20:27:57 -0700 From: Daniel John Debrunner User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Discussion Subject: Re: Is it possible to force read-only mode? References: <42AF850F.4070908@nuix.com.au> <42B10A3C.6050605@nuix.com.au> <42B1B74D.6010505@sbcglobal.net> <42B22F41.1000805@nuix.com.au> In-Reply-To: <42B22F41.1000805@nuix.com.au> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Daniel Noll wrote: > > 5. The two hosts might not even be on the same network segment, and > thus would be unable to intercommunicate at all. If that's the case then even NFS won't work, right? > > It seems like this problem wouldn't exist at all if Derby didn't try to > lock the database. My real question is, if I want to open it in > read-only mode anyway, what business does it have locking it from other > readers? Because the readers wouldn't see a consistent, correct view of the database, and may have unpredictable failures. Readers in this case are a separate JVM running Derby opening the files in read only mode that are in use by another JVM running Derby. This mode is not supported. It is not supported because the active Derby engine does not write every update to disk as soon as it happens. It uses a write-ahead logging (WAL) system which ensures transaction durability without requiring all data changes to be made to disk. This is a performance benefit, if a transaction modifies, say, five rows then with a WAL scheme only one disk i/o is required to commit the transaction. Without WAL there would be up to five i/o's to commit. The outcome of this is that the on-disk image of the data (as seen by your reader) is not in a consistent state. Any page from a table may be very stale because the modified fresh version is still in the cache of the active Derby system, or it may contain uncommitted data because the active system had to write a modified page out to free up some space, but the transaction has not committed. Also maybe the on-disk data may not be structually sound, say for a btree index. May contain pages that point to pages that have not yet been written out. This inconsistent state is brought to consistency by an active system when it boots by running roll forward recovery, it reads the transaction log and redoes committed changes and undoes uncommitted changes. Active Runtime -> Correct state = (in-memory state + disk state) Active booting -> Correct state = (disk state + transaction log + roll forward recovery) So at no point is just the on-disk state a useful snapshot of the database. Dan.