Sinking in big trouble,
Well can anyone tell me , how can i acquire write lock through cypher. Note : I will use REST APIs , So my cypher would in php.
EDITED : Scenario:
I am using Neo4j REST server and PHP to access it.
Now i have created a node say 'counter-node' which generates new user id. Logic is just add 1 to previous value.
Now If two users are coming simultaneously then first user read 'counter-node' value BUT before it can update it to 1 , second user read it . Thus value in 'counter-node' is not as expected.
Any Help
You don't need to acquire write locks explicitly. All nodes that you modify in a transaction are write-locked automatically.
So if you do this in your logic:
no two users will ever get the same ID.