[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-file.c, 1.10,
	1.11 mbox-mail.c, 1.26, 1.27 mbox-sync-private.h, 1.52,
	1.53 mbox-sync.c, 1.156, 1.157
    cras at dovecot.org 
    cras at dovecot.org
       
    Tue Apr 26 17:52:04 EEST 2005
    
        - Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c,
	1.53, 1.54
 
        - Next message: [dovecot-cvs] dovecot/src/lib-index mail-index-sync.c, 1.57,
	1.58 mail-transaction-log-private.h, 1.11,
	1.12 mail-transaction-log-view.c, 1.39,
	1.40 mail-transaction-log.c, 1.95, 1.96
 
         -  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
 
       
    
  
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv19403
Modified Files:
	mbox-file.c mbox-mail.c mbox-sync-private.h mbox-sync.c 
Log Message:
If we see mbox offsets break, don't invalidate whole index but rather force
resyncing.
Index: mbox-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-file.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mbox-file.c	8 Apr 2005 14:32:52 -0000	1.10
+++ mbox-file.c	26 Apr 2005 14:52:02 -0000	1.11
@@ -137,8 +137,7 @@
 		mail_storage_set_critical(STORAGE(mbox->storage),
 			"Cached message offset lost for seq %u in mbox file %s",
 			seq, mbox->path);
-		mail_index_mark_corrupted(mbox->ibox.index);
-		return -1;
+		return 0;
 	}
 
 	offset = *((const uint64_t *)data);
@@ -155,8 +154,7 @@
 		mail_storage_set_critical(STORAGE(mbox->storage),
 			"Cached message offset %s is invalid for mbox file %s",
 			dec2str(offset), mbox->path);
-		mail_index_mark_corrupted(mbox->ibox.index);
-		return -1;
+		return 0;
 	}
 
 	if (mbox->mbox_sync_dirty) {
Index: mbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-mail.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mbox-mail.c	8 Apr 2005 13:13:48 -0000	1.26
+++ mbox-mail.c	26 Apr 2005 14:52:02 -0000	1.27
@@ -65,7 +65,7 @@
 			i_assert(mbox->mbox_lock_type == F_UNLCK);
 		}
 
-		sync_flags |= MBOX_SYNC_UNDIRTY;
+		sync_flags |= MBOX_SYNC_UNDIRTY | MBOX_SYNC_FORCE_SYNC;
 		goto __again;
 	}
 
Index: mbox-sync-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-private.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- mbox-sync-private.h	26 Apr 2005 14:07:31 -0000	1.52
+++ mbox-sync-private.h	26 Apr 2005 14:52:02 -0000	1.53
@@ -9,7 +9,8 @@
 	MBOX_SYNC_HEADER	= 0x02,
 	MBOX_SYNC_LOCK_READING	= 0x04,
 	MBOX_SYNC_UNDIRTY	= 0x08,
-	MBOX_SYNC_REWRITE	= 0x10
+	MBOX_SYNC_REWRITE	= 0x10,
+	MBOX_SYNC_FORCE_SYNC	= 0x20
 };
 
 struct mbox_flag_type {
Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- mbox-sync.c	26 Apr 2005 14:45:46 -0000	1.156
+++ mbox-sync.c	26 Apr 2005 14:52:02 -0000	1.157
@@ -1329,8 +1329,12 @@
 		return -1;
 	}
 
-	if ((uint32_t)st->st_mtime == sync_ctx->hdr->sync_stamp &&
-	    (uint64_t)st->st_size == sync_ctx->hdr->sync_size) {
+	if ((flags & MBOX_SYNC_FORCE_SYNC) != 0) {
+		/* forcing a full sync. assume file has changed. */
+		partial = FALSE;
+		sync_ctx->mbox->mbox_sync_dirty = TRUE;
+	} else if ((uint32_t)st->st_mtime == sync_ctx->hdr->sync_stamp &&
+		   (uint64_t)st->st_size == sync_ctx->hdr->sync_size) {
 		/* file is fully synced */
 		partial = TRUE;
 		sync_ctx->mbox->mbox_sync_dirty = FALSE;
@@ -1443,7 +1447,8 @@
 			return -1;
 	}
 
-	if ((flags & MBOX_SYNC_HEADER) != 0)
+	if ((flags & MBOX_SYNC_HEADER) != 0 ||
+	    (flags & MBOX_SYNC_FORCE_SYNC) != 0)
 		changed = 1;
 	else {
 		int leave_dirty = (flags & MBOX_SYNC_UNDIRTY) == 0;
    
    
        
	- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c,
	1.53, 1.54
 
	- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index-sync.c, 1.57,
	1.58 mail-transaction-log-private.h, 1.11,
	1.12 mail-transaction-log-view.c, 1.39,
	1.40 mail-transaction-log.c, 1.95, 1.96
 
         -  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
 
       
More information about the dovecot-cvs
mailing list