08-24-2017 08:10 PM
In my pipeline, I use Pipeline Execute snap to run some sub-pipeline.
I like using the pool size option in this Snap so that it can create multiple pipelines running at concurrently.
However, like any other concurrent thing, sometimes there is a small chance that 2 or more concurrent threads write the same data into the same place(e.g. database) at the same time, although there’s a check in my pipeline for the data existance in DB before doing insert. (If no data, then insert, if there is data, then update)
Is there any locking or thread safe mechanisams (like Java lock) in Snaplogic that can prevent such threading issue?
Thanks
Solved! Go to Solution.
08-25-2017 01:19 PM
Yes if the location is made sure to exist before this is written.
I am pretty sure you wont have to insert 100s of locations every load. It is a one time thing.
Glad you figured it!!
08-25-2017 05:18 AM
Thanks, that approach makes more sense now.
As far as locking goes there isn’t anything in the product that would function like you were thinking at this point.
What Naveen mentioned is right. Is there any way to possibly preprocess the data so that you’d only have one instance of a place across your incoming documents (could be dangerous, if the one with the data fails)?
I’m not sure how your SOAP endpoint functions, are you just publishing flat employee records in one soap call or are you making multiple soap calls per incoming document to write pieces of the employee record to different places?
Is there any danger from your side having the duplicate data overwrite for your application?
08-25-2017 01:07 PM
Thanks, in our case, we have to make multiple soap calls per incoming document. There’s no other choice to do that.
But anyway. I somehow organize the data a little bit, removed the duplicate location from the data.
Now I am able to leverage the pool size of Pipeline Execute without worrying about the race condition.
Thanks again
08-25-2017 01:19 PM
Yes if the location is made sure to exist before this is written.
I am pretty sure you wont have to insert 100s of locations every load. It is a one time thing.
Glad you figured it!!