Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6822:f814eecd75cd HEAD
When reading an index file created by v1.0, make sure we update the header
version and write the main index.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 16 Nov 2007 20:19:40 +0200 |
parents | eebfe0cd2add |
children | ee1c4c3d5e5a |
files | src/lib-index/mail-index-map.c src/lib-index/mail-index-sync.c |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-map.c Fri Nov 16 20:11:05 2007 +0200 +++ b/src/lib-index/mail-index-map.c Fri Nov 16 20:19:40 2007 +0200 @@ -441,9 +441,13 @@ if (hdr->seen_messages_count > hdr->messages_count || hdr->deleted_messages_count > hdr->messages_count) return 0; - if (hdr->first_recent_uid == 0 && hdr->minor_version == 0) { + if (hdr->minor_version == 0) { /* upgrade silently from v1.0 */ - map->hdr.first_recent_uid = 1; + map->hdr.minor_version = MAIL_INDEX_MINOR_VERSION; + map->hdr.unused_old_recent_messages_count = 0; + if (hdr->first_recent_uid == 0) + map->hdr.first_recent_uid = 1; + index->need_recreate = TRUE; } if (hdr->first_recent_uid == 0 || hdr->first_recent_uid > hdr->next_uid ||
--- a/src/lib-index/mail-index-sync.c Fri Nov 16 20:11:05 2007 +0200 +++ b/src/lib-index/mail-index-sync.c Fri Nov 16 20:19:40 2007 +0200 @@ -278,6 +278,9 @@ hdr->log_file_seq < log_file_seq) return TRUE; + if (index->need_recreate) + return TRUE; + /* already synced */ return mail_cache_need_compress(index->cache); }