Index: mail-cache-compress.c =================================================================== RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-compress.c,v retrieving revision 1.42.2.3 diff -u -r1.42.2.3 mail-cache-compress.c --- mail-cache-compress.c 29 Dec 2006 00:23:29 -0000 1.42.2.3 +++ mail-cache-compress.c 16 Jan 2007 21:59:18 -0000 @@ -311,8 +311,8 @@ } #ifdef DEBUG - i_warning("Compressing cache file %s (%u)", - cache->filepath, cache->need_compress_file_seq); + /*i_warning("Compressing cache file %s (%u)", + cache->filepath, cache->need_compress_file_seq);*/ #endif if (cache->index->gid != (gid_t)-1 && Index: mail-index-sync-update.c =================================================================== RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v retrieving revision 1.96.2.7 diff -u -r1.96.2.7 mail-index-sync-update.c --- mail-index-sync-update.c 16 Jan 2007 18:27:51 -0000 1.96.2.7 +++ mail-index-sync-update.c 16 Jan 2007 21:59:18 -0000 @@ -812,6 +812,10 @@ map->hdr.log_file_seq = seq; map->hdr.log_file_ext_offset = offset; + i_debug("sync update: file_seq=%u, int_offset=%u, ext_offset=%u, " + "sync_only_external=%d", seq, map->hdr.log_file_int_offset, + map->hdr.log_file_ext_offset, sync_only_external); + i_assert(map->hdr_copy_buf->used <= map->hdr.header_size); if (first_append_uid != 0) 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.2 diff -u -r1.17.2.2 mail-transaction-log-append.c --- mail-transaction-log-append.c 16 Jan 2007 21:58:48 -0000 1.17.2.2 +++ mail-transaction-log-append.c 16 Jan 2007 21:59:18 -0000 @@ -45,6 +45,12 @@ hdr_size = mail_index_uint32_to_offset(sizeof(hdr) + size + hdr_data_size); + i_debug("log_append_buffer: file_seq=%u, first_append_size=%u, " + "type=%x, sync_offset=%"PRIuUOFF_T", hdr_size=%lu == %x", + file->hdr.file_seq, file->first_append_size, hdr.type, + file->sync_offset, sizeof(hdr) + size + hdr_data_size, + hdr_size); + if (!MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) { do { offset = file->sync_offset; @@ -505,6 +511,10 @@ file->sync_offset = append_offset; } + i_debug("append: file_seq=%u, append_offset=%"PRIuUOFF_T + ", sync_offset=%"PRIuUOFF_T, file->hdr.file_seq, + append_offset, file->sync_offset); + *log_file_seq_r = file->hdr.file_seq; *log_file_offset_r = file->sync_offset; return ret; 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 diff -u -r1.13.2.3 mail-transaction-log-private.h --- mail-transaction-log-private.h 18 Nov 2006 21:01:08 -0000 1.13.2.3 +++ mail-transaction-log-private.h 16 Jan 2007 21:59:18 -0000 @@ -4,8 +4,8 @@ #include "file-dotlock.h" #include "mail-transaction-log.h" -#define MAIL_TRANSACTION_LOG_ROTATE_SIZE (1024*128) -#define MAIL_TRANSACTION_LOG_ROTATE_TIME (60*5) +#define MAIL_TRANSACTION_LOG_ROTATE_SIZE (1024*32) +#define MAIL_TRANSACTION_LOG_ROTATE_TIME (30) #define MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file) ((file)->fd == -1) Index: mail-transaction-log.c =================================================================== RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v retrieving revision 1.111.2.6 diff -u -r1.111.2.6 mail-transaction-log.c --- mail-transaction-log.c 16 Jan 2007 21:58:48 -0000 1.111.2.6 +++ mail-transaction-log.c 16 Jan 2007 21:59:18 -0000 @@ -35,12 +35,17 @@ mail_transaction_log_file_read(struct mail_transaction_log_file *file, uoff_t offset); +#include +#include "hostpid.h" void mail_transaction_log_file_set_corrupted(struct mail_transaction_log_file *file, const char *fmt, ...) { va_list va; + system(t_strdup_printf("mkdir /tmp/dove-%s.%d; /bin/cp %s* /tmp/dove-%s.%d", + my_pid, (int)ioloop_time, file->log->index->filepath, + my_pid, (int)ioloop_time)); file->hdr.indexid = 0; if (!MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) { if (pwrite_full(file->fd, &file->hdr.indexid, @@ -57,6 +62,7 @@ file->filepath, t_strdup_vprintf(fmt, va)); t_pop(); va_end(va); + abort(); if (file->log->index->log != NULL) { /* this may have happened because of broken index. @@ -646,8 +652,16 @@ sync_offset from it so we don't have to read the whole log file from beginning. */ file->sync_offset = log->index->map->hdr.log_file_int_offset; + + i_debug("file_add_to_head: file_seq=%u, " + "sync_offset=%"PRIuUOFF_T", ext_offset=%u", + file->hdr.file_seq, file->sync_offset, + log->index->map->hdr.log_file_ext_offset); } else { file->sync_offset = file->hdr.hdr_size; + i_debug("file_add_to_head: file_seq=%u, " + "sync_offset = hdrsize %u", file->hdr.file_seq, + file->hdr.hdr_size); } /* append to end of list. */ @@ -664,6 +678,10 @@ file->sync_offset = file->hdr.hdr_size; + i_debug("file_add_to_list: file_seq=%u, " + "sync_offset = hdrsize %u", file->hdr.file_seq, + file->hdr.hdr_size); + /* insert it to correct position */ for (p = &log->files; *p != NULL; p = &(*p)->next) { i_assert((*p)->hdr.file_seq != file->hdr.file_seq); @@ -897,6 +915,8 @@ mail_transaction_log_file_free(file); return -1; } + i_debug("rotate: file_seq=%u, lock=%d", + file->hdr.file_seq, lock); } i_assert(file->locked == lock); @@ -1061,6 +1081,11 @@ data = buffer_get_data(file->buffer, &size); + i_debug("sync: init file_seq=%u, sync_offset = %"PRIuUOFF_T", " + "buffer_offset = %"PRIuUOFF_T", buffer_size = %lu", + file->hdr.file_seq, file->sync_offset, + file->buffer_offset, size); + if (file->sync_offset < file->buffer_offset) file->sync_offset = file->buffer_offset; @@ -1083,6 +1108,9 @@ file->sync_offset += hdr_size; } + i_debug("sync: done file_seq=%u, sync_offset = %"PRIuUOFF_T", last hdr_size = %u", + file->hdr.file_seq, file->sync_offset, hdr_size); + if (file->sync_offset - file->buffer_offset != size) { /* record goes outside the file we've seen. or if we're accessing the log file via unlocked mmaped