You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by mi...@apache.org on 2006/08/10 16:38:34 UTC

svn commit: r430396 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java

Author: mikem
Date: Thu Aug 10 07:38:33 2006
New Revision: 430396

URL: http://svn.apache.org/viewvc?rev=430396&view=rev
Log:
DERBY-1248

This problem was caused because the backup of the database did not get all
the log records describing the changes to the data files that it got.
The problem is that the online backup reads page "through" the cache, rather 
than from disk so it is picking up "dirty" pages where the associated log 
records have not yet been flushed to disk. 
The backup of the log file on the other hand goes directly from disk and thus 
sometimes in this concurrent test misses some of the log records in the 
unflushed part of the log file. The fix is to flush the log file up to the
end at the end of the backup process after the data files have been copied
and before we copy the last of the log files to the backup.



Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java?rev=430396&r1=430395&r2=430396&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java Thu Aug 10 07:38:33 2006
@@ -4713,6 +4713,15 @@
 	public void endLogBackup(File toDir) throws StandardException
 	{
 		long lastLogFileToBackup;
+
+
+        // Make sure all log records are synced to disk.  The online backup
+        // copied data "through" the cache, so may have picked up dirty pages
+        // which have not yet synced the associated log records to disk. 
+        // Without this force, the backup may end up with page versions 
+        // in the backup without their associated log records.
+        flush(logFileNumber, endPosition);
+
 		if (logArchived)
 		{
 			// when the log is being archived for roll-forward recovery