Skip to content

Commit 4c04e4c

Browse files
committed
global: Remove replicator
1 parent 08dda77 commit 4c04e4c

40 files changed

+2
-4215
lines changed

configure.ac

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -804,9 +804,6 @@ src/pop3/Makefile
804804
src/pop3-login/Makefile
805805
src/submission/Makefile
806806
src/submission-login/Makefile
807-
src/replication/Makefile
808-
src/replication/aggregator/Makefile
809-
src/replication/replicator/Makefile
810807
src/stats/Makefile
811808
src/util/Makefile
812809
src/plugins/Makefile
@@ -828,7 +825,6 @@ src/plugins/pop3-migration/Makefile
828825
src/plugins/quota/Makefile
829826
src/plugins/quota-clone/Makefile
830827
src/plugins/imap-quota/Makefile
831-
src/plugins/replication/Makefile
832828
src/plugins/trash/Makefile
833829
src/plugins/virtual/Makefile
834830
src/plugins/welcome/Makefile

src/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ SUBDIRS = \
6666
lmtp \
6767
log \
6868
config \
69-
replication \
7069
util \
7170
doveadm \
7271
stats \

src/doveadm/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ doveadm_common_cmds = \
8080
doveadm-master.c \
8181
doveadm-mutf7.c \
8282
doveadm-penalty.c \
83-
doveadm-replicator.c \
8483
doveadm-sis.c \
8584
doveadm-stats.c \
8685
doveadm-who.c

src/doveadm/doveadm-cmd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ void doveadm_cmds_init(void)
115115

116116
doveadm_register_instance_commands();
117117
doveadm_register_log_commands();
118-
doveadm_register_replicator_commands();
119118
doveadm_register_dict_commands();
120119
doveadm_register_fs_commands();
121120
}

src/doveadm/doveadm-cmd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ void doveadm_register_auth_server_commands(void);
1313
void doveadm_register_log_commands(void);
1414
void doveadm_register_instance_commands(void);
1515
void doveadm_register_mount_commands(void);
16-
void doveadm_register_replicator_commands(void);
1716
void doveadm_register_dict_commands(void);
1817
void doveadm_register_fs_commands(void);
1918

src/doveadm/doveadm-dsync.c

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ struct dsync_cmd_context {
111111
bool remote_user_prefix:1;
112112
bool no_mail_sync:1;
113113
bool local_location_from_arg:1;
114-
bool replicator_notify:1;
115114
bool exited:1;
116115
bool empty_hdr_workaround:1;
117116
bool no_header_hashes:1;
@@ -638,51 +637,6 @@ cmd_dsync_ibc_stream_init(struct dsync_cmd_context *ctx,
638637
name, temp_prefix, ctx->io_timeout_secs);
639638
}
640639

641-
static void
642-
dsync_replicator_notify(struct dsync_cmd_context *ctx,
643-
enum dsync_brain_sync_type sync_type,
644-
const char *state_str)
645-
{
646-
#define REPLICATOR_HANDSHAKE "VERSION\treplicator-doveadm-client\t1\t0\n"
647-
const char *path;
648-
string_t *str;
649-
int fd;
650-
651-
path = t_strdup_printf("%s/replicator-doveadm",
652-
ctx->ctx.cur_mail_user->set->base_dir);
653-
fd = net_connect_unix(path);
654-
if (fd == -1) {
655-
if (errno == ECONNREFUSED || errno == ENOENT) {
656-
/* replicator not running on this server. ignore. */
657-
return;
658-
}
659-
e_error(ctx->ctx.cctx->event,
660-
"net_connect_unix(%s) failed: %m", path);
661-
return;
662-
}
663-
fd_set_nonblock(fd, FALSE);
664-
665-
str = t_str_new(128);
666-
str_append(str, REPLICATOR_HANDSHAKE"NOTIFY\t");
667-
str_append_tabescaped(str, ctx->ctx.cur_mail_user->username);
668-
str_append_c(str, '\t');
669-
if (sync_type == DSYNC_BRAIN_SYNC_TYPE_FULL)
670-
str_append_c(str, 'f');
671-
str_append_c(str, '\t');
672-
str_append_tabescaped(str, state_str);
673-
str_append_c(str, '\n');
674-
if (write_full(fd, str_data(str), str_len(str)) < 0) {
675-
e_error(ctx->ctx.cctx->event,
676-
"write(%s) failed: %m", path);
677-
}
678-
/* we only wanted to notify replicator. we don't care enough about the
679-
answer to wait for it. */
680-
if (close(fd) < 0) {
681-
e_error(ctx->ctx.cctx->event,
682-
"close(%s) failed: %m", path);
683-
}
684-
}
685-
686640
static void dsync_errors_finish(struct dsync_cmd_context *ctx)
687641
{
688642
if (ctx->err_stream == NULL)
@@ -711,19 +665,10 @@ cmd_dsync_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
711665
const char *const *strp;
712666
enum dsync_brain_flags brain_flags;
713667
enum mail_error mail_error = 0, mail_error2;
714-
bool cli = (cctx->conn_type == DOVEADM_CONNECTION_TYPE_CLI);
715668
const char *changes_during_sync, *changes_during_sync2 = NULL;
716669
bool remote_only_changes;
717670
int ret = 0;
718671

719-
/* replicator_notify indicates here automated attempt,
720-
we still want to allow manual sync/backup */
721-
if (!cli && ctx->replicator_notify &&
722-
mail_user_plugin_getenv_bool(_ctx->cur_mail_user, "noreplicate")) {
723-
ctx->ctx.exit_code = DOVEADM_EX_NOREPLICATE;
724-
return -1;
725-
}
726-
727672
i_zero(&set);
728673
if (cctx->remote_ip.family != 0) {
729674
/* include the doveadm client's IP address in the ps output */
@@ -837,8 +782,7 @@ cmd_dsync_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
837782

838783
changes_during_sync = dsync_brain_get_unexpected_changes_reason(brain, &remote_only_changes);
839784
if (changes_during_sync != NULL || changes_during_sync2 != NULL) {
840-
/* don't log a warning when running via doveadm server
841-
(e.g. called by replicator) */
785+
/* don't log a warning when running via doveadm server */
842786
const char *msg = t_strdup_printf(
843787
"Mailbox changes caused a desync. "
844788
"You may want to run dsync again: %s",
@@ -919,11 +863,6 @@ static void dsync_connected_callback(const struct doveadm_server_reply *reply,
919863
case EX_NOUSER:
920864
ctx->error = "Unknown user in remote";
921865
break;
922-
case DOVEADM_EX_NOREPLICATE:
923-
if (doveadm_debug)
924-
e_debug(ctx->ctx.cctx->event,
925-
"user is disabled for replication");
926-
break;
927866
default:
928867
ctx->error = p_strdup_printf(ctx->ctx.pool,
929868
"Failed to start remote dsync-server command: "
@@ -946,8 +885,6 @@ static void dsync_server_run_command(struct dsync_cmd_context *ctx,
946885
str_append_tabescaped(cmd, cctx->username);
947886
str_append(cmd, "\tdsync-server\t-u");
948887
str_append_tabescaped(cmd, cctx->username);
949-
if (ctx->replicator_notify)
950-
str_append(cmd, "\t-U");
951888
str_append_c(cmd, '\n');
952889

953890
ctx->tcp_conn = conn;
@@ -1240,8 +1177,6 @@ static void cmd_dsync_preinit(struct doveadm_mail_cmd_context *_ctx)
12401177
i_fatal("Invalid -I parameter '%s': %s", value_str, error);
12411178

12421179
(void)doveadm_cmd_param_uint32(cctx, "timeout", &ctx->io_timeout_secs);
1243-
ctx->replicator_notify =
1244-
doveadm_cmd_param_flag(cctx, "replicator-notify");
12451180

12461181
if (!doveadm_cmd_param_array(cctx, "destination", &ctx->destination))
12471182
ctx->destination = empty_str_array;
@@ -1295,20 +1230,11 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx,
12951230
bool cli = (cctx->conn_type == DOVEADM_CONNECTION_TYPE_CLI);
12961231
struct dsync_ibc *ibc;
12971232
struct dsync_brain *brain;
1298-
string_t *temp_prefix, *state_str = NULL;
1299-
enum dsync_brain_sync_type sync_type;
1233+
string_t *temp_prefix;
13001234
const char *name, *process_title_prefix = "";
13011235
enum mail_error mail_error;
13021236

13031237
if (!cli) {
1304-
/* replicator_notify indicates here automated attempt,
1305-
we still want to allow manual sync/backup */
1306-
if (ctx->replicator_notify &&
1307-
mail_user_plugin_getenv_bool(_ctx->cur_mail_user, "noreplicate")) {
1308-
_ctx->exit_code = DOVEADM_EX_NOREPLICATE;
1309-
return -1;
1310-
}
1311-
13121238
/* doveadm-server connection. start with a success reply.
13131239
after that follows the regular dsync protocol. */
13141240
ctx->fd_in = ctx->fd_out = -1;
@@ -1346,12 +1272,6 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx,
13461272
/* io_loop_run() deactivates the context - put it back */
13471273
mail_storage_service_io_activate_user(ctx->ctx.cur_service_user);
13481274

1349-
if (ctx->replicator_notify) {
1350-
state_str = t_str_new(128);
1351-
dsync_brain_get_state(brain, state_str);
1352-
}
1353-
sync_type = dsync_brain_get_sync_type(brain);
1354-
13551275
if (dsync_brain_deinit(&brain, &mail_error) < 0)
13561276
doveadm_mail_failed_error(_ctx, mail_error);
13571277
dsync_ibc_deinit(&ibc);
@@ -1364,8 +1284,6 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx,
13641284
i_stream_unref(&ctx->input);
13651285
o_stream_unref(&ctx->output);
13661286

1367-
if (ctx->replicator_notify && _ctx->exit_code == 0)
1368-
dsync_replicator_notify(ctx, sync_type, str_c(state_str));
13691287
return _ctx->exit_code == 0 ? 0 : -1;
13701288
}
13711289

@@ -1381,7 +1299,6 @@ cmd_dsync_server_init(struct doveadm_mail_cmd_context *_ctx)
13811299

13821300
(void)doveadm_cmd_param_str(cctx, "rawlog", &ctx->rawlog_path);
13831301
(void)doveadm_cmd_param_uint32(cctx, "timeout", &ctx->io_timeout_secs);
1384-
ctx->replicator_notify = doveadm_cmd_param_flag(cctx, "replicator-notify");
13851302
}
13861303

13871304
static struct doveadm_mail_cmd_context *cmd_dsync_server_alloc(void)
@@ -1404,7 +1321,6 @@ DOVEADM_CMD_MAIL_COMMON \
14041321
DOVEADM_CMD_PARAM('f', "full-sync", CMD_PARAM_BOOL, 0) \
14051322
DOVEADM_CMD_PARAM('P', "purge-remote", CMD_PARAM_BOOL, 0) \
14061323
DOVEADM_CMD_PARAM('R', "reverse-sync", CMD_PARAM_BOOL, 0) \
1407-
DOVEADM_CMD_PARAM('U', "replicator-notify", CMD_PARAM_BOOL, 0) \
14081324
DOVEADM_CMD_PARAM('l', "lock-timeout", CMD_PARAM_INT64, CMD_PARAM_FLAG_UNSIGNED) \
14091325
DOVEADM_CMD_PARAM('r', "rawlog", CMD_PARAM_STR, 0) \
14101326
DOVEADM_CMD_PARAM('m', "mailbox", CMD_PARAM_STR, 0) \
@@ -1458,7 +1374,6 @@ DOVEADM_CMD_MAIL_COMMON
14581374
DOVEADM_CMD_PARAM('E', "legacy-dsync", CMD_PARAM_BOOL, 0)
14591375
DOVEADM_CMD_PARAM('r', "rawlog", CMD_PARAM_STR, 0)
14601376
DOVEADM_CMD_PARAM('T', "timeout", CMD_PARAM_INT64, CMD_PARAM_FLAG_UNSIGNED)
1461-
DOVEADM_CMD_PARAM('U', "replicator-notify", CMD_PARAM_BOOL, 0)
14621377
/* previously dsync-server could have been added twice to the parameters */
14631378
DOVEADM_CMD_PARAM('\0', "ignore-arg", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
14641379
DOVEADM_CMD_PARAMS_END

0 commit comments

Comments
 (0)