Hi,
It would be great if doveadm index could terminate non-zero in the case of index corruption, that way the tool can be used as a way to determine and remove corrupted indexes. Example:
othala [13:56:24] ~ # doveadm index -u lumi_james INBOX doveadm(lumi_james): Error: Corrupted transaction log file /path/to/lumi_james/dovecot.list.index.log seq 2: Unexpected garbage at EOF (sync_offset=7168) doveadm(lumi_james): Error: Failed to map transaction log /path/to/lumi_james/dovecot.list.index.log at sync_offset=7168 after locking: Unexpected garbage at EOF othala [13:56:34] ~ # echo $? 0 othala [13:56:37] ~ #
If doveadm index exited non-zero in above case we'd be able to:
if ! doveadm index -u lumi_james INBOX; then rm /path/to/lumi_james/dovecot.index{,log,.cache} fi
Which may be over-zealous in removing indexes, but we'd rather have that.
We believe we already fixed the locking issue that caused the corrupt indexes and are busy cleaning them up based on log files, but it would still be great if the above could be integrated into our check battery if/when users report problems, of "run the script and it fixes 99% of things that are known to break".
In the same breath, we're seeing that folders with & in the name are causing problems for doveadm index -u someuser '*' usage.
Kind regards, Jaco