db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r178486 - /incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogCounter.java /incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
Date Wed, 25 May 2005 16:51:45 GMT
Author: mikem
Date: Wed May 25 09:51:44 2005
New Revision: 178486

URL: http://svn.apache.org/viewcvs?rev=178486&view=rev
Log:

Attached patch increases the maximum possible  log file number to  231 -1  and  keeps the
 old limit of 222-1 on soft upgrade.
Earlier patch for this problem increased it to 233 -1 , but that fix created  upgrade problems
because of  the  additional bits
that are used from  the file position field,  so the limit is being reduced to  231-1. 

committed on behalf of: suresh.thalamati@gmail.com


Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogCounter.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/impl/store/raw/log/LogCounter.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogCounter.java?rev=178486&r1=178485&r2=178486&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogCounter.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogCounter.java
Wed May 25 09:51:44 2005
@@ -60,18 +60,18 @@
 	
 	/** A well defined value of an invalid log instant. */
 	public static final long INVALID_LOG_INSTANT = 0;
+	
+	// max possible log file number in versions before 10.1 is 2^22 -1
+	public static final long DERBY_10_0_MAX_LOGFILE_NUMBER = (long)0x003FFFFFL; // 4194303
+	// max possible log file number is 2^31 -1
+	public static final long MAX_LOGFILE_NUMBER	= (long)0x7FFFFFFFL; // 2147483647 
+	// lower end of 32 bits in long type are used to store the log file position
+	private static final long FILE_NUMBER_SHIFT	= 32;
 
-
-	// max possible log file number is 2^33 -1 (8589934591)
-	public static final long MAX_LOGFILE_NUMBER	= (long)0x1FFFFFFFFL; 
-
-	// lower end of 30 bits in long type are used to store the log file position
-	private static final long FILE_NUMBER_SHIFT	= 30;
-
-	// reserve top 2 bits in log file size for future use
+	// reserve top 4 bits in log file size for future use
 	public static final long MAX_LOGFILE_SIZE	    = (long)0x0FFFFFFFL; // 268435455
-	// 30 bits are used to store the log file postion
-	private static final long FILE_POSITION_MASK	= (long)0x3FFFFFFFL;
+	// 32 bits are used to store the log file postion
+	private static final long FILE_POSITION_MASK	= (long)0x7FFFFFFFL;
 
 	private long fileNumber;
 	private long filePosition;

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=178486&r1=178485&r2=178486&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 May 25 09:51:44 2005
@@ -333,7 +333,7 @@
 								// must be synchronized with this to access
 								// or change.
 	
-
+	private long              maxLogFileNumber = LogCounter.MAX_LOGFILE_NUMBER;
 	private CheckpointOperation		 currentCheckpoint;
 								// last checkpoint successfully taken
 								// 
@@ -1831,11 +1831,11 @@
 			// used.
 			StorageFile newLogFile = getLogFileName(logFileNumber+1);
 
-			if (logFileNumber+1 >= LogCounter.MAX_LOGFILE_NUMBER)
+			if (logFileNumber+1 >= maxLogFileNumber)
             {
 				throw StandardException.newException(
                         SQLState.LOG_EXCEED_MAX_LOG_FILE_NUMBER, 
-                        new Long(LogCounter.MAX_LOGFILE_NUMBER)); 
+                        new Long(maxLogFileNumber)); 
             }
 
 			StorageRandomAccessFile newLog = null;	// the new log file
@@ -3059,6 +3059,21 @@
 		{
 			throw Monitor.exceptionStartingModule(ioe);
 		}
+			
+		// Number of the log file that can be created in Derby is increased from 
+		// 2^22 -1 to 2^31 -1 in version 10.1. But if the database is running on
+		// engines 10.1 or above on a  softupgrade  from versions 10.0 or
+		// before, the max log file number  that can be created is  
+		// still limited to 2^22 -1, because users can revert back to older  versions 
+		// which does not have logic to handle a log file number greater than
+		// 2^22-1. 
+
+		// set max possible log file number to derby 10.0 limit, if the database is not 
+		// fully upgraded to or created in version 10.1 or above. 
+		if (!checkVersion(RawStoreFactory.DERBY_STORE_MAJOR_VERSION_10, 
+						  RawStoreFactory.DERBY_STORE_MINOR_VERSION_1))
+			maxLogFileNumber = LogCounter.DERBY_10_0_MAX_LOGFILE_NUMBER;
+
 	} // end of boot
 
     private void getLogStorageFactory() throws StandardException



Mime
View raw message