mail-index-sync-update.c revision 02d6628c1fea2990c67c60b111c8e68867160885
294N/A/* Copyright (c) 2004-2016 Dovecot authors, see the included COPYING file */ 789N/A/* If we have less than this many bytes to sync from log file, don't bother 294N/A reading the main index */ 789N/A /* handling lost changes in view syncing */ 789N/A /* previous transaction was an extension introduction. 873N/A we probably came here from 1336N/A mail_index_sync_ext_reset(). if there are any more 1336N/A views which want to continue syncing it needs the 1336N/A intro. so back up a bit more. 1336N/A don't do this in case the last transaction in the 1336N/A log is the extension intro, so we don't keep trying 1336N/A to sync it over and over again. */ 789N/A /* different seen-flag */ 787N/A /* different deleted-flag */ 869N/A /* FIXME: does expunge handler's return value matter? 941N/A we probably shouldn't disallow expunges if the 1086N/A handler returns failure.. should it be just changed 1109N/A /* call expunge handlers only when syncing index file */ 1336N/A /* call the expunge handlers first */ 789N/A /* @UNSAFE: move (prev_seq2+1) .. (seq1-1) to its 789N/A final location in the map if necessary */ 1114N/A /* we'll return TRUE if this modseq change was written within the 789N/A transaction that was just committed */ 789N/A "modseqs updated before they were enabled");
1155N/A "Append with UID %u, but next_uid = %u",
1155N/A /* move to memory. the mapping is written when unlocking so we don't 1155N/A waste time re-mmap()ing multiple times or waste space growing index 789N/A /* the flags may have changed since it was added to map. 789N/A use the updated flags already, so flag counters won't get 1155N/A /* don't rely on buffer->used being at the correct position. 1155N/A at least expunges can move it */ 789N/A "Header update outside range: %u + %u > %u",
789N/A /* next_uid update tried to shrink its value. this can happen 789N/A in some race conditions with e.g. with dsync, so just 789N/A /* the tail offset updates are intended for internal transaction 789N/A log handling. we'll update the offset in the header only when 789N/A the sync is finished. */ 789N/A /* this is simply a request for expunge */ 1339N/A /* this is simply a request for expunge */ 789N/A /* should be just extra padding */ 789N/A /* name_size checked by _log_view_next() */ 873N/A /* old versions have only new_reset_id */ 1086N/A "ext reset: invalid record size");
857N/A "ext hdr update: invalid record size");
1339N/A "ext hdr update: invalid record size");
294N/A "Extension record updated " 294N/A "without intro prefix");
1114N/A /* the record is padded to 32bits in the transaction log */ 294N/A "ext rec update: invalid record size");
294N/A "Extension record updated " 294N/A "without intro prefix");
789N/A /* next sync finishes the deletion */ 789N/A /* transaction log reading handles this */ 1086N/A "Unknown transaction record type 0x%x",
789N/A /* 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 /* if we failed because of a syscall error, make sure /* can't use it. sync by re-reading index. */ /* we're reading more from log than we would have preferred. remember that we probably want to rewrite index soon. */ /* 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: %s",
/* make sure the index looks valid now */