[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.104, 1.105 mail-index-view.c, 1.51, 1.52
tss at dovecot.org
tss at dovecot.org
Thu Dec 28 20:55:02 UTC 2006
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv8139
Modified Files:
mail-index-sync-update.c mail-index-view.c
Log Message:
If there are transactions left while unlocking, don't unlock. Also added some
next_uid debugging.
Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- mail-index-sync-update.c 25 Nov 2006 22:12:11 -0000 1.104
+++ mail-index-sync-update.c 28 Dec 2006 20:54:59 -0000 1.105
@@ -291,6 +291,7 @@
map->hdr.next_uid = rec->uid+1;
map->records_count++;
view->hdr.messages_count++;
+ view->hdr.next_uid = rec->uid+1;
write_seq_update(map, map->hdr.messages_count, map->hdr.messages_count);
Index: mail-index-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- mail-index-view.c 10 Dec 2006 14:43:21 -0000 1.51
+++ mail-index-view.c 28 Dec 2006 20:54:59 -0000 1.52
@@ -53,10 +53,26 @@
i_free(view);
}
+#ifdef DEBUG
+static void mail_index_view_check_nextuid(struct mail_index_view *view)
+{
+ struct mail_index_record *rec;
+
+ if (view->hdr.messages_count == 0)
+ return;
+
+ rec = MAIL_INDEX_MAP_IDX(view->map, view->hdr.messages_count-1);
+ i_assert(rec->uid < view->hdr.next_uid);
+}
+#endif
+
int mail_index_view_lock_head(struct mail_index_view *view, bool update_index)
{
unsigned int lock_id;
+#ifdef DEBUG
+ mail_index_view_check_nextuid(view);
+#endif
if (MAIL_INDEX_MAP_IS_IN_MEMORY(view->index->map))
return 0;
@@ -95,6 +111,9 @@
if (view->map != view->index->map) {
/* not head mapping, no need to lock */
+#ifdef DEBUG
+ mail_index_view_check_nextuid(view);
+#endif
return 0;
}
@@ -103,7 +122,11 @@
void mail_index_view_unlock(struct mail_index_view *view)
{
- if (view->lock_id != 0) {
+#ifdef DEBUG
+ mail_index_view_check_nextuid(view);
+#endif
+
+ if (view->lock_id != 0 && view->transactions == 0) {
mail_index_unlock(view->index, view->lock_id);
view->lock_id = 0;
}
@@ -461,6 +484,9 @@
if (--view->refcount > 0)
return;
+ i_assert(view->transactions == 0);
+
+ mail_index_view_unlock(view);
view->v.close(view);
}
More information about the dovecot-cvs
mailing list