mail-index-sync.c revision 686c00553a7cea22272548d9fb8c888170965ec9
970N/A/* Copyright (c) 2003-2009 Dovecot authors, see the included COPYING file */ 970N/A /* FIXME: mail_index_update_keywords_range() */ 1316N/A /* show dirty flags as flag updates */ 1132N/A /* read all transactions from log into a transaction in memory. 1132N/A skip the external ones, they're already synced to mailbox and 1132N/A /* create an array containing all expunge, flag and keyword update 1132N/A arrays so we can easily go through all of the changes. */ 1153N/A /* we must return resets before keyword additions or they get lost */ 1153N/A /* sync only if there's something to do */ 970N/A /* we want to sync up to transaction log's head */ 970N/A /* either corrupted or the file was deleted for 970N/A some reason. either way, we can't go forward */ 970N/A "Unexpected transaction log desync with index %s",
1261N/A /* if we require changes, don't lock transaction log yet. first check 1152N/A if there's anything to sync. */ 1261N/A /* The view must contain what we expect the mailbox to look like 1261N/A currently. That allows the backend to update external flag 970N/A changes (etc.) if the view doesn't match the mailbox. 970N/A We'll update the view to contain everything that exist in the 970N/A transaction log except for expunges. They're synced in 1152N/A mail_index_sync_commit(). */ 1153N/A /* it looks like we have something to sync. lock the file and 1130N/A /* broken sync positions. fix them. */ 1130N/A "broken sync positions in index file %s",
1130N/A /* we wish to see all the changes from last mailbox sync position to 970N/A the end of the transaction log */ 970N/A /* if a log file is missing, there's nothing we can do except 1139N/A to skip over it. fix the problem with fsck and try again. */ 1356N/A /* we need to have all the transactions sorted to optimize 970N/A caller's mailbox access patterns */ 970N/A /* create the transaction after the view has been updated with 1130N/A external transactions and marked as sync view */ 970N/A /* let the actual syncing handle the error */ 1207N/A /* extension record updates aren't exactly needed 1207N/A to be synced, but cache syncing relies on tail /* FIXME: replace with a priority queue so we don't have to go through the whole list constantly. and remember to make sure that keyword resets are sent before adds! */ for (i = 0; i <
count; i++) {
if (
next_i == (
unsigned int)-
1) {
/* nothing left in sync_list */ for (i = 0; i <
count; i++) {
for (i = 0; i <
count; i++)
/* didn't sync everything */ /* synced everything, but we might also have committed new transactions. include them also here. */ /* If tail offset has changed, make sure it gets written to /* if cache compression fails, we don't really care. the cache offsets are updated only if the compression was /* refresh the mapping with newly committed external transactions and the synced expunges. sync using file handler here so that the expunge handlers get called. */ for (i = 0; i <
count; i++) {
for (i = 0; i <
count; i++) {
"Log synchronization error at "