02-20-2018 05:55 AM - edited 03-01-2019 04:06 AM
Hello experts,
If stacked service has preLockCreate() and the stacked service is created by another service's preLockCreate(),
do these two preLockCreate methods run sequentially or concurrently?
As far as I observed devel.log, they seem to run sequentially.
// snippet from devel.log : preLockCreate() on stacked service and its parent serivce
ncs[37234]: devel-c service_pre_modification(update) request for callpoint 'parent-service' path /ncs:services/parent-service{test}
ncs[37234]: devel-c service_pre_modification(update) succeeded for callpoint 'parent-service' path /ncs:services/parent-service{test}
ncs[37234]: devel-c service_pre_lock_create request for callpoint 'parent-service' path /ncs:services/parent-service{test}
ncs[37234]: devel-c service_pre_lock_create succeeded for callpoint 'parent-service' path /ncs:services/parent-service{test}
ncs[37234]: devel-c service_post_modification(update) request for callpoint 'parent-service' path /ncs:services/parent-service{test}
ncs[37234]: devel-c service_post_modification(update) succeeded for callpoint 'parent-service' path /ncs:services/parent-service{test}
ncs[37234]: devel-c service_pre_modification(update) request for callpoint 'stacked-service' path /ncs:services/stacked-service{test}
ncs[37234]: devel-c service_pre_modification(update) succeeded for callpoint 'stacked-service' path /ncs:services/stacked-service{test}
ncs[37234]: devel-c service_pre_lock_create request for callpoint 'stacked-service' path /ncs:services/stacked-service{test}
ncs[37234]: devel-c service_pre_lock_create succeeded for callpoint 'stacked-service' path /ncs:services/stacked-service{test}
ncs[37234]: devel-c service_post_modification(update) request for callpoint 'stacked-service' path /ncs:services/stacked-service{test}
ncs[37234]: devel-c service_post_modification(update) succeeded for callpoint 'stacked-service' path /ncs:services/stacked-service{test}
Also, stacked service and parent service share same MAAPI handle, so they should be running in same thread.
Can anyone kindly confirm?
My customer's stacked service and parent service have overlapping config, and I want to evaluate if migrating current code to preLockCreate from create() introduces any risk.
Thank you very much in advance.
best regards,
Takeru Nomura
-------------------
Takeru Nomura
Network Consulting Engineer
Cisco Systems G.K.
Solved! Go to Solution.
02-20-2018 11:34 PM
Hi There,
I think preLockCreate() needs to be handled with care. When used, the burden of maintaining data integrity falls on the service designer. The underlying threading or sequencing model may change in the future, so best not to make such assumptions.
With regards to overlapping configs, does that mean both the top-service and the bottom-service will be touching the same underlying leaf? Could that make one of them going out-of-sync?
02-20-2018 10:12 PM
Small correction for my previous comment regarding same MAAPI handle being shared between parent and stacked services.
I have debugged MAAPI handle, process ID and Thread ID used for each services.
They all share same PID and Thread ID.
But preLockCreates of parent-service and stacked service have different MAAPI handle.
Anyway, they don't seem to be multi-threaded.
Waiting for someone to shed a light on if two preLockCreate run sequentially or concurrently in stacked service scenario...
// pre-modification called for parent-service
MAAPI Handle: 4513
PID: 3067
Thread ID: 737
// pre-lock-create called for parent-service
MAAPI Handle: 4518
PID: 3067
Thread ID: 737
// post-modification called for parent-service
MAAPI Handle: 4513
PID: 3067
Thread ID: 737
// pre-modification called for stacked service
MAAPI Handle: 4513
PID: 3067
Thread ID: 737
// pre-lock-create called for stacked service
MAAPI Handle: 4521
PID: 3067
Thread ID: 737
// post-modification called for stacked service
MAAPI Handle: 4513
PID: 3067
Thread ID: 737
best regards,
Takeru Nomura
02-20-2018 11:34 PM
Hi There,
I think preLockCreate() needs to be handled with care. When used, the burden of maintaining data integrity falls on the service designer. The underlying threading or sequencing model may change in the future, so best not to make such assumptions.
With regards to overlapping configs, does that mean both the top-service and the bottom-service will be touching the same underlying leaf? Could that make one of them going out-of-sync?
02-21-2018 02:34 AM
Hello Bilal,
Thank you so much for your comment.
I understand your point.
preLockCreate of parent service and stacked service may be sequential now, but there is no guarantee that it will be the same in future NSO release.
With regards to your concern regarding two services going out-of-sync, looks like they are in sync.
Two services always generate same value for overlapping config.
Would appreciate if you can share your concern in case I am missing something here.
Best regards,
Takeru Nomura
02-21-2018 01:22 PM
Hi Takeru,
> Two services always generate same value for overlapping config.
Ok, so it is like some shared config and NSO would refcount it.The issue is when two service instances touch the same one node and try to set it to different values. That is when one of the service instance will go out-of-sync: service-instance that ran first.
Thanks.
02-21-2018 09:35 PM
Hi Bilal,
Thank you for sharing your insight.
Glad to know my customer case doesn't match the out-of-sync case.
Best regards,
Takeru Nomura
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide