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

Option for telling where to send reads for replica sets

    XMLWordPrintable

    Details

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

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: