Context CSN Patch (5)

- persistent search patch
- cascading search patch
This commit is contained in:
Jong Hyuk Choi 2003-08-26 00:35:27 +00:00
parent 7ef160494f
commit 79b04b12a2
7 changed files with 123 additions and 51 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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