mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-16 20:06:06 -05:00
Context CSN Patch (5)
- persistent search patch - cascading search patch
This commit is contained in:
parent
7ef160494f
commit
79b04b12a2
7 changed files with 123 additions and 51 deletions
|
|
@ -470,13 +470,18 @@ retry: /* transaction retry */
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( !op->o_bd->syncinfo )
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
{
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -512,11 +517,16 @@ retry: /* transaction retry */
|
|||
|
||||
bdb_cache_add( bdb, ei, op->oq_add.rs_e, &nrdn, locker );
|
||||
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( !op->o_bd->syncinfo )
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
{
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -460,13 +460,18 @@ retry: /* transaction retry */
|
|||
ldap_pvt_thread_mutex_unlock( &bdb->bi_lastid_mutex );
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( !op->o_bd->syncinfo )
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
{
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -485,11 +490,16 @@ retry: /* transaction retry */
|
|||
bdb_cache_delete( &bdb->bi_cache, e, bdb->bi_dbenv,
|
||||
locker, &lock );
|
||||
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( !op->o_bd->syncinfo )
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
{
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -575,13 +575,18 @@ retry: /* transaction retry */
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( !op->o_bd->syncinfo )
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
{
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -599,11 +604,16 @@ retry: /* transaction retry */
|
|||
#endif
|
||||
bdb_cache_modify( e, dummy.e_attrs, bdb->bi_dbenv, locker, &lock );
|
||||
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( !op->o_bd->syncinfo )
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
{
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -915,13 +915,18 @@ retry: /* transaction retry */
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( !op->o_bd->syncinfo )
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
{
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -949,11 +954,16 @@ retry: /* transaction retry */
|
|||
bdb_cache_modrdn( save, &op->orr_nnewrdn, e, neip,
|
||||
bdb->bi_dbenv, locker, &lock );
|
||||
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( !op->o_bd->syncinfo )
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
{
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -688,17 +688,55 @@ dn2entry_retry:
|
|||
|
||||
#ifdef LDAP_SYNC
|
||||
if ( sop->o_sync_mode != SLAP_SYNC_NONE ) {
|
||||
ber_str2bv( "cn=ldapsync", strlen("cn=ldapsync"), 0, &ctxcsn_rdn );
|
||||
build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &ctxcsn_rdn );
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( sop->o_bd->syncinfo ) {
|
||||
char substr[67];
|
||||
sprintf( substr, "cn=syncrepl%d", sop->o_bd->syncinfo->id );
|
||||
ber_str2bv( substr, strlen( substr ), 0, &ctxcsn_rdn );
|
||||
build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &ctxcsn_rdn );
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ber_str2bv( "cn=ldapsync", strlen("cn=ldapsync"), 0, &ctxcsn_rdn );
|
||||
build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &ctxcsn_rdn );
|
||||
}
|
||||
|
||||
bdb_dn2entry( op, NULL, &ctxcsn_ndn, &ctxcsn_ei, 0, locker, &ctxcsn_lock );
|
||||
ctxcsn_retry :
|
||||
rs->sr_err = bdb_dn2entry( op, NULL, &ctxcsn_ndn, &ctxcsn_ei, 0, locker, &ctxcsn_lock );
|
||||
|
||||
switch(rs->sr_err) {
|
||||
case 0:
|
||||
e = ei->bei_e; break;
|
||||
case LDAP_BUSY:
|
||||
send_ldap_error( sop, rs, LDAP_BUSY, "ldap server busy" );
|
||||
LOCK_ID_FREE (bdb->bi_dbenv, locker );
|
||||
return LDAP_BUSY;
|
||||
case DB_LOCK_DEADLOCK:
|
||||
case DB_LOCK_NOTGRANTED:
|
||||
goto ctxcsn_retry;
|
||||
case DB_NOTFOUND:
|
||||
send_ldap_error( sop, rs, LDAP_OTHER, "context csn entry not present" );
|
||||
LOCK_ID_FREE( bdb->bi_dbenv, locker );
|
||||
return rs->sr_err;
|
||||
default:
|
||||
send_ldap_error( sop, rs, LDAP_OTHER, "internal error" );
|
||||
LOCK_ID_FREE (bdb->bi_dbenv, locker );
|
||||
return rs->sr_err;
|
||||
}
|
||||
|
||||
if ( ctxcsn_ei ) {
|
||||
ctxcsn_e = ctxcsn_ei->bei_e;
|
||||
}
|
||||
|
||||
if ( ctxcsn_e ) {
|
||||
csn_a = attr_find( ctxcsn_e->e_attrs, slap_schema.si_ad_contextCSN );
|
||||
#ifdef LDAP_SYNCREPL
|
||||
if ( sop->o_bd->syncinfo ) {
|
||||
csn_a = attr_find( ctxcsn_e->e_attrs, slap_schema.si_ad_syncreplCookie );
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
csn_a = attr_find( ctxcsn_e->e_attrs, slap_schema.si_ad_contextCSN );
|
||||
}
|
||||
if ( csn_a ) {
|
||||
search_context_csn = ber_dupbv( NULL, &csn_a->a_vals[0] );
|
||||
} else {
|
||||
|
|
@ -838,7 +876,7 @@ dn2entry_retry:
|
|||
csnfge.f_av_desc = slap_schema.si_ad_entryCSN;
|
||||
csnfge.f_av_value = sop->o_sync_state;
|
||||
|
||||
if ( search_context_csn ) {
|
||||
if ( search_context_csn && !IS_PSEARCH ) {
|
||||
csnfge.f_next = &contextcsnand;
|
||||
|
||||
contextcsnand.f_choice = LDAP_FILTER_AND;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@ fi
|
|||
|
||||
. $SRCDIR/scripts/args.sh $*
|
||||
|
||||
echo "test018-syncreplication-persist is temporarily disabled"
|
||||
exit 0
|
||||
|
||||
echo "running defines.sh"
|
||||
. $SRCDIR/scripts/defines.sh
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@ fi
|
|||
echo "running defines.sh"
|
||||
. $SRCDIR/scripts/defines.sh
|
||||
|
||||
echo "test020-syncreplication-cascading is temporarily disabled"
|
||||
exit 0
|
||||
|
||||
#
|
||||
# Test replication:
|
||||
# - start master
|
||||
|
|
|
|||
Loading…
Reference in a new issue