Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

Concurrency during Update using eTags

$
0
0

Hi Experts,

 

i've found a race condition while performing an update statement on my oData service. To achieve concurrency control i'm using eTags which is already working fine for most situations. But there is a sequence that i can not handle with eTags, let me describe it in the following table. The left column contains the actions for User 1, the right one those for User 2. To show the chronological order the steps are ordered from top to bottom, so that the action in row 1 ist executed before row 2 and so on. The entries highlighted in bold red are the actual actions performed by users, the other entries serve for better understanding.

 

When performing an Update-Statement in SAPUI5 the framework is automatically calling the "GetEntity"-Method to compute the necessary eTag and comparing it with the timestamp used by the Application (simplified). Only when both eTags are matching the Update-Statement will be executed.

 

NrUser 1 ActionUser 2 Action
1Calling GetEntity and comparing eTag --> OK
2Calling GetEntity and comparing eTag --> OK
3At this point both users are able to update the entityAt this Point both users are able to update the entity
4Performing Update
5Now User 1 is working on the updated datasetNow User 2 is working on an outdated dataset
6Performing Update
7User 2 has overwritten the data of User 1
8User 1 does not know about the changes of User 2User 2 has never seen the changes of User 1

 

As you can see both users could update the dataset without noticing the changes of the other one. I can also provoke this behaviour using the Debugger, so this is a "real-life" problem. The only solution i found is to raise an exception in the Update-Routine, but therefore i have to check the timestamp on my own - a feature that i thought eTags could handle for me.

 

 

Finally my question: is there another approach to handle this race condition?

 

Best regards

Lukas


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>