Mercurial > dovecot > core-2.2
view src/doveadm/dsync/dsync-mailbox-tree-private.h @ 22715:20415dd0b85a
dsync: Add per-mailbox sync lock that is always used.
Both importing and exporting gets the lock before they even sync the
mailbox. The lock is kept until the import/export finishes. This guarantees
that no matter how dsync is run, two dsyncs can't be working on the same
mailbox at the same time.
This lock is in addition to the optional per-user lock enabled by the -l
parameter. If the -l parameter is used, the same lock timeout is used for
the per-mailbox lock. Otherwise 30s timeout is used.
This should help to avoid email duplication when replication is enabled for
public namespaces, and maybe in some other rare situations as well.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 28 Dec 2017 14:10:23 +0200 |
parents | 0af20585964d |
children |
line wrap: on
line source
#ifndef DSYNC_MAILBOX_TREE_PRIVATE_H #define DSYNC_MAILBOX_TREE_PRIVATE_H #include "dsync-mailbox-tree.h" struct dsync_mailbox_tree { pool_t pool; char sep, sep_str[2], remote_sep, alt_char; /* root node isn't part of the real mailbox tree. its name is "" and it has no siblings */ struct dsync_mailbox_node root; unsigned int iter_count; ARRAY(struct dsync_mailbox_delete) deletes; /* guid_128_t => struct dsync_mailbox_node */ HASH_TABLE(uint8_t *, struct dsync_mailbox_node *) name128_hash; HASH_TABLE(uint8_t *, struct dsync_mailbox_node *) name128_remotesep_hash; HASH_TABLE(uint8_t *, struct dsync_mailbox_node *) guid_hash; }; void dsync_mailbox_tree_build_name128_hash(struct dsync_mailbox_tree *tree); int dsync_mailbox_node_name_cmp(struct dsync_mailbox_node *const *n1, struct dsync_mailbox_node *const *n2); void dsync_mailbox_tree_node_attach(struct dsync_mailbox_node *node, struct dsync_mailbox_node *parent); void dsync_mailbox_tree_node_detach(struct dsync_mailbox_node *node); struct dsync_mailbox_tree * dsync_mailbox_tree_dup(const struct dsync_mailbox_tree *src); bool dsync_mailbox_trees_equal(struct dsync_mailbox_tree *tree1, struct dsync_mailbox_tree *tree2); #endif