Hello again,
After taking more time trying to undestand the output of doveadm sync -s
, i found out that the comamnd is unusable when called for multiple
users (using -A, -F, or -u <regex> options).
I found several issues:
The command output a state for every user. This makes sense, however it's not possible to pass all these states and the corresponding user to the command as an input, so running on multiple users probably should be disabled or at least show a warning.
every username and a new line *but the first one* is printed on stdout *before* the state. This is very confusing as on stdout, each state is printed next to the next username. I dug the source code trying to understand why the first user is not printed but haven't found why.
To give an example: currently, the output of doveadm sync -A -s "" <destination>
gives the following output:
base64-alice-state bob@example.com
base64-bob-state charlie@example.com
base64-charlie-state
As a workaround, i'll first list users using doveadm user
and then do
multiple calls to doveadm sync
in a script.
Best regards, Bruno MATEU
On 2025-01-30 13:49, Bruno MATEU wrote:
Hello,
With the removal of the replication plugin in next releases, i'm trying to setup automatic synchronization using doveadm sync between my master and my replica.
I managed to make the full sync work from my replica using the following comamnd
sync -A -N -R -f tcp:master-fqdn:12345
However i'd like to do stateful synchronization to avoid doing the full replication each time, and i haven't managed to do that.
I tried the following:
doveadm sync -A -N -R -s "$(</var/lib/dovecot/sync-state)" tcp:master-fqdn:12345 > /var/lib/dovecot/sync-state
. However this output adoveadm(username): Error: Saved sync state is invalid, falling back to full sync: Invalid base64 data
for every user.After looking at the state in /var/lib/dovecot/sync-state, i noticed that there is one line for every user with an associated state, plus one line with only a state. For some reason, the state is the same for every user, except one where the state is much longer.
Do i need to run the command for each user, and give as an argument the corresponding state ? Is it enough to run the doveadm sync command with -A argument if i give the state in the last line outputted by doveadm sync ? Is this the right way to do it ?
Best regards,
Bruno MATEU