Mercurial > dovecot > core-2.2
changeset 2073:a58c51c8f37b HEAD
Don't complain about transaction log indexid changes when rebuilding index.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 28 May 2004 04:04:01 +0300 |
parents | 69cef820735f |
children | cb5269c052e0 |
files | src/lib-index/mail-index-private.h src/lib-index/mail-index.c src/lib-index/mail-transaction-log.c |
diffstat | 3 files changed, 29 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-private.h Wed May 26 23:13:12 2004 +0300 +++ b/src/lib-index/mail-index-private.h Fri May 28 04:04:01 2004 +0300 @@ -73,7 +73,6 @@ unsigned int fsck:1; }; -void mail_index_header_init(struct mail_index_header *hdr); int mail_index_write_header(struct mail_index *index, const struct mail_index_header *hdr);
--- a/src/lib-index/mail-index.c Wed May 26 23:13:12 2004 +0300 +++ b/src/lib-index/mail-index.c Fri May 28 04:04:01 2004 +0300 @@ -425,28 +425,6 @@ return ret; } -void mail_index_header_init(struct mail_index_header *hdr) -{ - time_t now = time(NULL); - - memset(hdr, 0, sizeof(*hdr)); - - hdr->major_version = MAIL_INDEX_MAJOR_VERSION; - hdr->minor_version = MAIL_INDEX_MINOR_VERSION; - hdr->header_size = sizeof(*hdr); - -#ifndef WORDS_BIGENDIAN - hdr->compat_data[0] = MAIL_INDEX_COMPAT_LITTLE_ENDIAN; -#endif - hdr->compat_data[1] = sizeof(uoff_t); - hdr->compat_data[2] = sizeof(time_t); - hdr->compat_data[3] = sizeof(keywords_mask_t); - - hdr->indexid = now; - - hdr->next_uid = 1; -} - int mail_index_write_header(struct mail_index *index, const struct mail_index_header *hdr) { @@ -545,6 +523,28 @@ return 1; } +static void mail_index_header_init(struct mail_index_header *hdr) +{ + time_t now = time(NULL); + + memset(hdr, 0, sizeof(*hdr)); + + hdr->major_version = MAIL_INDEX_MAJOR_VERSION; + hdr->minor_version = MAIL_INDEX_MINOR_VERSION; + hdr->header_size = sizeof(*hdr); + +#ifndef WORDS_BIGENDIAN + hdr->compat_data[0] = MAIL_INDEX_COMPAT_LITTLE_ENDIAN; +#endif + hdr->compat_data[1] = sizeof(uoff_t); + hdr->compat_data[2] = sizeof(time_t); + hdr->compat_data[3] = sizeof(keywords_mask_t); + + hdr->indexid = now; + + hdr->next_uid = 1; +} + static int mail_index_open_files(struct mail_index *index, enum mail_index_open_flags flags) {
--- a/src/lib-index/mail-transaction-log.c Wed May 26 23:13:12 2004 +0300 +++ b/src/lib-index/mail-transaction-log.c Fri May 28 04:04:01 2004 +0300 @@ -307,12 +307,13 @@ file->filepath); return 0; } - if (file->hdr.indexid != file->log->index->indexid && - file->log->index->indexid != 0) { - /* either index was just recreated, or transaction has wrong - indexid. we don't know here which one is the case, so we'll - just fail. If index->indexid == 0, we're rebuilding it and - we just want to lock the transaction log. */ + if (file->hdr.indexid != file->log->index->indexid) { + if (file->log->index->fd == -1) { + /* creating index file, silently rebuild + transaction log as well */ + return 0; + } + mail_index_set_error(file->log->index, "Transaction log file %s: invalid indexid (%u != %u)", file->filepath, file->hdr.indexid,