Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-299

Option for telling where to send reads for replica sets

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Gentoo amd64
      MongoDB 1.8.2
      Mongoid 2.0.2

      It was told to me by the maintainer that this request must be sent to the Ruby driver first.

      Sometimes it would be vital to be able to send reads to the primary node of the replica set when config contains "read_secondary: true"

      It is needed for re-reading the data immediatelly after write (for consistency, safe operations, etc.). A very trivial example is to try to avoid duplicated comments on a blog. You have to check for other comments with same content and same author in the last several seconds. When user sends the comment 10 times (with clicking 10 times fast), reading replica secondaries won't help to determine if there is another comment with the same content or not. Just because the replication delay.

      Sending read request to the primary would help in this case.

      .safely(w: N) also should do the work but it can make mongoid hang forever if N is greater than the number of the active nodes. Which can happen easily.

            Assignee:
            kbanker Kyle Banker
            Reporter:
            mage Mage
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: