Is upsert in Update API atomic? Assume that client 1 sends an update request with an upsert document and client 2 sends another request with the same upsert document. Is it possible that the first request checks if the object exists or not and sees that it does not exist; Then, the second request's thread starts and checks if the object exists and sees it does not exists; Then, the second request inserts the upsert document and performs its update; Then the first request inserts its upsert document overriding the update of the second request?
Also, how can I make sure both of the updates are done and one is not overridden by the other request?
Thank you. About the second question: Can I be sure that this scenario does not happen:
Request 1 inserts the upsert document and reads it to perform the update. Before writing the updated value request 2 reads the document that request 1 has inserted and performs the update. Then both of them write their updated values, and thus one of them is overridden by the other (only one of the updates is applied).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.