if (t->updates == NULL && t->cache_updates == NULL &&
t->expunges == NULL && t->appends == NULL) {
/* nothing to append */
- *log_file_seq_r = log->head->hdr.file_seq;
- *log_file_offset_r = log->head->hdr.used_size;
+ *log_file_seq_r = 0;
+ *log_file_offset_r = 0;
return 0;
}
/* Write data to transaction log. This is atomic operation. Sequences in
updates[] and expunges[] are relative to given view, they're modified
- to real ones. */
+ to real ones. If nothing is written, log_file_seq_r and log_file_offset_r
+ will be set to 0. */
int mail_transaction_log_append(struct mail_index_transaction *t,
uint32_t *log_file_seq_r,
uoff_t *log_file_offset_r);
if (ret < 0)
mail_storage_set_index_error(t->ibox);
- t->ibox->commit_log_file_seq = seq;
- t->ibox->commit_log_file_offset = offset;
+ if (seq != 0) {
+ t->ibox->commit_log_file_seq = seq;
+ t->ibox->commit_log_file_offset = offset;
+ }
index_transaction_free(t);
return ret;
if (mail_index_transaction_commit(trans, &seq, &offset) < 0)
mail_storage_set_index_error(ibox);
- else {
+ else if (seq != 0) {
ibox->commit_log_file_seq = seq;
ibox->commit_log_file_offset = offset;
}
else {
if (mail_index_transaction_commit(t, &seq, &offset) < 0)
ret = -1;
- else {
+ else if (seq != 0) {
ibox->commit_log_file_seq = seq;
ibox->commit_log_file_offset = offset;
}