From 447f3f746e59fc5b724b8dd8bfb1ec0e02cc8d9f Mon Sep 17 00:00:00 2001 From: Rein Tollevik Date: Thu, 5 Mar 2009 20:43:53 +0000 Subject: [PATCH] ITS#6001 SID of queued CSN must match the one in the op --- servers/slapd/ctxcsn.c | 12 ++++++++++-- servers/slapd/slap.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/servers/slapd/ctxcsn.c b/servers/slapd/ctxcsn.c index 873721600f..95d7ba6ed1 100644 --- a/servers/slapd/ctxcsn.c +++ b/servers/slapd/ctxcsn.c @@ -40,6 +40,7 @@ slap_get_commit_csn( { struct slap_csn_entry *csne, *committed_csne = NULL; BackendDB *be = op->o_bd->bd_self; + int sid = -1; if ( maxcsn ) { assert( maxcsn->bv_val != NULL ); @@ -51,6 +52,10 @@ slap_get_commit_csn( ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex ); + if ( !BER_BVISEMPTY( &op->o_csn )) { + sid = slap_parse_csn_sid( &op->o_csn ); + } + LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) { if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) { csne->ce_state = SLAP_CSN_COMMIT; @@ -60,8 +65,10 @@ slap_get_commit_csn( } LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) { - if ( csne->ce_state == SLAP_CSN_COMMIT ) committed_csne = csne; - if ( csne->ce_state == SLAP_CSN_PENDING ) break; + if ( sid != -1 && sid == csne->ce_sid ) { + if ( csne->ce_state == SLAP_CSN_COMMIT ) committed_csne = csne; + if ( csne->ce_state == SLAP_CSN_PENDING ) break; + } } if ( maxcsn ) { @@ -185,6 +192,7 @@ slap_queue_csn( ber_dupbv( &pending->ce_csn, csn ); ber_bvreplace_x( &op->o_csn, &pending->ce_csn, op->o_tmpmemctx ); + pending->ce_sid = slap_parse_csn_sid( csn ); pending->ce_connid = op->o_connid; pending->ce_opid = op->o_opid; pending->ce_state = SLAP_CSN_PENDING; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index be010c2212..a47d1bb54b 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -2371,6 +2371,7 @@ typedef struct PagedResultsState { struct slap_csn_entry { struct berval ce_csn; + int ce_sid; unsigned long ce_opid; unsigned long ce_connid; #define SLAP_CSN_PENDING 1 -- 2.39.5