From f77e902d9a2f5b8ec5da68d343fbe23f378dcc9e Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Thu, 5 Jul 2018 14:20:45 +0200 Subject: [PATCH] Ticket 49829 - no plugin start for export of replication data required No bug, unecessary overhead. replicatipon plugin, psearch and eventqueue are started if db2ldif is run with the "-r" option. But this is not needed. Fix: do not start thes components, just start the backend in export code Reviewed by: ? --- ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 15 ++++----------- ldap/servers/slapd/main.c | 24 ------------------------ 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c index ab794a189..24db098be 100644 --- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c +++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c @@ -1132,7 +1132,6 @@ ldbm_back_ldbm2ldif(Slapi_PBlock *pb) ldbm_instance *inst = NULL; int str2entry_options = 0; int retry; - int we_start_the_backends = 0; static int load_dse = 1; /* We'd like to load dse just once. */ int server_running; export_args eargs = {0}; @@ -1143,17 +1142,11 @@ ldbm_back_ldbm2ldif(Slapi_PBlock *pb) slapi_pblock_get(pb, SLAPI_TASK_FLAGS, &task_flags); slapi_pblock_get(pb, SLAPI_DB2LDIF_DECRYPT, &decrypt); slapi_pblock_get(pb, SLAPI_DB2LDIF_SERVER_RUNNING, &server_running); - run_from_cmdline = (task_flags & SLAPI_TASK_RUNNING_FROM_COMMANDLINE); + run_from_cmdline = (task_flags & SLAPI_TASK_RUNNING_FROM_COMMANDLINE); dump_replica = slapi_pblock_get_ldif_dump_replica(pb); - if (run_from_cmdline) { - li->li_flags |= SLAPI_TASK_RUNNING_FROM_COMMANDLINE; - if (!dump_replica) { - we_start_the_backends = 1; - } - } - if (we_start_the_backends && load_dse) { + if (run_from_cmdline && load_dse) { /* No ldbm be's exist until we process the config information. */ /* @@ -1288,7 +1281,7 @@ ldbm_back_ldbm2ldif(Slapi_PBlock *pb) fd = STDOUT_FILENO; } - if (we_start_the_backends) { + if (run_from_cmdline) { if (0 != dblayer_start(li, DBLAYER_EXPORT_MODE)) { slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_ldbm2ldif", "db2ldif: Failed to init database\n"); return_value = -1; @@ -1645,7 +1638,7 @@ bye: slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_ldbm2ldif", "<=\n"); - if (we_start_the_backends && NULL != li) { + if (run_from_cmdline && NULL != li) { if (0 != dblayer_close(li, DBLAYER_EXPORT_MODE)) { slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_ldbm2ldif", "db2ldif: Failed to close database\n"); diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 1108ad20f..eb35bffc6 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -2274,25 +2274,6 @@ slapd_exemode_db2ldif(int argc, char **argv, struct main_config *mcfg) } slapi_pblock_set(pb, SLAPI_DB2LDIF_SERVER_RUNNING, &is_running); - if (mcfg->db2ldif_dump_replica) { - char **plugin_list = NULL; - char *repl_plg_name = "Multimaster Replication Plugin"; - - /* - * Only start the necessary plugins for "db2ldif -r" - * - * We need replication, but replication has its own - * dependencies - */ - plugin_get_plugin_dependencies(repl_plg_name, &plugin_list); - - eq_init(); /* must be done before plugins started */ - ps_init_psearch_system(); /* must come before plugin_startall() */ - plugin_startall(argc, argv, plugin_list); - eq_start(); /* must be done after plugins started */ - charray_free(plugin_list); - } - if (mcfg->archive_name) { /* redirect stdout to this file: */ char *p, *q; char sep = '/'; @@ -2344,11 +2325,6 @@ slapd_exemode_db2ldif(int argc, char **argv, struct main_config *mcfg) slapi_ch_free((void **)&(mcfg->myname)); charray_free(mcfg->cmd_line_instance_names); charray_free(mcfg->db2ldif_include); - if (mcfg->db2ldif_dump_replica) { - eq_stop(); /* event queue should be shutdown before closing - all plugins (especailly, replication plugin) */ - plugin_closeall(1 /* Close Backends */, 1 /* Close Globals */); - } return (return_value); } -- 2.13.6