4394b73cacaf2c31a9b601f66b6e26a1c8f114b4 |
|
12-Jul-2017 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib-index: Track .log.2 rotation time in index header
This avoids unnecessarily stat()ing the file. Also it's a bit better
since it's tracking the actual rotation time, not the mtime of what the
.log file happened to have at the time of rotation.
The initial rotation timestamp is written only to the dovecot.index header
without going through dovecot.index.log. This works, because the
dovecot.index is written practically always after a log rotation. For the
rare cases when it doesn't happen, the dovecot.index.log.2 just gets
deleted later after the next log rotation. |
f0ff961282e618945dfe997dc45ff95d656e5790 |
|
03-Nov-2012 |
Timo Sirainen <tss@iki.fi> |
lib-index: Replaced cache's deleted_space with deleted_record_count.
This way when expunging messages we don't need to actually read through the
cache file and calculate how many bytes will be freed, we can simply
increase the deleted_record_count by 1. We'll still compress the cache file
approximately after 20% of the space (records) has been deleted.
This also converts the old "hole offset" header field to tracking the number
of records in the cache file. Otherwise we'd have to assume that all of the
messages in mailbox have a cache record, but that isn't true for users who
have only temporary cache fields. This "hole offset" cannot be trusted
completely, because nothing prevents old Dovecot version from simply writing
a hole offset there and messing up the record counts. Because of this there
are a couple of extra sanity checks for it. (Unfortunately there wasn't any
easy way to simply add a new field to header without breaking backwards
compatibility.) |
289064eb21595d3e4460439eccdc48232d13f5e1 |
|
04-Oct-2012 |
Timo Sirainen <tss@iki.fi> |
lib-index: Simplified writing to dovecot.index.cache file.
The old method was basically:
- write max. 32 kB to internal buffer
- flush it by writing to reserved areas (with no locks)
The reserved areas were acquired by doing (whenever needed):
- lock dovecot.index.cache
- reserve data from dovecot.index.cache for writing, potentially increasing
the file size by writing 0 bytes. the reserved area size varies.
- unlock dovecot.index.cache
This worked, but if multiple processes were writing to the cache file it
could have left incomplete reserved areas as holes. The holes were attempted
to be filled if they were large enough.
The new method is:
- write max. 256 kB to internal buffer
- lock dovecot.index.cache
- append the buffer to dovecot.index.cache
- unlock dovecot.index.cache
No reserved areas, holes or anything else weird going on.
Ideally no data would be overwritten in the dovecot.index.cache file, only
appended. Unfortunately currently some data is still overwritten:
- mail_cache_header.{deleted_space,continued_record_count}
- mail_cache_header_fields.next_offset when writing a new one
- mail_cache_header_fields.{last_used,decision}
- mail_cache_record.prev_offset
The changing headers could eventually be moved to dovecot.index. This
however is a backwards-incompatible change. The record's prev_offset could
maybe simply just not be written in those (somewhat rare) problematic
situations. |