Description
Subdocument concurrency is broken - it seems we overwrite previous mutations without regard for actually checking the CAS. The example below will spit out a different number for each run, indicating that some of the mutations are indeed being swallowed.
#!/usr/bin/env python
|
from threading import Thread
|
|
from couchbase.bucket import Bucket
|
import couchbase.subdocument as SD
|
|
|
DOCID = 'subdoc_doc_id'
|
CONNSTR = 'couchbase://localhost:12000'
|
ITERATIONS = 200
|
THREADS = 20
|
|
main_bucket = Bucket(CONNSTR)
|
main_bucket.upsert(DOCID, {'recs':[]})
|
|
thrs = []
|
|
class Runner(Thread):
|
def run(self, *args, **kw):
|
cb = Bucket(CONNSTR)
|
for x in range(ITERATIONS):
|
cb.mutate_in(DOCID, SD.array_append('recs', 1))
|
|
thrs = [Runner() for x in range(THREADS)]
|
[t.start() for t in thrs]
|
[t.join() for t in thrs]
|
|
obj = main_bucket.get(DOCID)
|
print 'Object has {} items'.format(len(obj.value['recs']))
|
Attachments
Issue Links
- is duplicated by
-
MB-21915 4.5.1 / arrayAppend sometimes does not append value
- Closed
For Gerrit Dashboard: MB-21597 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
69663,3 | MB-21597: Use OPERATION_CAS rather than OPERATION_REPLACE | master | memcached | Status: ABANDONED | -1 | -1 |
69736,4 | MB-21597: Use OPERATION_CAS rather than OPERATION_REPLACE | watson | memcached | Status: MERGED | +2 | +1 |
69750,1 | Merge remote-tracking branch 'couchbase/watson' | master | memcached | Status: ABANDONED | 0 | -1 |
69775,3 | Merge remote-tracking branch 'couchbase/watson' | master | memcached | Status: MERGED | +2 | +1 |
69781,2 | MB-21597: Use OPERATION_CAS rather than OPERATION_REPLACE | 4.5.1 | memcached | Status: MERGED | +2 | +1 |