If we mmap()ed the index file, the map is returned locked.
- Returns 1 = ok, 0 = corrupted, -1 = error. */
+ Returns 1 = ok, 0 = unusably corrupted, -1 = error. Corrupted records inside
+ the transaction log file doesn't cause this function to fail. */
int mail_index_map(struct mail_index *index,
enum mail_index_sync_handler_type type);
/* Unreference given mapping and unmap it if it's dropped to zero. */
void mail_index_sync_map_deinit(struct mail_index_sync_map_ctx *sync_map_ctx);
bool mail_index_sync_map_want_index_reopen(struct mail_index_map *map,
enum mail_index_sync_handler_type type);
+/* Returns 1 if synced, 0 if map's log file is lost (or more likely, seq number
+ is corrupted), -1 on I/O error. Corrupted records inside the transaction log
+ file doesn't cause this function to fail. */
int mail_index_sync_map(struct mail_index_map **_map,
enum mail_index_sync_handler_type type,
const char **reason_r);
}
map = NULL;
+ /* mail_transaction_log_view_next() returns -1 on corruption.
+ Since the log file content before the corruption was found can be
+ useful and important, we don't fail this sync entirely. Instead,
+ we'll just mark the rest of the log file as synced. */
while ((ret = mail_transaction_log_view_next(view->log_view, &thdr,
&tdata)) > 0) {
mail_transaction_log_view_get_prev_pos(view->log_view,
uint32_t oldest_file_seq);
/* Read next transaction record from current position. The position is updated.
- Returns -1 if error, 0 if we're at end of the view, 1 if ok. */
+ Returns -1 if log is corrupted, 0 if we're at end of the view, 1 if ok. */
int mail_transaction_log_view_next(struct mail_transaction_log_view *view,
const struct mail_transaction_header **hdr_r,
const void **data_r);