[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.96.2.16, 1.96.2.17 mail-index-view-sync.c, 1.52.2.9, 1.52.2.10
tss at dovecot.org
tss at dovecot.org
Sat Mar 10 20:48:48 EET 2007
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv8876
Modified Files:
Tag: branch_1_0
mail-index-sync-update.c mail-index-view-sync.c
Log Message:
View syncing fixes.
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.16
retrieving revision 1.96.2.17
diff -u -d -r1.96.2.16 -r1.96.2.17
--- mail-index-sync-update.c 10 Mar 2007 18:25:21 -0000 1.96.2.16
+++ mail-index-sync-update.c 10 Mar 2007 18:48:45 -0000 1.96.2.17
@@ -35,9 +35,11 @@
prev_offset = ctx->ext_intro_offset;
}
- if (!ctx->sync_only_external)
+ if (!ctx->sync_only_external) {
+ i_assert(prev_offset >= map->hdr.log_file_int_offset ||
+ prev_seq > map->hdr.log_file_seq);
map->hdr.log_file_int_offset = prev_offset;
- else if (map->hdr.log_file_seq != prev_seq) {
+ } else if (map->hdr.log_file_seq != prev_seq) {
/* log sequence changed. update internal offset to
beginning of the new file. */
i_assert(map->hdr.log_file_int_offset ==
@@ -45,8 +47,17 @@
map->hdr.log_file_int_offset =
ctx->view->index->log->head->hdr.hdr_size;
}
- map->hdr.log_file_seq = prev_seq;
- map->hdr.log_file_ext_offset = prev_offset;
+
+ /* we might be in the middle of syncing internal transactions, with
+ some of the following external transactions already synced. */
+ i_assert(prev_seq > map->hdr.log_file_seq ||
+ prev_offset >= map->hdr.log_file_ext_offset ||
+ (!eol && !ctx->sync_only_external));
+ if (map->hdr.log_file_seq != prev_seq ||
+ prev_offset > map->hdr.log_file_ext_offset) {
+ map->hdr.log_file_seq = prev_seq;
+ map->hdr.log_file_ext_offset = prev_offset;
+ }
}
static int
Index: mail-index-view-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-sync.c,v
retrieving revision 1.52.2.9
retrieving revision 1.52.2.10
diff -u -d -r1.52.2.9 -r1.52.2.10
--- mail-index-view-sync.c 10 Mar 2007 18:46:54 -0000 1.52.2.9
+++ mail-index-view-sync.c 10 Mar 2007 18:48:45 -0000 1.52.2.10
@@ -403,7 +403,7 @@
uint32_t seq;
uoff_t offset;
int ret;
- bool skipped;
+ bool skipped, synced_to_map;
for (;;) {
/* Get the next transaction from log. */
@@ -449,6 +449,15 @@
offset);
}
+ /* if we started from a map that we didn't create ourself,
+ some of the external transactions may already be synced.
+ at the end of view sync we'll update the ext_offset in the
+ header so that this check always becomes FALSE for
+ subsequent syncs. */
+ synced_to_map = offset < view->hdr.log_file_ext_offset &&
+ seq == view->hdr.log_file_seq &&
+ (ctx->hdr->type & MAIL_TRANSACTION_EXTERNAL) != 0;
+
/* Apply transaction to view's mapping if needed (meaning we
didn't just re-map the view to head mapping). */
if (ctx->sync_map_update) {
@@ -644,6 +653,13 @@
view->map = view->sync_new_map;
view->sync_new_map = NULL;
}
+
+ if (ctx->sync_map_update) {
+ view->map->hdr.log_file_seq = view->log_file_seq;
+ view->map->hdr.log_file_int_offset =
+ view->map->hdr.log_file_ext_offset =
+ view->log_file_offset;
+ }
view->hdr = view->map->hdr;
#ifdef DEBUG
More information about the dovecot-cvs
mailing list