Skip to content

Commit 40a82f3

Browse files
slusarzsirainen
authored andcommitted
doveadm sync: Improved documentation on state string
1 parent dc68337 commit 40a82f3

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

docs/core/admin/migration.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,3 +410,36 @@ with GMail migration. It will:
410410
```sh
411411
doveadm backup -a 'virtual/All' -O '-$GmailHaveLabels' -R -u user@domain imapc:
412412
```
413+
414+
## Optimizing Synchronization
415+
416+
The `-s` (state) parameter can be used to significantly improve performance for incremental migrations.
417+
418+
By using a "sync state string", dsync can avoid a full mailbox scan and only synchronize the changes
419+
that have occurred since the last synchronization.
420+
421+
### How it Works
422+
423+
When you run dsync with the `-s` parameter, it will perform the synchronization as usual. At the end of the operation, doveadm will output a state string. This string is a snapshot of the mailbox's state.
424+
425+
By providing this state string in the subsequent dsync call using the `-s` parameter, doveadm can avoid a full mailbox scan and instead only synchronize the changes that have occurred since the last synchronization. This can significantly reduce the time and resources required for the sync operation.
426+
427+
### Example Usage
428+
429+
1. **Initial sync:**
430+
431+
```sh
432+
doveadm sync -s "" <destination>
433+
```
434+
435+
After the initial sync, doveadm will return a state string.
436+
437+
2. **Subsequent syncs:**
438+
439+
Save the state string from the previous sync and use it in the next one:
440+
441+
```sh
442+
doveadm sync -s "<state string from previous sync>" <destination>
443+
```
444+
445+
This will perform an incremental sync based on the provided state.

docs/core/man/include/doveadm-backup-sync.inc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,13 @@ parameters.
216216
specified log file.
217217

218218
**-s** *previous_state*
219-
: Use stateful synchronization. If the previous state is unknown, use
220-
an empty string. The new state is always printed to standard output.
219+
: Use stateful synchronization. This allows for optimized incremental
220+
synchronization by providing a "sync state string" from the previous
221+
dsync run. dsync will use this state to only synchronize the
222+
changes that have occurred since that state was captured, avoiding
223+
a full mailbox scan. If the previous state is unknown, use an empty
224+
string. The new state is always printed to standard output if this
225+
parameter is specified.
221226

222227
<!-- @include: ./option-u-user.inc -->
223228

0 commit comments

Comments
 (0)