db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Matrigali <mikem_...@sbcglobal.net>
Subject Re: [PATCH] upgrade fix related to checksum support for transaction log to recognize out of order log writes during recovery (Derby-96)
Date Thu, 21 Apr 2005 23:37:48 GMT
Given that Dan is working on the upgrade stuff, I think the change below
handles the current, and next release fine.  More changes can be made
as it becomes clear how rest of code is handling soft upgrade.

Going forward I would like to see a better model for the code below. 
For this discussion assume current release is 10.0.x and next 2 releases
are 10.1.x and 10.2.x.  If derby supports soft upgrade from 10.0.x
directly to 10.2.x then the code below will have to change, meaning 
someone is going to have to remember to change it (maybe a sanity
statement could force an error if version is not what is expected?):
// 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;

I am not sure what is the right fix, and it depends on future upgrade
policy.  Some options seem:
1) don't check current version at all
2) add some >= rather than ==, but that is sort of complicated if soft 
upgrade supports changes to both major and minor version number - but
maybe by definition soft upgrade is not supported to major upgrade?
3) add a new interface that hides this all, and just takes as an
    argument what version has the change to handle soft upgrade,
    something like:

    if (current_disk_version_in_soft_upgrade(10,0))
    {
         enableLogChecksum = false
    }




Suresh Thalamati wrote:
> 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


Mime
View raw message