[dovecot-cvs] dovecot/src/lib-index mail-index-transaction-private.h, 1.11, 1.12 mail-index-transaction.c, 1.24, 1.25 mail-transaction-log.c, 1.57, 1.58

cras at dovecot.org cras at dovecot.org
Sun Sep 12 13:34:59 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv31824

Modified Files:
	mail-index-transaction-private.h mail-index-transaction.c 
	mail-transaction-log.c 
Log Message:
We didn't include extra_rec_updates at checking if transaction had changed
anything, and so they didn't necessarily get written to transaction log.
This broke mbox offsets sometimes.



Index: mail-index-transaction-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction-private.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mail-index-transaction-private.h	5 Sep 2004 17:53:45 -0000	1.11
+++ mail-index-transaction-private.h	12 Sep 2004 10:34:57 -0000	1.12
@@ -29,6 +29,7 @@
 
 	unsigned int hide_transaction:1;
 	unsigned int hdr_changed:1;
+	unsigned int log_updates:1;
 };
 
 struct mail_index_record *

Index: mail-index-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- mail-index-transaction.c	11 Sep 2004 18:14:24 -0000	1.24
+++ mail-index-transaction.c	12 Sep 2004 10:34:57 -0000	1.25
@@ -197,6 +197,8 @@
 {
         struct mail_index_record *rec;
 
+	t->log_updates = TRUE;
+
 	if (t->appends == NULL) {
 		t->appends = buffer_create_dynamic(default_pool,
 						   4096, (size_t)-1);
@@ -248,6 +250,7 @@
 
 	i_assert(seq > 0 && seq <= mail_index_view_get_message_count(t->view));
 
+	t->log_updates = TRUE;
 	exp.uid1 = exp.uid2 = seq;
 
 	/* expunges is a sorted array of {seq1, seq2, ..}, .. */
@@ -368,6 +371,8 @@
 {
 	struct mail_index_record *rec;
 
+	t->log_updates = TRUE;
+
 	if (seq >= t->first_new_seq) {
 		/* just appended message, modify it directly */
                 rec = mail_index_transaction_lookup(t, seq);
@@ -585,6 +590,8 @@
 void mail_index_reset_cache(struct mail_index_transaction *t,
 			    uint32_t new_file_seq)
 {
+	t->log_updates = TRUE;
+
 	mail_index_transaction_reset_cache_updates(t);
 	t->new_cache_file_seq = new_file_seq;
         t->last_cache_file_seq = new_file_seq;
@@ -600,6 +607,8 @@
 		 (seq <= mail_index_view_get_message_count(t->view) ||
 		  seq <= t->last_new_seq));
 
+	t->log_updates = TRUE;
+
 	if (file_seq != t->last_cache_file_seq) {
 		mail_index_transaction_reset_cache_updates(t);
                 t->last_cache_file_seq = file_seq;
@@ -662,6 +671,8 @@
 		  seq <= t->last_new_seq));
 	i_assert(data_id < index->extra_infos->used / sizeof(*einfo));
 
+	t->log_updates = TRUE;
+
 	einfo = index->extra_infos->data;
 	einfo += data_id;
 
@@ -682,6 +693,7 @@
 	i_assert(size <= sizeof(t->hdr_change) - offset);
 
 	t->hdr_changed = TRUE;
+	t->log_updates = TRUE;
 
 	memcpy(t->hdr_change + offset, data, size);
 	for (; size > 0; size--)

Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- mail-transaction-log.c	11 Sep 2004 21:54:15 -0000	1.57
+++ mail-transaction-log.c	12 Sep 2004 10:34:57 -0000	1.58
@@ -1228,9 +1228,7 @@
 	index = mail_index_view_get_index(view);
 	log = index->log;
 
-	if (t->updates == NULL && t->new_cache_file_seq == 0 &&
-	    t->cache_updates == NULL && t->expunges == NULL &&
-	    t->appends == NULL && !t->hdr_changed) {
+	if (!t->log_updates) {
 		/* nothing to append */
 		*log_file_seq_r = 0;
 		*log_file_offset_r = 0;



More information about the dovecot-cvs mailing list