Skip to content

Commit

Permalink
lib-storage: Replace mail_transaction_commit_changes.changed with cha…
Browse files Browse the repository at this point in the history
…nges_mask

This allows better finding out what changed in the transaction.
  • Loading branch information
sirainen authored and cmouse committed Feb 13, 2018
1 parent 701a11e commit 8828d7a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/lib-storage/index/index-transaction.c
Expand Up @@ -56,8 +56,6 @@ index_transaction_index_commit(struct mail_index_transaction *index_trans,
} else if (t->box->v.transaction_save_commit_pre(t->save_ctx) < 0) {
t->save_ctx = NULL;
ret = -1;
} else {
t->changes->changed = TRUE;
}
}

Expand All @@ -73,9 +71,8 @@ index_transaction_index_commit(struct mail_index_transaction *index_trans,
if (t->super.commit(index_trans, result_r) < 0) {
mailbox_set_index_error(t->box);
ret = -1;
} else if (result_r->commit_size > 0) {
/* something was written to the transaction log */
t->changes->changed = TRUE;
} else {
t->changes->changes_mask = result_r->changes_mask;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/lib-storage/list/mailbox-list-index-status.c
Expand Up @@ -792,7 +792,8 @@ index_list_transaction_commit(struct mailbox_transaction_context *t,
return -1;
t = NULL;

if (!changes_r->changed)
/* check all changes here, because e.g. vsize update is _OTHERS */
if (changes_r->changes_mask == 0)
return 0;

/* this transaction commit may have been done in error handling path
Expand Down
4 changes: 2 additions & 2 deletions src/lib-storage/mail-storage.h
Expand Up @@ -343,8 +343,8 @@ struct mail_transaction_commit_changes {
/* number of modseq changes that couldn't be changed as requested */
unsigned int ignored_modseq_changes;

/* TRUE if anything actually changed with this commit */
bool changed;
/* Changes that occurred within this transaction */
enum mail_index_transaction_change changes_mask;
/* User doesn't have read ACL for the mailbox, so don't show the
uid_validity / saved_uids. */
bool no_read_perm;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/replication/replication-plugin.c
Expand Up @@ -262,7 +262,7 @@ replication_mail_transaction_commit(void *txn,
enum replication_priority priority;

if (ruser != NULL && !ctx->sync_trans &&
(ctx->new_messages || changes->changed)) {
(ctx->new_messages || changes->changes_mask != 0)) {
priority = !ctx->new_messages ? REPLICATION_PRIORITY_LOW :
ruser->sync_secs == 0 ? REPLICATION_PRIORITY_HIGH :
REPLICATION_PRIORITY_SYNC;
Expand Down

0 comments on commit 8828d7a

Please sign in to comment.