[dovecot-cvs] dovecot/src/lib-index mail-transaction-log-append.c, 1.17.2.5, 1.17.2.6 mail-transaction-log-private.h, 1.13.2.3, 1.13.2.4

tss at dovecot.org tss at dovecot.org
Sun Mar 11 18:40:57 EET 2007


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

Modified Files:
      Tag: branch_1_0
	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.17.2.5
retrieving revision 1.17.2.6
diff -u -d -r1.17.2.5 -r1.17.2.6
--- mail-transaction-log-append.c	11 Mar 2007 16:10:38 -0000	1.17.2.5
+++ mail-transaction-log-append.c	11 Mar 2007 16:40:54 -0000	1.17.2.6
@@ -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.13.2.3
retrieving revision 1.13.2.4
diff -u -d -r1.13.2.3 -r1.13.2.4
--- mail-transaction-log-private.h	18 Nov 2006 21:01:08 -0000	1.13.2.3
+++ mail-transaction-log-private.h	11 Mar 2007 16:40:54 -0000	1.13.2.4
@@ -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