Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-index/mail-index.c @ 3833:318c70c1d4ec HEAD
Beginnings of fallbacking to in-memory indexes when write fails with "out of
disk space" error.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 07 Jan 2006 01:48:57 +0200 |
parents | 76f4be7ae499 |
children | 55df57c028d4 |
line wrap: on
line diff
--- a/src/lib-index/mail-index.c Sat Jan 07 00:31:40 2006 +0200 +++ b/src/lib-index/mail-index.c Sat Jan 07 01:48:57 2006 +0200 @@ -1410,8 +1410,11 @@ lock_id = 0; } if (!MAIL_INDEX_IS_IN_MEMORY(index)) { - if (mail_index_create(index, &hdr) < 0) - return -1; + if (mail_index_create(index, &hdr) < 0) { + /* fallback to in-memory index */ + mail_index_move_to_memory(index); + mail_index_create_in_memory(index, &hdr); + } } else { mail_index_create_in_memory(index, &hdr); } @@ -1691,6 +1694,12 @@ index->indexid = 0; } +int mail_index_move_to_memory(struct mail_index *index) +{ + i_free_and_null(index->dir); + return mail_transaction_log_move_to_memory(index->log); +} + void mail_index_mark_corrupted(struct mail_index *index) { struct mail_index_header hdr;