- return SLAP_CB_CONTINUE;
- }
-#endif
-
- slap_get_commit_csn( op, &maxcsn, &foundit );
- if ( BER_BVISEMPTY( &maxcsn ) && SLAP_GLUE_SUBORDINATE( op->o_bd )) {
- /* syncrepl queues the CSN values in the db where
- * it is configured , not where the changes are made.
- * So look for a value in the glue db if we didn't
- * find any in this db.
- */
- BackendDB *be = op->o_bd;
- op->o_bd = select_backend( &be->be_nsuffix[0], 1);
- maxcsn.bv_val = cbuf;
- maxcsn.bv_len = sizeof(cbuf);
- slap_get_commit_csn( op, &maxcsn, &foundit );
- op->o_bd = be;
- }
- if ( !BER_BVISEMPTY( &maxcsn ) ) {
- int i, sid;
-#ifdef CHECK_CSN
- Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
- assert( !syn->ssyn_validate( syn, &maxcsn ));
-#endif
- sid = slap_parse_csn_sid( &maxcsn );
- for ( i=0; i<si->si_numcsns; i++ ) {
- if ( sid == si->si_sids[i] ) {
- if ( ber_bvcmp( &maxcsn, &si->si_ctxcsn[i] ) > 0 ) {
- ber_bvreplace( &si->si_ctxcsn[i], &maxcsn );
- csn_changed = 1;
- }
- break;
- }
- }
- /* It's a new SID for us */
- if ( i == si->si_numcsns ) {
- value_add_one( &si->si_ctxcsn, &maxcsn );
- csn_changed = 1;
- si->si_numcsns++;
- si->si_sids = ch_realloc( si->si_sids, si->si_numcsns *
- sizeof(int));
- si->si_sids[i] = sid;
- }
- } else if ( !foundit ) {
- /* internal ops that aren't meant to be replicated */
- ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock );
- return SLAP_CB_CONTINUE;
- }
-
- /* Don't do any processing for consumer contextCSN updates */
- if ( op->o_dont_replicate ) {