]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/ctxcsn.c
limit checking in syncrepl
[openldap] / servers / slapd / back-bdb / ctxcsn.c
index 495b191224434864a0a47113e298c37ba37d9c7b..a76bae3331ca556e23a662fa5b0381c601e20ac1 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003 The OpenLDAP Foundation.
+ * Copyright 2003-2004 The OpenLDAP Foundation.
  * Portions Copyright 2003 IBM Corporation.
  * All rights reserved.
  *
@@ -39,7 +39,7 @@ bdb_csn_commit(
 )
 {
        struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
-       struct berval   ctxcsn_ndn = { 0, NULL };
+       struct berval   ctxcsn_ndn = BER_BVNULL;
        EntryInfo               *ctxcsn_ei = NULL;
        DB_LOCK                 ctxcsn_lock;
        struct berval   max_committed_csn;
@@ -90,7 +90,7 @@ bdb_csn_commit(
                        modvals[1].bv_len = 0;
 
                        mod.sml_op = LDAP_MOD_REPLACE;
-                       mod.sml_bvalues = modvals;
+                       mod.sml_values = modvals;
                        mod.sml_nvalues = NULL;
                        mod.sml_desc = slap_schema.si_ad_contextCSN;
                        mod.sml_type = mod.sml_desc->ad_cname;
@@ -171,7 +171,7 @@ bdb_csn_commit(
                        goto rewind;
                case DB_KEYEXIST :
                        rs->sr_err = LDAP_OTHER;
-                       rs->sr_text = "context csn exists before contex prefix does";
+                       rs->sr_text = "context csn exists before context prefix does";
                        return BDB_CSN_ABORT;
                default :
                        rs->sr_err = LDAP_OTHER;
@@ -266,7 +266,7 @@ bdb_get_commit_csn(
                struct berval bv;
 
                LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
-                       sprintf( substr, "cn=syncrepl%d", si->si_rid );
+                       sprintf( substr, "cn=syncrepl%ld", si->si_rid );
                        ber_str2bv( substr, 0, 0, &bv );
                        build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &bv, NULL );
 
@@ -310,11 +310,12 @@ consumer_ctxcsn_retry :
                                        ber_bvarray_add( &syncCookie.octet_str, &cookie );
                                        slap_parse_sync_cookie( &syncCookie );
                                        if ( *search_context_csn &&
-                                                (*search_context_csn)->bv_val != NULL ) {
+                                               (*search_context_csn)->bv_val != NULL )
+                                       {
                                                value_match( &match, slap_schema.si_ad_entryCSN,
                                                        slap_schema.si_ad_entryCSN->ad_type->sat_ordering,
                                                        SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
-                                                       &syncCookie.ctxcsn, *search_context_csn, &text );
+                                                       syncCookie.ctxcsn, *search_context_csn, &text );
                                        }
                                        if ( match < 0 ) {
                                                /* set search_context_csn to the
@@ -324,7 +325,7 @@ consumer_ctxcsn_retry :
                                                        ch_free( *search_context_csn );
                                                }
                                                *search_context_csn = ber_dupbv( NULL,
-                                                                                               syncCookie.ctxcsn );
+                                                       syncCookie.ctxcsn );
                                        }
                                        slap_sync_cookie_free( &syncCookie, 0 );
                                } else {
@@ -355,7 +356,7 @@ provider_ctxcsn_retry :
                        return LDAP_BUSY;
                case DB_LOCK_DEADLOCK:
                case DB_LOCK_NOTGRANTED:
-                       goto consumer_ctxcsn_retry;
+                       goto provider_ctxcsn_retry;
                case DB_NOTFOUND:
                        snprintf( gid, sizeof( gid ), "%s-%08lx-%08lx",
                                bdb_uuid.bv_val, (long) op->o_connid, (long) op->o_opid );