From: Howard Chu Date: Fri, 4 Nov 2011 22:52:23 +0000 (-0700) Subject: ITS#7077 preserve mirrorMode setting when deleting syncrepl X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=31b5c396d3ef1f2dd6c2ed5a2dff0741d85ccf30;p=openldap ITS#7077 preserve mirrorMode setting when deleting syncrepl --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 4bf67f7943..4cf4c0da1e 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -1185,7 +1185,7 @@ config_generic(ConfigArgs *c) { break; case CFG_MIRRORMODE: if ( SLAP_SHADOW(c->be)) - c->value_int = (SLAP_SINGLE_SHADOW(c->be) == 0); + c->value_int = (SLAP_MULTIMASTER(c->be) != 0); else rc = 1; break; @@ -1290,7 +1290,6 @@ config_generic(ConfigArgs *c) { case CFG_AZPOLICY: case CFG_DEPTH: case CFG_LASTMOD: - case CFG_MIRRORMODE: case CFG_MONITORING: case CFG_SASLSECP: case CFG_SSTR_IF_MAX: @@ -1307,6 +1306,12 @@ config_generic(ConfigArgs *c) { snprintf(c->log, sizeof( c->log ), "change requires slapd restart"); break; + case CFG_MIRRORMODE: + SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_MULTI_SHADOW; + if(SLAP_SHADOW(c->be)) + SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW; + break; + #if defined(HAVE_CYRUS_SASL) && defined(SLAP_AUXPROP_DONTUSECOPY) case CFG_AZDUC: if ( c->valx < 0 ) { @@ -2079,10 +2084,13 @@ sortval_reject: c->log, c->cr_msg, 0 ); return(1); } - if(c->value_int) + if(c->value_int) { SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_SINGLE_SHADOW; - else + SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_MULTI_SHADOW; + } else { SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW; + SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_MULTI_SHADOW; + } break; case CFG_MONITORING: @@ -3794,7 +3802,9 @@ config_shadow( ConfigArgs *c, slap_mask_t flag ) } } else { - SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SINGLE_SHADOW | flag); + SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | flag); + if ( !SLAP_MULTIMASTER( c->be )) + SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW; } return 0; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 66df1cff29..148e4719b1 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1851,6 +1851,7 @@ struct BackendDB { #define SLAP_DBFLAG_CLEAN 0x10000U /* was cleanly shutdown */ #define SLAP_DBFLAG_ACL_ADD 0x20000U /* check attr ACLs on adds */ #define SLAP_DBFLAG_SYNC_SUBENTRY 0x40000U /* use subentry for context */ +#define SLAP_DBFLAG_MULTI_SHADOW 0x80000U /* uses mirrorMode/multi-master */ slap_mask_t be_flags; #define SLAP_DBFLAGS(be) ((be)->be_flags) #define SLAP_NOLASTMOD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD) @@ -1874,7 +1875,7 @@ struct BackendDB { #define SLAP_SYNC_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SYNC_SHADOW) #define SLAP_SLURP_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SLURP_SHADOW) #define SLAP_SINGLE_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SINGLE_SHADOW) -#define SLAP_MULTIMASTER(be) (!SLAP_SINGLE_SHADOW(be)) +#define SLAP_MULTIMASTER(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_MULTI_SHADOW) #define SLAP_DBCLEAN(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_CLEAN) #define SLAP_DBACL_ADD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_ACL_ADD) #define SLAP_SYNC_SUBENTRY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SYNC_SUBENTRY)