Hi,
Your problem might be similar to mine a long time ago. IMO behavior of "doveadm altmove -r" command with mdbox format is different to sdbox format:
- With sdbox format, when you move back a message to primary storage (aka default storage), only the message and the file containing it are affected. There is nothing impacted.
- With mdbox format, a file in storage contains multiple messages. When a message is moved back to primary storage, other messages in the same file storage will go with it. The whole file is moved as well.
My workaround for this case is: In the mdbox_altmove_add_files function, after defining action for the message which is marked as MOVE_FROM_ALT, we will continue checking other messages in the file storage. If they are not listed in altmoves (they stay in alternate storage), their action will be MDBOX_MSG_ACTION_MOVE_TO_ALT. That means they will be moved 2 times: to primary storage as usual then to alternate storage again to ensure finally they are in alternate storage.
- Pros:
- Simple
- Do not impact other parts
- Do not require to update other processes to perform MOVE_FROM_ALT messages
- Cons:
- Reduce performance when number of messages is big
- Increase file storage counter
- If you don't mind building Dovecot from source, give my patch a look.
If you don't mind building Dovecot from source, give my patch a look.