dovecot-2.0: lib-index: Log a warning if transaction log lock is...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 23 17:57:49 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/6d6d9f49f61b
changeset: 12154:6d6d9f49f61b
user: Timo Sirainen <tss at iki.fi>
date: Thu Sep 23 15:53:09 2010 +0100
description:
lib-index: Log a warning if transaction log lock is kept over 3 minutes.
diffstat:
src/lib-index/mail-transaction-log-file.c | 10 ++++++++++
src/lib-index/mail-transaction-log-private.h | 1 +
2 files changed, 11 insertions(+), 0 deletions(-)
diffs (52 lines):
diff -r 02a9cf90ad02 -r 6d6d9f49f61b src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c Wed Sep 22 18:19:31 2010 +0100
+++ b/src/lib-index/mail-transaction-log-file.c Thu Sep 23 15:53:09 2010 +0100
@@ -282,6 +282,7 @@
if (ret > 0) {
file->log->dotlock_count++;
file->locked = TRUE;
+ file->lock_created = time(NULL);
return 0;
}
if (ret < 0) {
@@ -344,6 +345,7 @@
&file->file_lock);
if (ret > 0) {
file->locked = TRUE;
+ file->lock_created = time(NULL);
return 0;
}
if (ret < 0) {
@@ -361,6 +363,8 @@
void mail_transaction_log_file_unlock(struct mail_transaction_log_file *file)
{
+ unsigned int lock_time;
+
if (!file->locked)
return;
@@ -369,6 +373,12 @@
if (MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file))
return;
+ lock_time = time(NULL) - file->lock_created;
+ if (lock_time >= MAIL_TRANSCATION_LOG_LOCK_TIMEOUT) {
+ i_warning("Transaction log file %s was locked for %u seconds",
+ file->filepath, lock_time);
+ }
+
if (file->log->index->lock_method == FILE_LOCK_METHOD_DOTLOCK) {
mail_transaction_log_file_undotlock(file);
return;
diff -r 02a9cf90ad02 -r 6d6d9f49f61b src/lib-index/mail-transaction-log-private.h
--- a/src/lib-index/mail-transaction-log-private.h Wed Sep 22 18:19:31 2010 +0100
+++ b/src/lib-index/mail-transaction-log-private.h Thu Sep 23 15:53:09 2010 +0100
@@ -73,6 +73,7 @@
struct modseq_cache modseq_cache[LOG_FILE_MODSEQ_CACHE_SIZE];
struct file_lock *file_lock;
+ time_t lock_created;
unsigned int locked:1;
unsigned int corrupted:1;
More information about the dovecot-cvs
mailing list