src/ckpt/ckptd/cpd_db.c   |   4 ++++
 src/ckpt/ckptd/cpd_proc.c |  30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)


--------
The replica IMM objects are not created after opening a checkpoint in following 
scenario:

1. Open a checkpoint with flag SA_CKPT_CHECKPOINT_CREATE
2. Unlink the checkpoint ( the checkpoint is still being used)
3. Open a checkpoint with flag SA_CKPT_CHECKPOINT_CREATE with same name as the 
one in 1.

After step 3. although the checkpoint is opened successfully, the replica IMM 
objects
are not created.

The problem happens because the CPD does not delete relating nodes from 
ckpt_reploc_tree
when it unlinks the checkpoint in step 2.

Solution:
---------
The solution is to remove replica location node of that checkpoint from the 
ckpt_reploc_tree
when unlinking the checkpoint.

diff --git a/src/ckpt/ckptd/cpd_db.c b/src/ckpt/ckptd/cpd_db.c
--- a/src/ckpt/ckptd/cpd_db.c
+++ b/src/ckpt/ckptd/cpd_db.c
@@ -441,6 +441,8 @@ uint32_t cpd_ckpt_reploc_node_delete(CPD
 {
        uint32_t rc = NCSCC_RC_SUCCESS;
 
+       TRACE_ENTER();
+
        if (cb->ha_state == SA_AMF_HA_ACTIVE) {
 
                rc = cpd_ckpt_reploc_imm_object_delete(cb, ckpt_reploc_node, 
is_unlink_set);
@@ -462,6 +464,7 @@ uint32_t cpd_ckpt_reploc_node_delete(CPD
                        TRACE_4("cpd db node add failed ");
                }
 
+               TRACE_LEAVE();
                return NCSCC_RC_FAILURE;
        }
 
@@ -470,6 +473,7 @@ uint32_t cpd_ckpt_reploc_node_delete(CPD
                m_MMGR_FREE_CPD_CKPT_REPLOC_INFO(ckpt_reploc_node);
        }
 
+       TRACE_LEAVE();
        return rc;
 }
 
diff --git a/src/ckpt/ckptd/cpd_proc.c b/src/ckpt/ckptd/cpd_proc.c
--- a/src/ckpt/ckptd/cpd_proc.c
+++ b/src/ckpt/ckptd/cpd_proc.c
@@ -1043,6 +1043,36 @@ uint32_t cpd_proc_unlink_set(CPD_CB *cb,
        (*ckpt_node)->attributes = map_info->attributes;
        /* Delete the MAP Info */
        rc = cpd_ckpt_map_node_delete(cb, map_info);
+
+       /* Delete replica location of the unlinked checkpoint from the 
ckpt_reploc_tree */
+       CPD_NODE_REF_INFO *nref_info = (*ckpt_node)->node_list;
+
+       while (nref_info) {
+               SaClmNodeIdT node_id = 
m_NCS_NODE_ID_FROM_MDS_DEST(nref_info->dest);
+               SaClmClusterNodeT cluster_node;
+               CPD_REP_KEY_INFO key_info;
+               CPD_CKPT_REPLOC_INFO *reploc_info = NULL;
+
+               memset(&cluster_node, 0, sizeof(SaClmClusterNodeT));
+               memset(&key_info, 0, sizeof(CPD_REP_KEY_INFO));
+
+               if (saClmClusterNodeGet(cb->clm_hdl, node_id, 
CPD_CLM_API_TIMEOUT, &cluster_node) != SA_AIS_OK) {
+                       LOG_ER("cpd unlink set - saClmClusterNodeGet failed for 
node_id %u",node_id);
+                       rc = SA_AIS_ERR_LIBRARY;
+                       break;
+               }
+
+               key_info.node_name = 
osaf_extended_name_borrow(&cluster_node.nodeName);
+               key_info.ckpt_name = ckpt_name;
+
+               cpd_ckpt_reploc_get(&cb->ckpt_reploc_tree, &key_info, 
&reploc_info);
+               if (reploc_info) {
+                       cpd_ckpt_reploc_node_delete(cb, reploc_info, 
(*ckpt_node)->is_unlink_set);
+               }
+
+               nref_info = nref_info->next;
+       }
+
        TRACE_LEAVE();
        return rc;
 }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to