From derby-dev-return-194-apmail-db-derby-dev-archive=db.apache.org@db.apache.org Thu Sep 02 02:25:20 2004 Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 26017 invoked from network); 2 Sep 2004 02:25:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Sep 2004 02:25:20 -0000 Received: (qmail 79602 invoked by uid 500); 2 Sep 2004 02:25:19 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 79555 invoked by uid 500); 2 Sep 2004 02:25:17 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: List-Id: "Derby Development" Reply-To: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 79540 invoked by uid 99); 2 Sep 2004 02:25:17 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [216.39.128.17] (HELO smtp2.sea.theriver.com) (216.39.128.17) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 01 Sep 2004 19:25:16 -0700 Received: (qmail 26248 invoked from network); 2 Sep 2004 02:25:19 -0000 Received: from c-67-170-1-160.client.comcast.net (HELO [192.168.1.101]) (occam@67.170.1.160) by 199.201.191.1 with SMTP; Thu, 02 Sep 2004 02:25:19 +0000 Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: <6A8D4356-FBDD-11D8-A91C-000D93ADDBD4@serv.net> References: <6A8D4356-FBDD-11D8-A91C-000D93ADDBD4@serv.net> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <509F159B-FC87-11D8-AF75-000D93ADDBD4@serv.net> Content-Transfer-Encoding: 7bit From: Joseph Grace Subject: Re: java1.4.2 "rws" mode fix: LogToFile.java diff Date: Wed, 1 Sep 2004 19:25:11 -0700 To: derby-dev@db.apache.org X-Mailer: Apple Mail (2.619) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Dear Suresh: Thank you for your informative reply and explanations of the original code. Much appreciated. I am relearning java and learning derby as I go here, so I'll answer your questions as I can. Add salt to taste as most of my "knowledge" I gleaned from the comments in the code I modified. FYI, I am using the most up-to-date OSX 10.3.5 and ditto for OSX java: java version "1.4.2_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-141) Java HotSpot(TM) Client VM (build 1.4.2-38, mixed mode) and I have not tested on any other platform. I believe your assessments below are correct. Suresh Thalamati wrote: > I am trying to understand the problem you described above. What is > the error you are seeing when you try to create > the database in the Mac environment. Are u seeing this problem > with JDK1.4.2 on any other OS ? > Could you please explain more on how database can be created > twice ? > From the changes described here, what I find is you are trying > to > avoid open/create > of log file in "rw" mode first and then in "rws" mode by > making > it a single privRandomAccess File call: > > >> StorageRandomAccessFile theLog = privRandomAccessFile( logFile, > isWriteSynced? "rws": "rw"); Yes, I merged the file creations to get the code working (and avoid a "File exists" exception: ~/derby$ java -cp jars/sane/derby.jar:jars/sane/derbytools.jar org.apache.derby.tools.ij ij version 10.0 (C) Copyright IBM Corp. 1997, 2004. ij> connect 'jdbc:derby:test;create=true'; ERROR XJ041: Failed to create database 'test', see the next exception for details. ERROR XBM01: Startup failed due to an exception, see next exception for details. ERROR XJ001: Java exception: '/Users/occam/dev/java/derby/test/log/log1.dat (File exists): java.io.FileNotFoundException'. ij> I thought there may have been some rush changes in the handoff from IBM to Apache which left a bug overlooked in java 1.4.2 (mea culpa). I did not realize the double-open was intended as an optimization (since it fails on my system and so seemed a bug). The error is a little misleading but, looking under the covers, I was able to confirm the existence of "log1.dat" (or somesuch) at the time of the error report attempt to recreate/open "log1.dat". So, "File exists" is the correct complaint. I have no idea whether that's in/correct behavior. If there is incorrect behavior on OSX's java 1.4.2_05, please describe it, and I shall submit it to Apple (or you can, as desired). > I think the following part of the changes might increase database > creation time when write sync is enabled.. Aha. Yes, it does take quite a long time now that you mention it. I'm glad that may not be normal. > Please correct me if my observation is not right . I think the > Reason behind opening files in "RW" mode first > and then reopen in "RWS" might have been to make preallocation of > the log file finish faster. > . Preallocation of the log file by doing writes to a file opened in > "rws" mode will be much slower than > doing writes to file opened in "rw" mode . Sounds good to me (i.e., I'll take your word for it :-). Apologies for any confusion. Please let me know whether this fixes a bug or not, or whether I should submit a bug report to Apple for OSX java instead? Thanks, = Joe =