Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 14215 invoked from network); 1 Sep 2004 14:54:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Sep 2004 14:54:16 -0000 Received: (qmail 12267 invoked by uid 500); 1 Sep 2004 14:54:00 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 12129 invoked by uid 500); 1 Sep 2004 14:53:58 -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 Delivered-To: moderator for derby-dev@db.apache.org Received: (qmail 69936 invoked by uid 99); 1 Sep 2004 06:09:05 -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) Mime-Version: 1.0 (Apple Message framework v619) Content-Transfer-Encoding: 7bit Message-Id: <6A8D4356-FBDD-11D8-A91C-000D93ADDBD4@serv.net> Content-Type: text/plain; charset=US-ASCII; format=flowed To: derby-dev@db.apache.org From: Joseph Grace Subject: java1.4.2 "rws" mode fix: LogToFile.java diff Date: Tue, 31 Aug 2004 23:09:00 -0700 X-Mailer: Apple Mail (2.619) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Dear derby-dev: Apologies for any faux-pas. I'm not sure what diff to use, so I used diff -c2 to make the following patch. I made this change to get derby running under java 1.4.2 on Mac OSX 10.3.5 (i.e., the latest and greatest version). I believe the patch fixes a bug where the database gets created twice unnecessarily. This bug was causing the simple instructions example ("connect 'jdbc:derby:test;create=true';") to choke with a file already exists error. Apparently, this situation crops up whenever "rws" mode was available, and would not occur prior to 1.4.1 (since apparently "rws" was too buggy to use until 1.4.2 and, so, was avoided). Anyway, here's what I believe is a fix for that issue and, at least, got the database to initialize per instructions on my system. BTW, I also fixed some typos in the comments and tried to make the comments agree with the changes. Cheers, = Joe = *** LogToFile.java.org Thu Aug 26 12:07:32 2004 --- LogToFile.java Tue Aug 31 22:19:16 2004 *************** *** 889,902 **** lastFlush = endPosition; ! //if write sync is true , prellocate the log file ! //and reopen the file in rws mode. if(isWriteSynced) { ! //extend the file by wring zeros to it preAllocateNewLogFile(theLog); theLog.close(); theLog= privRandomAccessFile(logFile, "rws"); ! //postion the log at the current end postion ! theLog.seek(endPosition); } --- 889,902 ---- lastFlush = endPosition; ! // if write sync is true , preallocate the log file ! // and reopen the file in rws mode. if(isWriteSynced) { ! // extend the file by writing zeros to it preAllocateNewLogFile(theLog); theLog.close(); theLog= privRandomAccessFile(logFile, "rws"); ! // position the log at the current end position ! theLog.seek( endPosition); } *************** *** 3004,3008 **** // don't need to try to delete it, we know it isn't there ! StorageRandomAccessFile theLog = privRandomAccessFile(logFile, "rw"); if (!initLogFile(theLog, logFileNumber, LogCounter.INVALID_LOG_INSTANT)) --- 3004,3008 ---- // don't need to try to delete it, we know it isn't there ! StorageRandomAccessFile theLog = privRandomAccessFile( logFile, isWriteSynced? "rws": "rw"); if (!initLogFile(theLog, logFileNumber, LogCounter.INVALID_LOG_INSTANT)) *************** *** 3015,3028 **** lastFlush = theLog.getFilePointer(); ! //if write sync is true , prellocate the log file ! //and reopen the file in rws mode. ! if(isWriteSynced) { ! //extend the file by wring zeros to it ! preAllocateNewLogFile(theLog); ! theLog.close(); ! theLog= privRandomAccessFile(logFile, "rws"); ! //postion the log at the current log end postion ! theLog.seek(endPosition); } logOut = new LogAccessFile(theLog, logBufferSize); --- 3015,3026 ---- lastFlush = theLog.getFilePointer(); ! // if write sync is true , preallocate the log file ! // and reposition cursor. ! if( isWriteSynced) { ! // extend the file by writing zeros to it ! preAllocateNewLogFile( theLog); ! // position the log at the current log end position ! theLog.seek( endPosition); } logOut = new LogAccessFile(theLog, logBufferSize);