简体   繁体   中英

Azure Document DB Dirty Read / Write

Since Azure Documentdb updates the whole document doesn't it create a situation for dirty read /write /phantoms.

Suppose I have following document

{
id:"1",
markers:[1,2,3]
}

Client A reads the above document.. in a web app.. and sits with for it about 5 mins and in mean time Client B also reads the document but it updates it with

{
id:"1"
**markers:[1,2,3,4]**
}

Since the update from Client A would come in update of whole document it would corrupt the data ?

Is there any way to avoid this ?

The Azure DocumentDB support optimistic concurrency using ETAG. When updating document, you can use the ETAG to avoid the overwrite. Here is one detailed blog on this topic https://peter.intheazuresky.com/2016/04/28/documentdb-revisited-part-3-concurrency-in-documentdb/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM