-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
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.
- duplicates
-
RUBY-284 Add cascading :read API
- Closed