Timo Sirainen [Mon, 31 Oct 2022 20:37:34 +0000 (22:37 +0200)]
dsync: Revert logging a more detailed reason why mailbox was lost
This code can't actually work, because the mailbox allocation is attempted
in multiple namespaces. The error would just come from the last namespace,
which might not have been the correct one.
Timo Sirainen [Thu, 27 Oct 2022 21:56:29 +0000 (00:56 +0300)]
maildir: If mailbox create fails, don't try to apply mailbox_update changes
This was especially causing problems with mailbox GUID mismatches in dsync.
The mismatch wasn't automatically fixed, because mailbox_create() incorrectly
kept updating the mailbox GUID for the already existing mailbox.
Fixes errors such as:
Remote lost mailbox GUID ... (maybe it was just deleted?)
Timo Sirainen [Mon, 31 Oct 2022 09:23:00 +0000 (11:23 +0200)]
replication plugin: Use "replication: " log prefix for all log messages
Some of the messages were missing the prefix. Some were using
"replication(user): " as the prefix, which was unnecessary since the
mail_log_prefix already contains the username.
Timo Sirainen [Tue, 25 Oct 2022 10:27:23 +0000 (13:27 +0300)]
replicator: Make sure to prevent request starvation
This synchronizes how priority queue is ordered vs what
replicator_queue_want_sync_now() returns. The mismatch might have caused
request starvation in some situations because they behaved differently.
Also this change makes sure that higher priority requests don't infinitely
block lower priority requests. Instead, they get a temporary boost time
(hardcoded 15-45 minutes). Afterwards lower priority requests are started
to be handled as well.
Timo Sirainen [Tue, 25 Oct 2022 10:11:37 +0000 (13:11 +0300)]
replicator: Don't update user's last_update if priority doesn't change
This didn't actually matter, since it was only used to check if importing
should update an existing user. However, importing is only run at startup
when all users have last_update=0 anyway.
The following changes bring new use cases for last_update.
Timo Sirainen [Tue, 25 Oct 2022 09:49:03 +0000 (12:49 +0300)]
replicator: Fix user placement in replication queue
Especially replicator queue importing and NOTIFY command could have
placed the user to wrong place in the queue, because they modified the
last sync timestamps afterwards.
Fixed by splitting replicator_queue_add() into get/update/add(), so all
the necessary changes can be done before replicator_queue_add() is used
to place the user into the queue.
Marco Bettini [Wed, 12 Oct 2022 10:52:39 +0000 (10:52 +0000)]
lib-mail: istream-attachment-extractor - Return read failure on unexpected errors
If the istream content unexpectedly changes or there are any syscall failures, the
istream reading should fail rather than handle it the same as if the base64 input
was invalid.
The way astream_part_finish() reports errors been modified:
Instead of returning -1 (failure) and 0(success) now it returns
-1 (failure, propagate *error and abort), 0 (invalid base64), 1(success)
Timo Sirainen [Wed, 19 Oct 2022 22:29:18 +0000 (01:29 +0300)]
lib: Always evaluate e_error(), e_warning() and e_info() parameters
e_debug() still delays evaluation until it's known that the event won't
simply be discarded. Since there are lots of e_debug() calls, this is a
good performance optimization. Other types of logging are much more rare
though and it's not so useful as an optimization. It can also be
unexpected that the evaluation doesn't happen. Especially with e_error()
and e_warning() it is expected, since it's only some special circumstances
where they don't log the output.
Aki Tuomi [Wed, 21 Sep 2022 08:14:40 +0000 (11:14 +0300)]
lib-storage: LAYOUT=index rebuild - Fix rebuilds when using multiple namespaces
The old code did not properly populate the mailbox list for each
namespace, but only for the first namespace. This caused mailbox
storage existence checks to always fail.
The code was a bit ugly in that it didn't set error_r on ENOENT. There was
no bug because the caller did check for this, but scan-build didn't
understand it.
Timo Sirainen [Tue, 11 Oct 2022 08:17:11 +0000 (11:17 +0300)]
lib-storage: Store mailbox names unescaped in box-name header
This header is used when rebuilding mailbox list indexes with LAYOUT=index.
The escape character is currently hardcoded for LAYOUT=index, so this
couldn't have broken anything unless the hardcoded separator was changed.
Still, this was wrong/confusing behavior.
Don't report mailbox prefix anymore unless box vname is different from last
error's one mail_storage_get_last_internal_error() will continue to report
it as previously.