[SERVER-41455] Support running $out or $merge from a secondary with writes to the primary Created: 03/Jun/19 Updated: 29/Oct/23 Resolved: 20/Apr/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | 4.4.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Charlie Swanson | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Assigned Teams: |
Query
|
||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Description |
|
It should be possible to perform reads from a secondary node and send the writes to the primary. If the read part of a pipeline is expensive but the write is not so expensive, this could help decrease load on the primary. |
| Comments |
| Comment by David Storch [ 20/Apr/20 ] |
|
This work was completed in 4.4 over a series of commits. Therefore, I'm closing this umbrella ticket as fixed in 4.4.0-rc0 despite there being no specific commits against it. If a client sends an aggregate command with $out or $merge to a replica set secondary in a FCV "4.4" deployment, and provides a non-primary read preference, then the query will be computed on the secondary node but will direct any write operations to the primary node. (In a sharded scenario, writes may be directed to the primary nodes of multiple shards.) In previous versions, such operations would fail uncleanly, and so drivers would never direct $out or $merge operations to replica set secondaries. Note that as of this writing, drivers have not done the work to expose this new feature to applications. Drivers may choose to only expose $out/$merge on secondaries starting in 4.6 in order to simply handling of the 4.2/4.4 upgrade/downgrade process. |