mail-transaction-log-file.c revision 66ecc94150cbce23aad3240135e0782e0a74d479
/* indexid=0 marks the log file as corrupted */ "Corrupted transaction log file %s seq %u: %s " /* we can get a valid log offset from index file. initialize sync_offset from it so we don't have to read the whole log "%s: log_file_head_offset too small",
/* modseqs not used yet */ /* highest_modseq not synced, start from beginning */ "%s: modseq_hdr.log_offset too large",
/* start from where we last stopped tracking modseqs */ /* insert it to correct position */ /* not creating index - make sure we have latest header */ /* if we got here from mapping, the .log file is corrupted. use whatever values we got from index /* make sure the sequence grows */ /* this should be always up-to-date */ "file_dotlock_create()");
"Timeout while waiting for " "dotlock for transaction log file %s",
"Dotlock was lost for transaction log file %s",
"mail_index_wait_lock_fd()");
"Timeout while waiting for lock for transaction log file %s",
/* try to read the whole header, but it's not necessarily an error to read less since the older versions of the log format could be /* incompatible version - fix silently */ "unexpected end of file while reading header");
/* we have compatibility flags */ /* architecture change */ "Rebuilding index file %s: " "CPU architecture changed",
"Header size too small");
/* @UNSAFE: smaller than we expected - zero out the fields we "Transaction log file %s: marked corrupted",
/* index file was probably just rebuilt and we don't "indexid changed %u -> %u",
/* creating index file. since transaction log is created first, use the indexid in it to create the main index /* make sure we already don't have a file with the same sequence opened. it shouldn't happen unless the old log file was /* mark the old file corrupted. we can't safely remove it from the list however, so return failure. */ "duplicate transaction log sequence (%u)",
/* although we check also mtime and file size below, it's done only to fix broken log files. we don't bother flushing attribute cache just for that. */ /* log creation is locked now - see if someone already created it. note that if we're rotating, we need to keep the log locked until the file has been rewritten. and because fcntl() locks are stupid, if we go and open()+close() the file and we had it already opened, its locks are lost. so we use stat() to check if the file has been recreated, although it almost never is. */ /* inode/dev checks are enough when we're rotating the file, but not when we're replacing a broken log file */ /* no-one else recreated the file */ /* recreated. use the file if its header is ok */ /* don't reset modseqs. if we're reseting due to rebuilding indexes we'll probably want to keep uidvalidity and in such cases we really don't want to shrink modseqs. */ /* the header isn't important, so don't bother calling fdatasync() unless NFS is used */ /* we'll need to preserve the lock */ /* if we return -1 the dotlock deletion code closes the fd */ /* rename() would be nice and easy way to do this, except then there's a race condition between the rename and file_dotlock_replace(). during that time the log file doesn't exist, which could cause problems. */ /* try to link() anyway */ /* ignore the error. we don't care that much about the second log file and we're going to overwrite this /* With dotlocking we might already have path.lock created, so this filename has to be different. */ /* either fd gets used or the dotlock gets deleted and returned fd is for the existing file */ "header update extends beyond record size");
/* saved_tail_offset was already set in header, but we still had to resync the file to find modseqs. ignore this record. */ "Transaction log file %s seq %u: " "log_file_tail_offset update shrank it " /* modseqs not tracked yet. see if this is a modseq extension introduction. */ /* modseq tracking started */ /* not tracking modseqs */ /* ignore expunge requests */ /* these changes increase modseq */ /* @UNSAFE: move it to top */ unsigned int i,
best = -
1U;
unsigned int i,
best = -
1U;
/* we've already synced this record at some point. it should "Transaction log corrupted unexpectedly at " /* nothing usable in cache - scan from beginning */ /* use cache to skip over some records */ "%s: Transaction log corrupted, can't get modseq",
/* @UNSAFE: cache the value */ /* nothing usable in cache - scan from beginning */ /* use cache to skip over some records */ "%s: Transaction log corrupted, can't get modseq",
/* if we got to sync_offset, cur_modseq should be "%s: Transaction log changed unexpectedly, " /* @UNSAFE: cache the value */ /* external transactions: */ /* see if this updates mailbox_sync_offset */ /* external transactions aren't synced to mailbox. we can update mailbox sync offset to skip this transaction to avoid re-reading it at the next sync. */ /* transaction has been fully written */ /* Now that all the mmaped pages have page faulted, check if the file had changed while doing that. Only after the last page has faulted, the size returned by fstat() can be trusted. Otherwise it might point to a page boundary while the next page is still being written. Without this check we might see partial transactions, sometimes causing "Extension record updated without intro /* There's more data than we could sync at the moment. If the last record's size wasn't valid, we can't know if it will be updated unless we've locked the log. */ /* pread()s or the above fstat() check for mmaps should have guaranteed that this doesn't happen */ "Unexpected garbage at EOF");
/* The size field will be updated soon */ "Invalid transaction log size " /* failure. don't leave ourself to inconsistent state */ /* log file was deleted in NFS server, fail silently */ /* log file was deleted in NFS server, fail silently */ /* we already have a newer log file which says that we haven't synced the entire file. */ /* NFS: if file isn't locked, we're optimistic that we can read enough data without flushing attribute cache. if after reading we notice that we really should have read more, flush the cache and try again. if file is locked, the attribute cache was already flushed when /* we have to insert missing data to beginning of buffer */ /* we didn't read enough data. flush and try again. */ /* broken start offset */ /* in case we just switched to mmaping */ /* we are going to mmap() this file, but it's not necessarily /* we already have the whole file mapped */ /* size changed, re-mmap */ /* just reading the file is probably faster */ /* we're not interested of going further than sync_offset */ /* see if we already have it */ /* we had moved the log to memory but failed to read the beginning of the log file */ "%s: Beginning of the log isn't available",
/* although we could just skip over the unwanted data, we have to sync everything so that modseqs are calculated /* just copy to memory */ /* we don't have the full log in the memory. read it. */