Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.2
    • Component/s: library
    • Security Level: Public
    • Labels:
      None

      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

        Issue Links

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

          Activity

          Show
          avsej Sergey Avseyev added a comment - http://review.couchbase.org/27343

            People

            • Assignee:
              avsej Sergey Avseyev
              Reporter:
              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