[dovecot-cvs] dovecot/src/lib-index mail-transaction-log-private.h, 1.4, 1.5 mail-transaction-log.c, 1.18, 1.19 mail-transaction-log.h, 1.6, 1.7

cras at procontrol.fi cras at procontrol.fi
Tue May 4 01:19:41 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv19626/lib-index

Modified Files:
	mail-transaction-log-private.h mail-transaction-log.c 
	mail-transaction-log.h 
Log Message:
Don't rotate transaction log too often



Index: mail-transaction-log-private.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log-private.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mail-transaction-log-private.h	3 May 2004 22:08:26 -0000	1.4
+++ mail-transaction-log-private.h	3 May 2004 22:19:39 -0000	1.5
@@ -16,6 +16,7 @@
 
 	ino_t st_ino;
 	dev_t st_dev;
+	time_t last_mtime;
 
 	buffer_t *buffer;
 	uoff_t buffer_offset;

Index: mail-transaction-log.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mail-transaction-log.c	3 May 2004 22:08:26 -0000	1.18
+++ mail-transaction-log.c	3 May 2004 22:19:39 -0000	1.19
@@ -1,6 +1,7 @@
 /* Copyright (C) 2003-2004 Timo Sirainen */
 
 #include "lib.h"
+#include "ioloop.h"
 #include "buffer.h"
 #include "file-lock.h"
 #include "file-dotlock.h"
@@ -419,6 +420,7 @@
 	file->lock_type = F_UNLCK;
 	file->st_dev = st.st_dev;
 	file->st_ino = st.st_ino;
+	file->last_mtime = st.st_mtime;
 
 	ret = mail_transaction_log_file_read_hdr(file, &st);
 	if (ret == 0) {
@@ -439,6 +441,7 @@
 
 			file->st_dev = st.st_dev;
 			file->st_ino = st.st_ino;
+                        file->last_mtime = st.st_mtime;
 
 			memset(&file->hdr, 0, sizeof(file->hdr));
 			ret = mail_transaction_log_file_read_hdr(file, &st);
@@ -1098,7 +1101,9 @@
 	}
 
 	if (log->head->hdr.file_seq == index->hdr->log_file_seq &&
-	    log->head->hdr.used_size > MAIL_TRANSACTION_LOG_ROTATE_SIZE) {
+	    log->head->hdr.used_size > MAIL_TRANSACTION_LOG_ROTATE_SIZE &&
+	    log->head->last_mtime <
+	    ioloop_time - MAIL_TRANSACTION_LOG_ROTATE_MIN_TIME) {
 		/* everything synced in index, we can rotate. */
 		if (mail_transaction_log_rotate(log) < 0) {
 			if (!log->index->log_locked) {

Index: mail-transaction-log.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mail-transaction-log.h	2 May 2004 20:32:16 -0000	1.6
+++ mail-transaction-log.h	3 May 2004 22:19:39 -0000	1.7
@@ -3,6 +3,7 @@
 
 #define MAIL_TRANSACTION_LOG_PREFIX ".log"
 #define MAIL_TRANSACTION_LOG_ROTATE_SIZE (1024*128)
+#define MAIL_TRANSACTION_LOG_ROTATE_MIN_TIME (60*5)
 
 struct mail_transaction_log_header {
 	uint32_t indexid;



More information about the dovecot-cvs mailing list