Order guarentee for multiple operations

node

#1

Does the nodejs SDK provide an ordering guarentee on a single bucket?


#2

Hey @krishan1390,
Could you elaborate on what you mean by ordering guarantee?
Cheers, Brett


#3

Hey @brett19,

Apologies for the lack of information.

Assuming no network disconnects,
If I call bucket.counter(key, Delta, options, callback) multiple times concurrently from an application

  1. Will all the counter operations be applied in couchbase in the order in which they were invoked

  2. Will the callbacks for each counter operation be executed in the order in which they were called?


#4

Hey @krishan1390, it will typically be the case that performing multiple counter operations ‘concurrently’, that they will still execute in the order they were dispatched (since Node.js is single-process, you can’t actually end up with concurrent dispatch). I wouldn’t rely on this behaviour though, and would opt to perform the operations serially instead if you need to guarantee ordering. This is because the underlying behaviour of the operations is not necessarily defined.