From fb0c84b1eb557e85d4ca4df1bbce7976fe1fb50b Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Tue, 25 Jul 2017 13:46:14 +0200 Subject: [PATCH] additional fix for 49287: handle readonly replica check if replicaid is readonly replica id and if ruv element for replicaid can be found reviewed by: --- ldap/servers/plugins/replication/repl5_ruv.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c index 99b14be..ea351e8 100644 --- a/ldap/servers/plugins/replication/repl5_ruv.c +++ b/ldap/servers/plugins/replication/repl5_ruv.c @@ -1581,14 +1581,23 @@ ruv_cancel_csn_inprogress(void *repl, RUV *ruv, const CSN *csn, ReplicaId local_ if (csn_primary(repl, csn, prim_csn)) { /* the prim csn is cancelled, lets remove all dependent csns */ /* for the primary replica we can have modifications for two RIDS: - * - the local RID for direct or internal operations - * - a remote RID if the primary csn is for a replciated op. - */ + * - the local RID for direct or internal operations + * - a remote RID if the primary csn is for a replciated op. + */ ReplicaId prim_rid = csn_get_replicaid(csn); - repl_ruv = ruvGetReplica(ruv, local_rid); + repl_ruv = ruvGetReplica(ruv, prim_rid); + if (!repl_ruv) { + rc = RUV_NOTFOUND; + goto done; + } rc = csnplRemoveAll(repl_ruv->csnpl, prim_csn); - if (prim_rid != local_rid) { - repl_ruv = ruvGetReplica(ruv, prim_rid); + + if (prim_rid != local_rid && local_rid != READ_ONLY_REPLICA_ID) { + repl_ruv = ruvGetReplica(ruv, local_rid); + if (!repl_ruv) { + rc = RUV_NOTFOUND; + goto done; + } rc = csnplRemoveAll(repl_ruv->csnpl, prim_csn); } -- 2.5.5