Stephan Bosch [Thu, 5 Jul 2018 22:01:14 +0000 (00:01 +0200)]
lib-http: http-server-response - Prevent response content stream from finishing the connection output stream.
This is not supposed to happen ever, because the connection output stream needs
to be available for several responses. This was at some point a problem in some
of the test with the new ostream payload API.
Stephan Bosch [Thu, 5 Jul 2018 21:52:51 +0000 (23:52 +0200)]
lib-http: http-client-request - Prevent request content stream from finishing the connection output stream.
This is not supposed to happen ever, because the connection output stream needs
to be available for several requests. This was at some point a problem in some
of the test with the new ostream payload API.
Stephan Bosch [Fri, 8 Nov 2019 16:11:36 +0000 (17:11 +0100)]
lib-http: http-server - Implement support for dynamically adding resources.
Before, the application would get all requests through a single main callback
and the application was always responsible for mapping request targets to a
particular application-defined HTTP resource. Now, an application can receive
requests for a certain HTTP resource through a separately-registered resource
object, which allows dynamic configuration of server resources. This way, e.g.
a generic HTTP service with several separate 'drivers' or plugin support for an
HTTP service can be implemented more easily.
Timo Sirainen [Thu, 16 Apr 2020 12:59:24 +0000 (15:59 +0300)]
lib-index: Fix cache purging when index is being rebuilt
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.
Timo Sirainen [Sun, 5 Apr 2020 15:36:44 +0000 (18:36 +0300)]
lib-index: Cache purging shouldn't always change YES decisions to TEMP
Previously every purging changed YES decision to be changed to TEMP.
This behaved rather badly if a cache file was purged twice within short
time period, because the clients might not have had time to access the
mailbox and change the decision back to YES. That in turn could have
dropped old mails' cached fields even though the client might still want
to use them. (A workaround for this has been to list all useful fields in
mail_always_cache_fields setting.)
The new behavior is to update the last_used field for a YES decision only
when the YES decision has been confirmed. If it's not confirmed for 30
days (mail_cache_unaccessed_field_drop) then its decision is changed to
TEMP on the next purge.
The new behavior also doubles the time when unaccessed field is dropped
from 30 days to 60 days (2*mail_cache_unaccessed_field_drop). This is
needed so that the field isn't dropped too early after YES -> TEMP
decision is changed.
Timo Sirainen [Sun, 5 Apr 2020 20:30:41 +0000 (23:30 +0300)]
lib-storage: Initialize new cache hdr.* fields with NO decision
Calling mail_cache_add() afterwards will change their decision to TEMP.
Or if it's not called, it probably wasn't wanted to be cached anyway.
Most importantly this change will cause mail_cache_decision event to be
triggered for these newly cached headers.
It can only happen on I/O errors, which most likely means that there's no
disk space to write to transaction log. There's no reason to delete the
entire cache, since it might be expensive to recreate.
Timo Sirainen [Thu, 2 Apr 2020 21:41:55 +0000 (00:41 +0300)]
lib-storage: Use mailbox.event as parent to mail_index
The index lives longer than the struct mailbox, which is a bit confusing.
In some cases the index could even be used for a different mailbox name
(symlink/alias), in which case the event's mailbox name wouldn't be exactly
correct. However, these downsides are still preferable to not inheriting
from the mailbox event, since then there is no mailbox name.
Timo Sirainen [Tue, 31 Mar 2020 11:59:25 +0000 (14:59 +0300)]
lib-index: Rename cache compress -> cache purge
Using "purge" term is less confusing than "compress". This was already
decided earlier for "doveadm mailbox cache purge" name, and it's similar
to mdbox purging.
Timo Sirainen [Wed, 1 Apr 2020 21:29:07 +0000 (00:29 +0300)]
lib-index: Make sure purging clears saved bitmask offsets state between mails
This is just to make sure it doesn't try to use previous mail's offset when
merging bitmasks. This shouldn't have been possible anyway, because
field_seen array guaranteed that the bitmask_pos was always set before
reading it. This just makes extra sure of it.
Timo Sirainen [Tue, 31 Mar 2020 15:53:33 +0000 (18:53 +0300)]
lib-index: Wait for lock in cache compression, not just try once
Sometimes there's an important reason for the cache to be compressed, and it
shouldn't give up just because there's a race condition with another process
that just happens to be writing to it.