SiberianGuy
SiberianGuy

Reputation: 25302

RavenDb script patching consistency

I have a pretty complicated document modification logic. The problem raises when during this logic execution this document is modified by other caller. So when I call DocumentSession.SaveChanges I can loose some changes that were done by other caller. As a way to resolve it I implemented a patching script. My question is whether RavenDb guarantees the document will not be modified by other callers while patching script is being executed or not. So is there something like document modification queue in RavenDb internally?

Upvotes: 0

Views: 52

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

Idsa, You can resolve that without patching by setting UseOptimisticConcurrency=true; on the session, which will cause a ConcurrencyException to be thrown.

With Patching, we'll make sure that the patch is always running on a consistent view of the document, and it will only be applied if there has been no modifications. If there were modifications midway, the patch will be re-applied on the new version.

Upvotes: 1

Related Questions