db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Grace <oc...@serv.net>
Subject java1.4.2 "rws" mode fix: LogToFile.java diff
Date Wed, 01 Sep 2004 06:09:00 GMT
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);


Mime
View raw message