Uploaded image for project: 'Couchbase Ruby client library'
  1. Couchbase Ruby client library
  2. RCBC-133

Improved replica read command

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 1.3.2
    • None
    • library
    • Security Level: Public
    • None
    • Release Note

    Description

      Allow to specify strategy of selecting replica nodes. Now three strategies available:

      • `:first` - synonym to `true`, previous behaviour and currently
        default. It means that the library will sequentially iterate
        over all replicas and will return as soon as find successful
        response, or report error from the latest.

      c.get("foo", :replica => true)
      c.get("foo", :replica => :first)
      #=> "bar"
      c.get("foo", :replica => :first, :extended => true)
      #=> ["bar", 0, 11218368683493556224]

      • `:all` - query all replicas in parallel. In this case the method
        will return array of the values on the all replica nodes without
        particular order. Also if the key isn't on the node, it will be
        skipped in the result array.

      c.get("foo", :replica => :all)
      #=> ["bar", "bar", "bar"]
      c.get("foo", :replica => :all, :extended => true)
      #=> [["bar", 0, 11218368683493556224],

      1. ["bar", 0, 11218368683493556224],
      2. ["bar", 0, 11218368683493556224]]
      • `Fixnum` - you can also select specific replica node by its
        index in the cluster configuration. It should be in interval
        `0...c.num_replicas`

      0...c.num_replicas
      #=> 0...3
      c.get("foo", :replica => 1)
      #=> "bar"
      c.get("foo", :replica => 42)
      #=> ArgumentError: replica index should be in interval 0...3

      Attachments

        Issue Links

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

          Activity

            People

              avsej Sergey Avseyev
              avsej Sergey Avseyev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty