fix out of order add/rename, when rename to newly added new superior occurs while consumer is offline (ITS#6472)

This commit is contained in:
Pierangelo Masarati 2010-04-17 21:59:35 +00:00
parent 71a11b44e8
commit a9990e8914

View File

@ -131,6 +131,8 @@ static int syncrepl_updateCookie(
struct sync_cookie * );
static struct berval * slap_uuidstr_from_normalized(
struct berval *, struct berval *, void * );
static int syncrepl_add_glue_ancestors(
Operation* op, Entry *e );
/* callback functions */
static int dn_callback( Operation *, SlapReply * );
@ -2562,7 +2564,18 @@ retry_add:;
mod->sml_next = m2;
}
op->o_bd = si->si_wbe;
retry_modrdn:;
rc = op->o_bd->be_modrdn( op, &rs_modify );
/* NOTE: noSuchObject should result because the new superior
* has not been added yet (ITS#6472) */
if ( rc == LDAP_NO_SUCH_OBJECT && !BER_BVISNULL( op->orr_nnewSup )) {
rc = syncrepl_add_glue_ancestors( op, entry );
if ( rc == LDAP_SUCCESS ) {
goto retry_modrdn;
}
}
op->o_tmpfree( op->orr_nnewrdn.bv_val, op->o_tmpmemctx );
op->o_tmpfree( op->orr_newrdn.bv_val, op->o_tmpmemctx );
@ -2888,8 +2901,8 @@ syncrepl_del_nonpresent(
return;
}
int
syncrepl_add_glue(
static int
syncrepl_add_glue_ancestors(
Operation* op,
Entry *e )
{
@ -3023,6 +3036,23 @@ syncrepl_add_glue(
ndn.bv_len = e->e_nname.bv_len - (ndn.bv_val - e->e_nname.bv_val);
}
return rc;
}
int
syncrepl_add_glue(
Operation* op,
Entry *e )
{
int rc;
Backend *be = op->o_bd;
SlapReply rs_add = {REP_RESULT};
rc = syncrepl_add_glue_ancestors( op, e );
if ( rc != LDAP_SUCCESS ) {
return rc;
}
op->o_req_dn = e->e_name;
op->o_req_ndn = e->e_nname;
op->ora_e = e;