Can anyone please tell me how can we use below function to use transaction in action callpoint.
int maapi_request_action_th(int sock, int thandle, confd_tag_value_t
*params, int nparams, confd_tag_value_t **values, int *nvalues, const
char *fmt, …);
thanks for the response.
If i want to start the write transaction from action callpoint which steps i need to follow. Because, when i am trying to start normal CDB_RUNNING session, Confd getting stuck on apply_transaction function.
Below process i followed to start transaction from action callpoint,
/* Session creation */
CDA_CONFD_FATAL(CDA_maapi_start(CDB_RUNNING, &th, IMMEDIATE));
CDA_maapi_set_namespace(th, core_model__ns);
maapi_ret = CDA_maapi_exists(th, CORE_MODEL_FD_FC, vlanFd_uuid, vlanFc_uuid);
if(CONFD_TRUE != maapi_ret)
{
CDA_CONFD_FATAL(CDA_maapi_create(th, CORE_MODEL_FD_FC, vlanFd_uuid, vlanFc_uuid));
CDA_CONFD_FATAL(CDA_maapi_cd(th, CORE_MODEL_FD_FC, vlanFd_uuid, vlanFc_uuid));
/* set the vlan-fc local id */
CDA_SET_STR(&vt, vlanFc_localId);
CDA_CONFD_FATAL(CDA_maapi_set_elem(th, &vt, CORE_MODEL_LOCAL_ID_ENT));
}
else
{
printf("RPC instance for given vlan ID already exists");
}
CDA_CONFD_FATAL(CDA_maapi_apply_trans(th));
CDA_CONFD_FATAL(CDA_maapi_end(th));
Start a separate thread/process that perform the transaction if your action handler thread also handle subscriptions or other callpoints triggered by the commit (apply).
There is likely a deadlock. ConfD is waiting for your thread to reply to for example a transaction subscription notification or some other callback invocation inside the transaction lock, while you are starting a transaction that will wait for that transaction to finish before continuing.
I suggest looking into the ConfD developer log (log level trace) which will tell what the ConfD transaction manager is doing at the time of the MAAPI apply.