From 4ae382fd797b451cbe33db4848136596061e4e81 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Wed, 26 Nov 2003 21:37:44 +0000 Subject: [PATCH] misc updates - syncrepl : id -> rid - man page update --- doc/man/man5/slapd.conf.5 | 4 ++-- doc/man/man8/slapd.8 | 24 ++++++++++++++++++++++++ servers/slapd/back-bdb/ctxcsn.c | 2 +- servers/slapd/config.c | 6 +++--- servers/slapd/slap.h | 2 +- servers/slapd/syncrepl.c | 14 +++++++------- 6 files changed, 38 insertions(+), 14 deletions(-) diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index f72efa9c6f..96ba411ef9 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -1125,7 +1125,7 @@ particular, it is not possible to use moddn to move an entry from one subordinate to another subordinate within the namingContext. .HP .hy 0 -.B syncrepl id= +.B syncrepl rid= .B provider=ldap[s]://[:port] .B [type=refreshOnly|refreshAndPersist] .B [interval=dd:hh:mm:ss] @@ -1161,7 +1161,7 @@ setting up a replicated directory service using the .B syncrepl replication engine. -.B id +.B rid identifies the current .B syncrepl directive within the replication consumer site. diff --git a/doc/man/man8/slapd.8 b/doc/man/man8/slapd.8 index 3b59b39a11..38cfc4b977 100644 --- a/doc/man/man8/slapd.8 +++ b/doc/man/man8/slapd.8 @@ -170,6 +170,30 @@ any shell back-ends will run as the specified non-privileged user. will read the configuration file (the default if none is given with the \fI\-f\fP switch) and check its syntax, without opening any listener or database. +.TP +.BI \-c " cookie" +This option provides a cookie for a syncrepl replication consumer. +The cookie is a comma separated list of name=value pairs. +Currently supported syncrepl cookie fields are +.B csn, +.B sid, +and +.B rid. +.B csn +is the commit sequence number of the master content at the provider site +and represents the state of the content to which the replica content +was synchronized most recently. +.B sid +is the identity of the session which this replication thread belongs to. +The replication provider site may maintain a session history store +for each replication session to reduce synchronization traffic. +.B rid +identifies a replication thread within a replication consumer site +and is used to find the replication thread specification of +.BR slapd.conf (5) +having the same +.B rid +value as the cookie. .SH EXAMPLES To start .I slapd diff --git a/servers/slapd/back-bdb/ctxcsn.c b/servers/slapd/back-bdb/ctxcsn.c index f6e012d758..7b2cf94487 100644 --- a/servers/slapd/back-bdb/ctxcsn.c +++ b/servers/slapd/back-bdb/ctxcsn.c @@ -271,7 +271,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_id ); + sprintf( substr, "cn=syncrepl%d", si->si_rid ); ber_str2bv( substr, 0, 0, &bv ); build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &bv, NULL ); diff --git a/servers/slapd/config.c b/servers/slapd/config.c index da9e147426..3f9d59d9d9 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -2800,7 +2800,7 @@ add_syncrepl( rc = parse_syncrepl_line( cargv, cargc, si ); LDAP_STAILQ_FOREACH( si_entry, &be->be_syncinfo, si_next ) { - if ( si->si_id == si_entry->si_id ) { + if ( si->si_rid == si_entry->si_rid ) { #ifdef NEW_LOGGING LDAP_LOG( CONFIG, ERR, "add_syncrepl: duplicaetd replica id\n", 0, 0,0 ); @@ -2866,7 +2866,7 @@ add_syncrepl( } } -#define IDSTR "id" +#define IDSTR "rid" #define PROVIDERSTR "provider" #define SUFFIXSTR "suffix" #define UPDATEDNSTR "updatedn" @@ -2929,7 +2929,7 @@ parse_syncrepl_line( "syncrepl id %d is out of range [0..999]\n", tmp ); return -1; } - si->si_id = tmp; + si->si_rid = tmp; gots |= GOT_ID; } else if ( !strncasecmp( cargv[ i ], PROVIDERSTR, sizeof( PROVIDERSTR ) - 1 )) { diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index e0bcbc5fed..32fff538f8 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1313,7 +1313,7 @@ LDAP_STAILQ_HEAD( slap_sync_cookie_s, sync_cookie ); typedef struct syncinfo_s { struct slap_backend_db *si_be; - long si_id; + long si_rid; char *si_provideruri; BerVarray si_provideruri_bv; #define SYNCINFO_TLS_OFF 0 diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 90e58e5adb..59aa1b72f9 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -310,15 +310,15 @@ do_syncrep1( /* get syncrepl cookie of shadow replica from subentry */ - assert( si->si_id < 1000 ); + assert( si->si_rid < 1000 ); syncrepl_cn_bv.bv_val = syncrepl_cbuf; syncrepl_cn_bv.bv_len = snprintf(syncrepl_cbuf, sizeof(syncrepl_cbuf), - CN_STR "syncrepl%d", si->si_id ); + CN_STR "syncrepl%d", si->si_rid ); build_new_dn( &op->o_req_ndn, psub, &syncrepl_cn_bv, op->o_tmpmemctx ); op->o_req_dn = op->o_req_ndn; LDAP_STAILQ_FOREACH( sc, &slap_sync_cookie, sc_next ) { - if ( si->si_id == sc->rid ) { + if ( si->si_rid == sc->rid ) { cmdline_cookie_found = 1; break; } @@ -1492,10 +1492,10 @@ syncrepl_updateCookie( modtail = &mod->sml_next; ber_dupbv( &cnbva[0], (struct berval *) &slap_syncrepl_bvc ); - assert( si->si_id < 1000 ); + assert( si->si_rid < 1000 ); cnbva[0].bv_len = snprintf( cnbva[0].bv_val, slap_syncrepl_bvc.bv_len, - "syncrepl%d", si->si_id ); + "syncrepl%d", si->si_rid ); mod = (Modifications *) ch_calloc( 1, sizeof( Modifications )); mod->sml_op = LDAP_MOD_REPLACE; mod->sml_desc = slap_schema.si_ad_cn; @@ -1545,10 +1545,10 @@ syncrepl_updateCookie( e = ( Entry * ) ch_calloc( 1, sizeof( Entry )); slap_syncrepl_cn_bv.bv_val = syncrepl_cbuf; - assert( si->si_id < 1000 ); + assert( si->si_rid < 1000 ); slap_syncrepl_cn_bv.bv_len = snprintf( slap_syncrepl_cn_bv.bv_val, slap_syncrepl_cn_bvc.bv_len, - "cn=syncrepl%d", si->si_id ); + "cn=syncrepl%d", si->si_rid ); build_new_dn( &slap_syncrepl_dn_bv, pdn, &slap_syncrepl_cn_bv, op->o_tmpmemctx ); -- 2.39.5