Mercurial > dovecot > original-hg > dovecot-1.2
changeset 1976:4e0269adb24a HEAD
Don't rotate transaction log too often
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 04 May 2004 01:19:39 +0300 |
parents | be0269b8e2d4 |
children | ab2f615e0ce8 |
files | src/lib-index/mail-transaction-log-private.h src/lib-index/mail-transaction-log.c src/lib-index/mail-transaction-log.h |
diffstat | 3 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-private.h Tue May 04 01:15:08 2004 +0300 +++ b/src/lib-index/mail-transaction-log-private.h Tue May 04 01:19:39 2004 +0300 @@ -16,6 +16,7 @@ ino_t st_ino; dev_t st_dev; + time_t last_mtime; buffer_t *buffer; uoff_t buffer_offset;
--- a/src/lib-index/mail-transaction-log.c Tue May 04 01:15:08 2004 +0300 +++ b/src/lib-index/mail-transaction-log.c Tue May 04 01:19:39 2004 +0300 @@ -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) {
--- a/src/lib-index/mail-transaction-log.h Tue May 04 01:15:08 2004 +0300 +++ b/src/lib-index/mail-transaction-log.h Tue May 04 01:19:39 2004 +0300 @@ -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;