db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oyste...@apache.org
Subject svn commit: r643892 - in /db/derby/code/branches/10.4/java/engine/org/apache/derby: iapi/store/raw/log/ iapi/store/raw/xact/ impl/store/raw/log/ impl/store/raw/xact/
Date Wed, 02 Apr 2008 12:59:12 GMT
Author: oysteing
Date: Wed Apr  2 05:59:11 2008
New Revision: 643892

URL: http://svn.apache.org/viewvc?rev=643892&view=rev
Log:
DERBY-3562: Delete unnecessary, old log files on the slave when a checkpoint is encountered
in the log received from the master.
Contributed by Jorgen Loland

Merged to 10.4 branch with command:
svn merge -r643335:643336 https://svn.apache.org/repos/asf/db/derby/code/trunk/

Modified:
    db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
    db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/ReadOnly.java
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java?rev=643892&r1=643891&r2=643892&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
Wed Apr  2 05:59:11 2008
@@ -269,12 +269,13 @@
 
 	/**	
 	 * redoing a checkpoint  during rollforward recovery
-	 @param cinstant The LogInstant of the checkpoint
-	 @param redoLWM  Redo Low Water Mark in the check point record
-	 @param df - the data factory
-	 @exception StandardException - encounter exception during checkpoint
+	 * @param cinstant The LogInstant of the checkpoint
+	 * @param redoLWM  Redo Low Water Mark in the check point record
+	 * @param undoLWM Undo Low Water Mark in the checkpoint
+	 * @param df - the data factory
+	 * @exception StandardException - encounter exception during checkpoint
 	 */
-	public void checkpointInRFR(LogInstant cinstant, long redoLWM, 
+	public void checkpointInRFR(LogInstant cinstant, long redoLWM, long undoLWM,
 								DataFactory df) throws StandardException;
 
 	

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java?rev=643892&r1=643891&r2=643892&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
Wed Apr  2 05:59:11 2008
@@ -321,10 +321,16 @@
 
 
 	/**	
-	 * redo a checkpoint during rollforward recovery
+     * Redo a checkpoint during rollforward recovery.
+     *
+     * @param cinstant The LogInstant of the checkpoint
+     * @param redoLWM  Redo Low Water Mark in the check point record
+     * @param undoLWM Undo Low Water Mark in the checkpoint
+     * @exception StandardException Exception encountered during checkpoint
 	 */
 	public abstract void checkpointInRollForwardRecovery(LogInstant cinstant,
-														 long redoLWM) 
+														 long redoLWM,
+														 long undoLWM)
 		throws StandardException;
 
 	

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java?rev=643892&r1=643891&r2=643892&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java
Wed Apr  2 05:59:11 2008
@@ -132,7 +132,8 @@
 		//redo the checkpoint if we are in roll-forward recovery only
 		if(((RawTransaction)xact).inRollForwardRecovery())
 		{
-			((RawTransaction)xact).checkpointInRollForwardRecovery(instant, redoLWM);
+			((RawTransaction)xact).
+				checkpointInRollForwardRecovery(instant, redoLWM, undoLWM);
 		}
 		return;
 	}

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java?rev=643892&r1=643891&r2=643892&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
Wed Apr  2 05:59:11 2008
@@ -2194,13 +2194,20 @@
 	 */
 	private void truncateLog(CheckpointOperation checkpoint)
 	{
-		long oldFirstLog;
 		long firstLogNeeded;
+		if ((firstLogNeeded = getFirstLogNeeded(checkpoint))==-1)
+			return;
+		truncateLog(firstLogNeeded);
+	}
 
+	/** Get rid of old and unnecessary log files
+	 * @param firstLogNeeded The log file number of the oldest log file
+	 * needed for recovery.
+	 */
+	private void truncateLog(long firstLogNeeded) {
+		long oldFirstLog;
 		if (keepAllLogs)
 			return;
-		if ((firstLogNeeded = getFirstLogNeeded(checkpoint))==-1)
-			return;
 		
 		// when  backup is in progress, log files that are yet to
         // be copied to the backup should not be deleted,  even 
@@ -5049,8 +5056,12 @@
 
 	/**	
 	 *	redo a checkpoint during rollforward recovery
-	*/
-	public void checkpointInRFR(LogInstant cinstant, long redoLWM, DataFactory df) throws StandardException
+     * 
+     * @throws org.apache.derby.iapi.error.StandardException 
+     */
+	public void checkpointInRFR(LogInstant cinstant, long redoLWM,
+								long undoLWM, DataFactory df)
+								throws StandardException
 	{
 		//sync the data
 		df.checkpoint();
@@ -5073,6 +5084,9 @@
 		//remove the stub files
 		df.removeDroppedContainerFileStubs(new LogCounter(redoLWM));
 		
+		if (inReplicationSlaveMode) {
+			truncateLog(LogCounter.getLogFileNumber(undoLWM));
+		}
 	}
 
     /**

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/ReadOnly.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/ReadOnly.java?rev=643892&r1=643891&r2=643892&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/ReadOnly.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/ReadOnly.java
Wed Apr  2 05:59:11 2008
@@ -321,9 +321,11 @@
 	}
 
 	/**	
-		perform a  checkpoint during rollforward recovery
-	*/
-	public void checkpointInRFR(LogInstant cinstant, long redoLWM, 
+	 *	Perform a checkpoint during rollforward recovery.
+     * 
+     * @throws org.apache.derby.iapi.error.StandardException 
+     */
+	public void checkpointInRFR(LogInstant cinstant, long redoLWM, long undoLWM,
 								DataFactory df) throws StandardException
 	{
 		//do nothing

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java?rev=643892&r1=643891&r2=643892&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
Wed Apr  2 05:59:11 2008
@@ -2745,13 +2745,15 @@
 
 
 	/**	
-		perform a  checkpoint during rollforward recovery
-	*/
+	 * Perform a checkpoint during rollforward recovery.
+     * 
+     * @throws org.apache.derby.iapi.error.StandardException 
+     */
 	public void checkpointInRollForwardRecovery(LogInstant cinstant,
-												long redoLWM) 
+												long redoLWM, long undoLWM)
 		throws StandardException
 	{
-		logFactory.checkpointInRFR(cinstant, redoLWM, dataFactory);
+		logFactory.checkpointInRFR(cinstant, redoLWM, undoLWM, dataFactory);
 	}
 
 }



Mime
View raw message