[dovecot-cvs] dovecot/src/lib-index mail-transaction-log-append.c, 1.23, 1.24 mail-transaction-log-private.h, 1.17, 1.18

tss at dovecot.org tss at dovecot.org
Sun Mar 11 18:41:00 EET 2007


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv5733

Modified Files:
	mail-transaction-log-append.c mail-transaction-log-private.h 
Log Message:
If transaction log grows larger than 1MB, rotate it even if it was created
less than 5 minutes ago.



Index: mail-transaction-log-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log-append.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- mail-transaction-log-append.c	11 Mar 2007 16:10:42 -0000	1.23
+++ mail-transaction-log-append.c	11 Mar 2007 16:40:58 -0000	1.24
@@ -363,6 +363,12 @@
 	return 0;
 }
 
+#define LOG_WANT_ROTATE(file) \
+	(((file)->sync_offset > MAIL_TRANSACTION_LOG_ROTATE_MIN_SIZE && \
+	  (time_t)(file)->hdr.create_stamp < \
+	   ioloop_time - MAIL_TRANSACTION_LOG_ROTATE_TIME) || \
+	 ((file)->sync_offset > MAIL_TRANSACTION_LOG_ROTATE_MAX_SIZE))
+
 #define ARE_ALL_TRANSACTIONS_IN_INDEX(log, idx_hdr) \
 	((log)->head->hdr.file_seq == (idx_hdr)->log_file_seq && \
 	 (log)->head->sync_offset == (idx_hdr)->log_file_int_offset && \
@@ -394,9 +400,7 @@
 			return -1;
 	}
 
-	if (log->head->sync_offset > MAIL_TRANSACTION_LOG_ROTATE_SIZE &&
-	    (time_t)log->head->hdr.create_stamp <
-	    ioloop_time - MAIL_TRANSACTION_LOG_ROTATE_TIME &&
+	if (LOG_WANT_ROTATE(log->head) &&
 	    ARE_ALL_TRANSACTIONS_IN_INDEX(log, index->hdr)) {
 		/* we might want to rotate, but check first that everything is
 		   synced in index. */

Index: mail-transaction-log-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log-private.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mail-transaction-log-private.h	6 Dec 2006 15:08:32 -0000	1.17
+++ mail-transaction-log-private.h	11 Mar 2007 16:40:58 -0000	1.18
@@ -4,7 +4,10 @@
 #include "file-dotlock.h"
 #include "mail-transaction-log.h"
 
-#define MAIL_TRANSACTION_LOG_ROTATE_SIZE (1024*128)
+/* Rotate when log is older than ROTATE_TIME and larger than MIN_SIZE */
+#define MAIL_TRANSACTION_LOG_ROTATE_MIN_SIZE (1024*128)
+/* If log is larger than MAX_SIZE, rotate regardless of the time */
+#define MAIL_TRANSACTION_LOG_ROTATE_MAX_SIZE (1024*1024)
 #define MAIL_TRANSACTION_LOG_ROTATE_TIME (60*5)
 
 #define MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file) ((file)->fd == -1)



More information about the dovecot-cvs mailing list