Skip to content
Snippets Groups Projects
Commit df5e27ef authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount
Browse files

ITS#8102, #9330 partially revert

Fix a regression in delta-sync, was returning error on old
CSNs instead of ignoring them
parent fd07d8f5
No related branches found
No related tags found
No related merge requests found
...@@ -2226,6 +2226,20 @@ syncrepl_op_modify( Operation *op, SlapReply *rs ) ...@@ -2226,6 +2226,20 @@ syncrepl_op_modify( Operation *op, SlapReply *rs )
if ( !mod ) if ( !mod )
return SLAP_CB_CONTINUE; return SLAP_CB_CONTINUE;
{
int sid = slap_parse_csn_sid( &mod->sml_nvalues[0] );
ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
rc = check_csn_age( si, &op->o_req_dn, &mod->sml_nvalues[0],
sid, (cookie_vals *)&si->si_cookieState->cs_vals, NULL );
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
if ( rc == CV_CSN_OLD ) {
slap_graduate_commit_csn( op );
/* tell accesslog this was a failure */
rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
return LDAP_SUCCESS;
}
}
rc = overlay_entry_get_ov( op, &op->o_req_ndn, NULL, NULL, 0, &e, on ); rc = overlay_entry_get_ov( op, &op->o_req_ndn, NULL, NULL, 0, &e, on );
if ( rc == 0 ) { if ( rc == 0 ) {
Attribute *a; Attribute *a;
...@@ -2413,14 +2427,12 @@ syncrepl_message_to_op( ...@@ -2413,14 +2427,12 @@ syncrepl_message_to_op(
const char *text; const char *text;
char txtbuf[SLAP_TEXT_BUFLEN]; char txtbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof txtbuf; size_t textlen = sizeof txtbuf;
char csnbuf[LDAP_PVT_CSNSTR_BUFSIZE];
struct berval bdn, dn = BER_BVNULL, ndn; struct berval bdn, dn = BER_BVNULL, ndn;
struct berval bv, bv2, *bvals = NULL; struct berval bv, bv2, *bvals = NULL;
struct berval rdn = BER_BVNULL, sup = BER_BVNULL, struct berval rdn = BER_BVNULL, sup = BER_BVNULL,
prdn = BER_BVNULL, nrdn = BER_BVNULL, prdn = BER_BVNULL, nrdn = BER_BVNULL,
psup = BER_BVNULL, nsup = BER_BVNULL; psup = BER_BVNULL, nsup = BER_BVNULL;
struct berval csn = {0, csnbuf};
int rc, deleteOldRdn = 0, freeReqDn = 0; int rc, deleteOldRdn = 0, freeReqDn = 0;
int do_graduate = 0, do_unlock = 0; int do_graduate = 0, do_unlock = 0;
...@@ -2523,13 +2535,8 @@ syncrepl_message_to_op( ...@@ -2523,13 +2535,8 @@ syncrepl_message_to_op(
} else if ( !ber_bvstrcasecmp( &bv, } else if ( !ber_bvstrcasecmp( &bv,
&slap_schema.si_ad_entryCSN->ad_cname ) ) &slap_schema.si_ad_entryCSN->ad_cname ) )
{ {
int len = bvals->bv_len; slap_queue_csn( op, bvals );
if ( bvals->bv_len >= sizeof(csnbuf) ) do_graduate = 1;
csn.bv_len = sizeof(csnbuf) - 1;
else
csn.bv_len = bvals->bv_len;
AC_MEMCPY( csn.bv_val, bvals->bv_val, csn.bv_len );
csn.bv_val[csn.bv_len] = '\0';
} }
ch_free( bvals ); ch_free( bvals );
} }
...@@ -2545,19 +2552,6 @@ syncrepl_message_to_op( ...@@ -2545,19 +2552,6 @@ syncrepl_message_to_op(
goto done; goto done;
do_unlock = 1; do_unlock = 1;
} }
if ( csn.bv_len ) {
int i, sid = slap_parse_csn_sid( &csn );
ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
i = check_csn_age( si, &bdn, &csn, sid, (cookie_vals *)&si->si_cookieState->cs_vals, NULL );
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
if ( i == CV_CSN_OLD ) {
/* skip this op */
rc = -1;
goto done;
}
slap_queue_csn( op, &csn );
do_graduate = 1;
}
op->o_callback = &cb; op->o_callback = &cb;
slap_op_time( &op->o_time, &op->o_tincr ); slap_op_time( &op->o_time, &op->o_tincr );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment