persistentstorage/sql/SRC/Server/Compact/SqlCompactEntry.cpp
branchGCC_SURGE
changeset 38 c4e342fcf0c8
parent 35 0d6db0a14001
child 31 ba1c4f4a893f
--- a/persistentstorage/sql/SRC/Server/Compact/SqlCompactEntry.cpp	Mon Jun 21 22:46:09 2010 +0100
+++ b/persistentstorage/sql/SRC/Server/Compact/SqlCompactEntry.cpp	Thu Jul 22 16:49:09 2010 +0100
@@ -189,6 +189,8 @@
 Performs a compaction step on the database.
 If the number of the free pages is bigger than the number of pages removed in one compaction step,
 the function will reschedule itself for another compaction step.
+If the database file is corrupted, then the function will remove the database entry from the timer queue - 
+the database won't be compacted anymore.
 
 @return KErrNoMemory, an out of memory condition has occurred;
                       Note that the function may also return some other database specific 
@@ -213,8 +215,9 @@
 		iPageCount -= processedPageCount;
 		__SQLASSERT(iPageCount >= 0, ESqlPanicInternalError);
 		}
-	if(iPageCount <= 0)
-		{//No more pages to compact. Stop the compacting, move to EInactive state, remove from the timer queue.
+	TBool stopCompaction = err == KSqlErrCorrupt || err == KSqlErrNotDb || err == KErrCorrupt || err == KErrDisMounted;
+	if(iPageCount <= 0 || stopCompaction)
+		{//No more pages to compact or the file is corrupted . Stop the compacting, move to EInactive state, remove from the timer queue.
 		ResetState();
 		iTimer.DeQueue(*this);
 		}