Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-225

Get CAS for a key without reading the entire document.

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.2.1
    • Component/s: library
    • Security Level: Public
    • Labels:
      None

      Description

      Customer has requested the ability to be able to obtain the CAS for a document without having to read the document value.

      Customer is currently using observe() to achieve this, but current Python observe unconditionally checks for persisted/replicated which isn't needed (and furthermore is slower as you potentially wait for them). They require a fast lookup (like get) but just returning CAS.

        Issue Links

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

          Activity

          Hide
          mnunberg Mark Nunberg added a comment -

          This can be done via a single observe call to the master. However, this would need support in libcouchbase. This means adding an additional API call and/or struct field, and the like

          Show
          mnunberg Mark Nunberg added a comment - This can be done via a single observe call to the master. However, this would need support in libcouchbase. This means adding an additional API call and/or struct field, and the like
          Hide
          mnunberg Mark Nunberg added a comment -

          Which.. has actually been up for review for quite some time in the form of CCBC-152!

          Show
          mnunberg Mark Nunberg added a comment - Which.. has actually been up for review for quite some time in the form of CCBC-152 !
          Hide
          drigby Dave Rigby added a comment -

          @Mark: I think this could also be done with the low-level CMD_GET_META, but that doesn't appear to be in libcouchbase either at present...

          Show
          drigby Dave Rigby added a comment - @Mark: I think this could also be done with the low-level CMD_GET_META, but that doesn't appear to be in libcouchbase either at present...
          Hide
          ingenthr Matt Ingenthron added a comment -

          note that CMD_GET_META is not considered part of the public interface by the Couchbase Server team, so it won't be in libcouchbase.

          I see the use case described there, but to be honest it doesn't fully make sense to me. It talks about grabbing the item to determine a particular state, but then grabbing the CAS at a later time. There's a problem there in that the item could have changed either by the application or by some kind of failure.

          In any event, Mark is correct this is part of the low level observe() command.

          Show
          ingenthr Matt Ingenthron added a comment - note that CMD_GET_META is not considered part of the public interface by the Couchbase Server team, so it won't be in libcouchbase. I see the use case described there, but to be honest it doesn't fully make sense to me. It talks about grabbing the item to determine a particular state, but then grabbing the CAS at a later time. There's a problem there in that the item could have changed either by the application or by some kind of failure. In any event, Mark is correct this is part of the low level observe() command.
          Hide
          perry Perry Krug added a comment -

          Spoke with both Matt and the end customer. The use case is about (in some cases) avoiding writing a large object back to Couchbase in the event that it has changed and would generate a CAS miss. There's a case to be made for understanding how likely that is to happen, but either way our lower-level code paths could be slightly improved upon to allow for a call to observe just for existence on the active.

          Mark, could it be done without an additional API by just improving libcouchbase to handle replicateTo0 and persistTo0 as just a call to the active? I don't think it's as important to have a specific call just for CAS if a slightly optimized observe will really do the trick...

          Show
          perry Perry Krug added a comment - Spoke with both Matt and the end customer. The use case is about (in some cases) avoiding writing a large object back to Couchbase in the event that it has changed and would generate a CAS miss. There's a case to be made for understanding how likely that is to happen, but either way our lower-level code paths could be slightly improved upon to allow for a call to observe just for existence on the active. Mark, could it be done without an additional API by just improving libcouchbase to handle replicateTo0 and persistTo0 as just a call to the active? I don't think it's as important to have a specific call just for CAS if a slightly optimized observe will really do the trick...
          Hide
          mnunberg Mark Nunberg added a comment -

          I wouldn't find such an improvement maintainable. It would be an extension to the 'observe' command which would return a normal 'array' of a single object which would be limited to the master/active node only. These "Improvements" would be reflected up the chain and would provide for a rather odd API.

          That's why I think a new API which explicitly only contacts the master is a better option. I suppose we could call it observe_m? We're primarily stuck on figuring out how to implement these semantics.

          Show
          mnunberg Mark Nunberg added a comment - I wouldn't find such an improvement maintainable. It would be an extension to the 'observe' command which would return a normal 'array' of a single object which would be limited to the master/active node only. These "Improvements" would be reflected up the chain and would provide for a rather odd API. That's why I think a new API which explicitly only contacts the master is a better option. I suppose we could call it observe_m? We're primarily stuck on figuring out how to implement these semantics.
          Show
          mnunberg Mark Nunberg added a comment - http://review.couchbase.org/33410

            People

            • Assignee:
              mnunberg Mark Nunberg
              Reporter:
              drigby Dave Rigby
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes