-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
v4.0, v3.6
-
Query 2018-10-08, Query 2018-11-19, Query 2018-12-03, Query 2018-12-17
-
(copied to CRM)
The following scenario (at least) can cause an infinite loop in $sample:
- A moveChunk command starts moving a chunk from shard0 to shard1
- $sample begins and a getMore targets shard1
- That getMore uses a cursor that samples randomly with replacement from WiredTiger
- That cursor only fetches one document because the sample size is one, and that document does not belong to that shard because it's in the chunk that's being moved from shard0 to shard1 and does not own it. The ShardFilterStage then filters that document and returns NEEDS_TIME
- The yielding policy is NO_YIELD for some reason so no yielding happens and it tries to sample the cursor again but gets the same document back. This happens infinitely. The yielding behavior may not affect the infinite loop in this case, but it's still unexpected so I'm including it here.
- is related to
-
SERVER-36872 Comment out $sample tests in testshard1.js temporarily
- Closed
-
SERVER-37750 Optimized $sample stage does not yield
- Closed