? DEADJOE
? diff
? idxview
? idxview.c
? logview
? logview.c
? m
? old
Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.116
diff -u -r1.116 mail-index-sync-update.c
--- mail-index-sync-update.c	11 Mar 2007 16:10:41 -0000	1.116
+++ mail-index-sync-update.c	14 Mar 2007 13:50:28 -0000
@@ -58,6 +58,7 @@
 		map->hdr.log_file_seq = prev_seq;
 		map->hdr.log_file_ext_offset = prev_offset;
 	}
+	i_debug("%p: update_log_offset seq=%u int=%llu ext=%llu", map, map->hdr.log_file_seq, map->hdr.log_file_int_offset, map->hdr.log_file_ext_offset);
 }
 
 static int
@@ -118,6 +119,7 @@
 	/* some views may still use the same mapping, and since we could have
 	   already updated the records, make sure we leave the header in a
 	   valid state as well */
+	i_debug("replacing map: %p -> %p", old_map, map);
 	mail_index_sync_update_log_offset(ctx, old_map, FALSE);
 	(void)mail_index_map_msync(view->index, old_map);
 	mail_index_unmap(view->index, &old_map);
@@ -349,6 +351,7 @@
 		mail_index_sync_set_corrupted(ctx,
 			"Append with UID %u, but next_uid = %u",
 			rec->uid, map->hdr.next_uid);
+		abort();
 		return -1;
 	}
 
@@ -893,6 +896,15 @@
 			}
 		}
 
+		{
+			uint32_t prev_seq;
+			uoff_t prev_offset;
+
+			mail_transaction_log_view_get_prev_pos(view->log_view, &prev_seq,
+							       &prev_offset);
+		i_debug("%p: sync_update seq=%u offset=%llu type=%x",
+			view->map, prev_seq, prev_offset, thdr->type);
+		}
 		if (mail_index_sync_record(&sync_map_ctx, thdr, data) < 0) {
 			ret = -1;
 			break;
@@ -916,6 +928,8 @@
 	i_assert(map->records_count == map->hdr.messages_count);
 	i_assert(map->hdr_copy_buf->used <= map->hdr.header_size);
 
+	i_debug("%p: sync_update seq=%u int=%llu ext=%llu", map, map->hdr.log_file_seq, map->hdr.log_file_int_offset, map->hdr.log_file_ext_offset);
+
 	if (first_append_uid != 0)
 		mail_index_update_day_headers(&map->hdr, first_append_uid);
 
Index: mail-index-view-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-sync.c,v
retrieving revision 1.67
diff -u -r1.67 mail-index-view-sync.c
--- mail-index-view-sync.c	14 Mar 2007 13:49:21 -0000	1.67
+++ mail-index-view-sync.c	14 Mar 2007 13:50:28 -0000
@@ -23,6 +23,27 @@
 	unsigned int sync_map_update:1;
 };
 
+#include <sys/time.h>
+#include <stdio.h>
+#include <unistd.h>
+void i_debug(const char *format, ...)
+{
+	/*static FILE *f = NULL;
+	va_list args;
+	struct timeval tv;
+
+	gettimeofday(&tv, NULL);
+
+	va_start(args, format);
+	t_push();
+	if (!f) f = fopen(t_strdup_printf("/tmp/dovecot.%d", getpid()), "a+");
+	fprintf(f, "%10u.%06u PID=%s %s\n",
+		(unsigned)tv.tv_sec, (unsigned)tv.tv_usec,
+		dec2str(getpid()), t_strdup_vprintf(format, args));
+	t_pop();
+	va_end(args);*/
+}
+
 static void
 mail_transaction_log_sort_expunges(ARRAY_TYPE(seq_range) *expunges,
 				   const struct seq_range *src, size_t src_size)
@@ -456,6 +477,8 @@
 			i_assert((ctx->hdr->type &
 				  MAIL_TRANSACTION_EXPUNGE) == 0);
 
+			i_debug("%p: sync record seq=%u offset=%llu type=%x",
+				view->map, seq, offset, ctx->hdr->type);
 			if (mail_index_sync_record(&ctx->sync_map_ctx,
 						   ctx->hdr, ctx->data) < 0)
 				return -1;
@@ -664,6 +687,10 @@
 		view->map->hdr.log_file_int_offset = view->log_file_offset;
 	}
 	view->hdr = view->map->hdr;
+	i_debug("%p: view_sync_end seq=%u int=%llu ext=%llu",
+		view->map, view->map->hdr.log_file_seq,
+		view->map->hdr.log_file_int_offset,
+		view->map->hdr.log_file_ext_offset);
 
 #ifdef DEBUG
 	if (!view->broken_counters && !ctx->sync_map_ctx.unreliable_flags)
Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.268
diff -u -r1.268 mail-index.c
--- mail-index.c	11 Mar 2007 16:10:42 -0000	1.268
+++ mail-index.c	14 Mar 2007 13:50:29 -0000
@@ -1273,6 +1273,8 @@
 	mem_map->hdr = *hdr;
 	mem_map->hdr_base = hdr;
 
+	i_debug("%p: cloned from %p: seq=%u int=%llu ext=%llu", mem_map, map, mem_map->hdr.log_file_seq, mem_map->hdr.log_file_int_offset, mem_map->hdr.log_file_ext_offset);
+
 	/* if we're syncing transaction log into memory and later use the
 	   mapping for updating the index, we need to remember what has
 	   changed */
