30 Sep
2007
30 Sep
'07
3:39 p.m.
On Sun, 2007-09-30 at 14:10 +0200, Johannes Berg wrote:
The copy code has this:
keywords_list = mail_get_keywords(mail); keywords = strarray_length(keywords_list) == 0 ? NULL : mailbox_keywords_create(t, keywords_list); if (mailbox_copy(t, mail, mail_get_flags(mail), keywords, NULL) < 0) ret = mail->expunged ? 0 : -1; mailbox_keywords_free(t, &keywords);
I take it all the keywords handling is part of the mail and hence part of the transaction?
Right.
Also, you have src_trans = mailbox_transaction_begin(client->mailbox, 0);
is there no need to roll back that transaction if something fails? You don't seem to do so when e.g. mailbox_search_deinit fails but that still makes the COPY command return an error.
src_trans is used only for reading the mailbox. The only thing committing it does it to possibly update dovecot.index.cache file, which is a good thing to do always.
If mailbox_search_deinit() fails it could still mean that some mails were read and cache file could be updated for them.