From: Howard Chu Date: Sun, 2 Nov 2008 23:06:10 +0000 (+0000) Subject: Add DBFLAG_CLEAN for a DB that was cleanly shut down; don't bother X-Git-Tag: ACLCHECK_0~1162 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f463be3b9560688434db523a33fd36290220f9b9;p=openldap Add DBFLAG_CLEAN for a DB that was cleanly shut down; don't bother scanning to verify contextCSN for clean shutdowns (ITS#5640) --- diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 20b5fe9a66..5de029303b 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -168,6 +168,8 @@ bdb_db_open( BackendDB *be, ConfigReply *cr ) be->be_suffix[0].bv_val, 0, 0 ); return -1; } + if ( rc == ALOCK_CLEAN ) + be->be_flags |= SLAP_DBFLAG_CLEAN; /* * The DB_CONFIG file may have changed. If so, recover the diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index a7cf44b74b..ab0ef885a8 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -2733,7 +2733,7 @@ syncprov_db_open( si->si_sids = slap_parse_csn_sids( si->si_ctxcsn, a->a_numvals, NULL ); } overlay_entry_release_ov( op, e, 0, on ); - if ( si->si_ctxcsn ) { + if ( si->si_ctxcsn && !SLAP_DBCLEAN( be )) { op->o_req_dn = be->be_suffix[0]; op->o_req_ndn = be->be_nsuffix[0]; op->ors_scope = LDAP_SCOPE_SUBTREE; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 8564e3b310..fa72448dea 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1792,6 +1792,7 @@ struct BackendDB { #define SLAP_DBFLAG_SINGLE_SHADOW 0x4000U /* a single-master shadow */ #define SLAP_DBFLAG_SYNC_SHADOW 0x1000U /* a sync shadow */ #define SLAP_DBFLAG_SLURP_SHADOW 0x2000U /* a slurp shadow */ +#define SLAP_DBFLAG_CLEAN 0x10000U /* was cleanly shutdown */ slap_mask_t be_flags; #define SLAP_DBFLAGS(be) ((be)->be_flags) #define SLAP_NOLASTMOD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD) @@ -1816,6 +1817,7 @@ struct BackendDB { #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_DBCLEAN(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_CLEAN) slap_mask_t be_restrictops; /* restriction operations */ #define SLAP_RESTRICT_OP_ADD 0x0001U