changeset 5792:a250c1a48471 HEAD

Log an error if non-head log file couldn't be synced to the next file's prev_file_offset position.
author Timo Sirainen <tss@iki.fi>
date Wed, 20 Jun 2007 23:49:44 +0300
parents 2a05cff7eca4
children 512f8982ae8b
files src/lib-index/mail-transaction-log-file.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-file.c	Wed Jun 20 20:49:51 2007 +0300
+++ b/src/lib-index/mail-transaction-log-file.c	Wed Jun 20 23:49:44 2007 +0300
@@ -748,6 +748,17 @@
 		}
 		// FIXME: here we probably want to flush NFS data cache
 	}
+
+	if (file->next != NULL &&
+	    file->hdr.file_seq == file->next->hdr.prev_file_seq &&
+	    file->next->hdr.prev_file_offset != file->sync_offset) {
+		mail_index_set_error(file->log->index,
+			"Invalid transaction log size "
+			"(%"PRIuUOFF_T" vs %u): %s", file->sync_offset,
+			file->log->head->hdr.prev_file_offset, file->filepath);
+		return -1;
+	}
+
 	return 0;
 }