cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
808
Views
0
Helpful
1
Replies

Handling commit transaction from another session in Transformation package [Erlang]

shgaiton
Cisco Employee
Cisco Employee

 

In NSO, the transformation package has already acquired a lock to commit an ongoing transaction. Based on a design requirement, we are using maapi context to create another session inside our transformation package to commit our config transaction to the device. However, the commit is failing because it tries to get a lock but since the parent lock is in place, this lock is getting blocked which results in application timeout. How to get around this issue?

Created a separate maapi user session and trying to commit transaction in transformation package in the following way:

econfd_maapi:commit_trans(M, TH),
econfd_maapi:finish_trans(M, TH),
econfd_maapi:end_user_session(M),
econfd_maapi:close(M).

Logs for reference:

191 <DEBUG> 25-Jun-2020::12:37:44.055 bgl-ads-3181 ncs[63102]: ncs commit progress db=running usid=116 thandle=2101: applying transaction...
192 <DEBUG> 25-Jun-2020::12:37:44.055 bgl-ads-3181 ncs[63102]: ncs commit progress db=running usid=116 thandle=2101: entering validate phase for running...
193 <DEBUG> 25-Jun-2020::12:37:44.055 bgl-ads-3181 ncs[63102]: ncs commit progress db=running usid=116 thandle=2101: run pre-trans-lock service callbacks...
194 <DEBUG> 25-Jun-2020::12:37:44.055 bgl-ads-3181 ncs[63102]: ncs commit progress db=running usid=116 thandle=2101: run transforms and transaction hooks...
195 <DEBUG> 25-Jun-2020::12:37:44.055 bgl-ads-3181 ncs[63102]: ncs commit progress db=running usid=116 thandle=2101: run transforms and transaction hooks done
196 <DEBUG> 25-Jun-2020::12:37:44.055 bgl-ads-3181 ncs[63102]: ncs commit progress db=running usid=116 thandle=2101: run pre-trans-lock service callbacks done
197
198 <DEBUG> 25-Jun-2020::12:37:44.058 bgl-ads-3181 ncs[63102]: devel-c db reply daemon id: 95
199 <DEBUG> 25-Jun-2020::12:37:44.058 bgl-ads-3181 ncs[63102]: devel-c new_trans request daemon id: 95 thandle: 2101
200 <DEBUG> 25-Jun-2020::12:37:44.067 bgl-ads-3181 ncs[63102]: devel-c new_trans succeeded daemon id: 95 session id: 2101 worker id: 11
201 <DEBUG> 25-Jun-2020::12:37:44.067 bgl-ads-3181 ncs[63102]: devel-c new_usess db request daemon id: 2
202 <DEBUG> 25-Jun-2020::12:37:44.067 bgl-ads-3181 ncs[63102]: devel-c db reply daemon id: 2
203 <DEBUG> 25-Jun-2020::12:37:44.067 bgl-ads-3181 ncs[63102]: devel-c new_trans request daemon id: 2 thandle: 2101
204 <DEBUG> 25-Jun-2020::12:37:44.067 bgl-ads-3181 ncs[63102]: devel-c new_trans succeeded daemon id: 2 session id: 2101 worker id: 1
205 <DEBUG> 25-Jun-2020::12:37:44.067 bgl-ads-3181 ncs[63102]: devel-c new_usess db request daemon id: 0
206 <DEBUG> 25-Jun-2020::12:37:44.068 bgl-ads-3181 ncs[63102]: devel-c db reply daemon id: 0
207 <DEBUG> 25-Jun-2020::12:37:44.068 bgl-ads-3181 ncs[63102]: devel-c new_trans request daemon id: 0 thandle: 2101
208 <DEBUG> 25-Jun-2020::12:37:44.068 bgl-ads-3181 ncs[63102]: devel-c new_trans succeeded daemon id: 0 session id: 2101 worker id: 1
209 <DEBUG> 25-Jun-2020::12:37:44.068 bgl-ads-3181 ncs[63102]: devel-c trans_lock request daemon id: 2 session id: 2101
210 <DEBUG> 25-Jun-2020::12:37:44.069 bgl-ads-3181 ncs[63102]: devel-c trans_lock succeeded daemon id: 2 session id: 2101
211 <DEBUG> 25-Jun-2020::12:37:44.069 bgl-ads-3181 ncs[63102]: ncs commit progress db=running usid=116 thandle=2101: grabbing transaction lock ok
212 <DEBUG> 25-Jun-2020::12:37:44.069 bgl-ads-3181 ncs[63102]: ncs commit progress db=running usid=116 thandle=2101: creating rollback file...

1 Accepted Solution

Accepted Solutions

rogaglia
Cisco Employee
Cisco Employee

So, you want support for nested transactions inside create()? I do not believe you will be able to achieve it safely. What I would recommend you is to check-out nano-services as that may be a better design paradigm.

View solution in original post

1 Reply 1

rogaglia
Cisco Employee
Cisco Employee

So, you want support for nested transactions inside create()? I do not believe you will be able to achieve it safely. What I would recommend you is to check-out nano-services as that may be a better design paradigm.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: