Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-21597

Subdoc atomic/concurrency broken

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • master, 4.5.1
    • 4.6.0
    • memcached
    • None

    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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            Looking at the existing subdoc test cases I see we do arrayprepend_in, addunique_in, etc but not mutate_in. Do you know if this issue unique to mutate_in?

            ericcooper Eric Cooper (Inactive) added a comment - Looking at the existing subdoc test cases I see we do arrayprepend_in, addunique_in, etc but not mutate_in. Do you know if this issue unique to mutate_in?

            There shouldn't be a difference between them.

            mnunberg Mark Nunberg (Inactive) added a comment - There shouldn't be a difference between them.

            FYI, this also affects subdoc operations using CAS.

            pvarley Patrick Varley added a comment - FYI, this also affects subdoc operations using CAS.

            Build 4.6.0-3469 contains memcached commit 098c351ef3877bd3bebc92feebc9d368bde79759 with commit message:
            MB-21597: Use OPERATION_CAS rather than OPERATION_REPLACE
            https://github.com/couchbase/memcached/commit/098c351ef3877bd3bebc92feebc9d368bde79759

            build-team Couchbase Build Team added a comment - Build 4.6.0-3469 contains memcached commit 098c351ef3877bd3bebc92feebc9d368bde79759 with commit message: MB-21597 : Use OPERATION_CAS rather than OPERATION_REPLACE https://github.com/couchbase/memcached/commit/098c351ef3877bd3bebc92feebc9d368bde79759

            Build 4.5.1-2848 contains memcached commit aa8c06717967363ad76ad1cc1288f33c65fbee31 with commit message:
            MB-21597: Use OPERATION_CAS rather than OPERATION_REPLACE
            https://github.com/couchbase/memcached/commit/aa8c06717967363ad76ad1cc1288f33c65fbee31

            build-team Couchbase Build Team added a comment - Build 4.5.1-2848 contains memcached commit aa8c06717967363ad76ad1cc1288f33c65fbee31 with commit message: MB-21597 : Use OPERATION_CAS rather than OPERATION_REPLACE https://github.com/couchbase/memcached/commit/aa8c06717967363ad76ad1cc1288f33c65fbee31

            Build 4.7.0-1312 contains memcached commit 098c351ef3877bd3bebc92feebc9d368bde79759 with commit message:
            MB-21597: Use OPERATION_CAS rather than OPERATION_REPLACE
            https://github.com/couchbase/memcached/commit/098c351ef3877bd3bebc92feebc9d368bde79759

            build-team Couchbase Build Team added a comment - Build 4.7.0-1312 contains memcached commit 098c351ef3877bd3bebc92feebc9d368bde79759 with commit message: MB-21597 : Use OPERATION_CAS rather than OPERATION_REPLACE https://github.com/couchbase/memcached/commit/098c351ef3877bd3bebc92feebc9d368bde79759

            I created CBQE-3709 to create an automated test for this scenario.

            ericcooper Eric Cooper (Inactive) added a comment - I created CBQE-3709 to create an automated test for this scenario.

            I believe CBQE-3721 has the fix for the test suit.

            pvarley Patrick Varley added a comment - I believe CBQE-3721 has the fix for the test suit.

            People

              mnunberg Mark Nunberg (Inactive)
              mnunberg Mark Nunberg (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty