All the messages until trans->first_new_seq no longer exist after reset.
At best they cause confusion and are ignored. They could also point to
high UIDs that the rebuilding removes, causing further corruption errors.
removed. */
first_new_seq = mail_cache_get_first_new_seq(view);
message_count = mail_index_view_get_messages_count(view);
+ if (!trans->reset)
+ seq = 1;
+ else {
+ /* Index is being rebuilt. Ignore old messages. */
+ seq = trans->first_new_seq;
+ }
i_array_init(ext_offsets, message_count); record_count = 0;
- for (seq = 1; seq <= message_count; seq++) {
+ for (; seq <= message_count; seq++) {
if (mail_index_transaction_is_expunged(trans, seq)) {
array_append_zero(ext_offsets);
continue;