Attached is a second patch towards implementing checksum support for transaction
log to handle out of order incomplete log writes during recovery. This patch addresses
upgrade issues related to the new checksum log record.


Testing : Ran derbyall test suite, all tests passed.

Full upgrade : No issues, Only a new checksum log record is added , there were no changes to existing disk structures.
Soft Upgrade : If the New checksum log recods are wriiten in 10.1 to checksum transaction log on softupgrade from 10.0,
users can not revert back to 10.0 because 10.0 engine can not read checksum recods on recovery and it will fail. ; Attached
patch addresses this problem by disabling log checksum feature on a softupgrade from 10.0 to 10.1. Transaction log checksum
feature will be enabled only on full upgrade to 10.1 or on a new databases.




Thanks
-suresh



Index: java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
===================================================================
--- java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java  
(revision 161952)
+++ java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java  
(working copy)
@@ -153,6 +153,7 @@
 
                currentBuffer = (LogAccessFileBuffer) freeBuffers.removeFirst();
 
+               writeChecksum = logFactory.isLogChecksumEnabled();
                if(writeChecksum)
                {
                        /**
Index: java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
===================================================================
--- java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java      
(revision 161952)
+++ java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java      
(working copy)
@@ -433,6 +433,16 @@
 
 
        /**
+        * will be set to false only  incase of soft upgrade from
+        * version 10.0 to 10.1. Log checksum feature  is introduced 
+        * in version 10.1, incase of a soft upgrade to 10.1 from 10.0, users 
+        * can always revert to 10.0, which does not understand the Checksum 
log records.
+        * To avoid this case, log checksum feature is disabled in 10.1 engine 
+        * in soft upgrade from 10.0.
+        */
+       private boolean enableLogChecksum = true;
+
+       /**
                MT- not needed for constructor
        */
        public LogToFile() {
@@ -2373,6 +2383,12 @@
                                        throw StandardException.newException(
                                                        
SQLState.LOG_CONTROL_FILE, logControlFileName);
                                }
+                       }else
+                       {
+                               // disable log checksum feature on soft upgrade 
from version 10.0 to 10.1
+                               if (onDiskMajorVersion == 10 && 
onDiskMinorVersion == 0 &&
+                                       jbmsVersion.getMajorVersion() == 10 && 
jbmsVersion.getMinorVersion() == 1)
+                                       enableLogChecksum = false;
                        }
                }
 
@@ -3885,7 +3901,16 @@
                return logArchived;
        }
 
+       
        /*
+        * returns true unless the log checksum feature is disabled 
+        */
+       protected boolean isLogChecksumEnabled()
+       {
+               return enableLogChecksum;
+       }
+
+       /*
        ** Sending information to the user without throwing exception.
        ** There are times when unusual external or system related things 
happen in
        ** the log which the user may be interested in but which doesn't impede 
on

Reply via email to