mail-index-sync-update.c revision 68b3667c9ee95951d7c3e03b19b2d37abbaa5736
883N/A/* Copyright (c) 2004-2008 Dovecot authors, see the included COPYING file */ 883N/A/* If we have less than this many bytes to sync from log file, don't bother 883N/A reading the main index */ 883N/A /* previous transaction was an extension introduction. 883N/A we probably came here from 1273N/A mail_index_sync_ext_reset(). if there are any more 883N/A views which want to continue syncing it needs the 4561N/A intro. so back up a bit more. 4561N/A don't do this in case the last transaction in the 4561N/A log is the extension intro, so we don't keep trying 4561N/A to sync it over and over again. */ /* different seen-flag */ /* different deleted-flag */ *
error_r =
"Deleted counter wrong";
*
error_r =
"Deleted counter wrong";
for (i = 0; i <
count; i++) {
for (i = 0; i <
count; i++) {
/* call expunge handlers only when syncing index file */ for (i = 0; i <
count; i++,
eh++) {
/* FIXME: does expunge handler's return value matter? we probably shouldn't disallow expunges if the handler returns failure.. should it be just changed for (i = 0; i <
count; i++, e++) {
/* everything expunged already */ "Append with UID %u, but next_uid = %u",
/* move to memory. the mapping is written when unlocking so we don't waste time re-mmap()ing multiple times or waste space growing index /* the flags may have changed since it was added to map. use the updated flags already, so flag counters won't get /* don't rely on buffer->used being at the correct position. at least expunges can move it */ "Header update outside range: %u + %u > %u",
/* UIDVALIDITY can be changed only by resetting the index */ "uid_validity updated unexpectedly: %u -> %u",
/* let it through anyway, although this could give wrong "next_uid shrank" errors if the value actually changed.. */ "next_uid shrank ignored: %u -> %u",
/* the tail offset updates are intended for internal transaction log handling. we'll update the offset in the header only when /* this is simply a request for expunge */ /* should be just extra padding */ "ext intro: name_size too large");
"ext reset: invalid record size");
"ext hdr update: invalid record size");
"Extension record updated " /* the record is padded to 32bits in the transaction log */ "ext rec update: invalid record size");
"Unknown transaction record type 0x%x",
/* do we have dirty flags anymore? */ /* see if we'd prefer to reopen the index file instead of syncing the current map from the transaction log. don't check this if mmap is disabled, because reopening index causes sync to get lost. */ /* we don't know the index's size, so use the smallest index size we're willing to read */ /* this isn't necessary correct currently, but it should be /* can't use it. sync by re-reading index. */ /* view referenced the map. avoid unnecessary map cloning by unreferencing the map while view exists. */ /* if syncing updates the header, it updates hdr_copy_buf and updates hdr_base to hdr_copy_buf. so the buffer must initially contain a valid header or we'll break it when /* Reset the entire index. Leave only indexid and /* FIXME: when transaction sync lock is removed, we'll need to handle the case when a transaction is committed while mailbox is being synced ([synced transactions][new transaction][ext transaction]). this means int_offset contains [synced] and ext_offset contains /* this has been synced already. we're here only to call expunge handlers and extension update handlers. */ /* we'll just skip over broken entries */ /* transaction log tracks internally the current tail offset. besides using header updates, it also updates the offset to skip over following external transactions to avoid extra unneeded log /* restore refcount before closing the view. this is necessary also if map got cloned, because view closing would otherwise destroy it */ "Synchronization corrupted index header: %s",
/* make sure the index looks valid now */