db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r164994 - /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw /incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log
Date Wed, 27 Apr 2005 15:41:47 GMT
Author: mikem
Date: Wed Apr 27 08:41:45 2005
New Revision: 164994

URL: http://svn.apache.org/viewcvs?rev=164994&view=rev
Log:
committing upgrade change related to DERBY-96 for suresh.thalamati.suresh.thalamati@gmail.com

Attached is the  new  patch  with the suggested changes to make
softupgrade correctly with the  transaction log
checksum feature in 10.1 Added  checkVersion() method  to log factory it
self,  becuase that is where
the  version numbers are read  from  from the log control file , but did
not export the call it to  the
rawstore factory  as it is not needed now.  (This can be done easlily
when there is a  need for upgrade
checks  in the other store modules..) 


Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java?rev=164994&r1=164993&r2=164994&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
Wed Apr 27 08:41:45 2005
@@ -94,6 +94,14 @@
 
 public interface RawStoreFactory extends Corruptable {
 
+	/** Store engine version numbers indicating the database must be upgraded to 
+	 * or created at the current engine level 
+	 */
+
+	/** Derby Store Minor Version (1) **/
+	public static final int DERBY_STORE_MINOR_VERSION_1    = 1;
+	/** Derby 10 Store Major version */
+	public static final int DERBY_STORE_MAJOR_VERSION_10   = 10;
 
 	/**
 		Default value for PAGE_SIZE_PARAMETER (4096).

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java?rev=164994&r1=164993&r2=164994&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
Wed Apr 27 08:41:45 2005
@@ -35,6 +35,7 @@
 
 import org.apache.derby.iapi.services.io.FormatIdOutputStream;
 import org.apache.derby.iapi.services.io.ArrayOutputStream;
+import org.apache.derby.iapi.store.raw.RawStoreFactory;
 
 
 /**
@@ -116,7 +117,7 @@
 	private long checksumInstant = -1;
 	private int checksumLength;
 	private int checksumLogRecordSize;      //checksumLength + LOG_RECORD_FIXED_OVERHEAD_SIZE
-	private boolean writeChecksum = true;  //gets set to false incase of a soft upgrade.
+	private boolean writeChecksum; 
 	private ChecksumOperation checksumLogOperation;
 	private LogRecord checksumLogRecord;
 	private LogToFile logFactory;
@@ -152,7 +153,14 @@
         }
 
 		currentBuffer = (LogAccessFileBuffer) freeBuffers.removeFirst();
-
+		
+		// Support for Transaction Log Checksum in Derby was added in 10.1
+		// Check to see if the Store have been upgraded to 10.1 or later before
+		// writing the checksum log records.  Otherwise recovery will fail
+		// incase user tries to revert back to versions before 10.1 in 
+		// soft upgrade mode. 
+		writeChecksum = logFactory.checkVersion(RawStoreFactory.DERBY_STORE_MAJOR_VERSION_10, 
+												RawStoreFactory.DERBY_STORE_MINOR_VERSION_1);
 		if(writeChecksum)
 		{
 			/**

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java?rev=164994&r1=164993&r2=164994&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
Wed Apr 27 08:41:45 2005
@@ -3885,6 +3885,29 @@
 		return logArchived;
 	}
 
+	/**
+	   Check to see if a database has been upgraded to the required
+	   level in order to use a store feature.
+	   @param requiredMajorVersion  required database Engine major version
+	   @param requiredMinorVersion  required database Engine minor version
+	   @return True if the database has been upgraded to the required level, false otherwise.
+	**/
+	boolean checkVersion(int requiredMajorVersion, int requiredMinorVersion) 
+	{
+		if(onDiskMajorVersion > requiredMajorVersion )
+		{
+			return true;
+		}
+		else
+		{
+			if(onDiskMajorVersion == requiredMajorVersion &&  
+			   onDiskMinorVersion >= requiredMinorVersion)
+				return true;
+		}
+		
+		return false;
+	}
+
 	/*
 	** Sending information to the user without throwing exception.
 	** There are times when unusual external or system related things happen in



Mime
View raw message