Details
-
Improvement
-
Status: Closed
-
Major - P3
-
Resolution: Duplicate
-
None
-
None
-
None
-
Storage Execution
Description
Creating or dropping an index raises the collection's minimum visible snapshot. This causes a getMore on a snapshot cursor to return a SnapshotUnavailable error response, even if it wouldn't use that index. Longer-running snapshot reads would be more useful if their query plan wasn't impacted by the change to the collection's minimum visible snapshot.
const rst = new ReplSetTest({nodes: 1}); |
rst.startSet();
|
rst.initiate();
|
|
const db = rst.getPrimary().getDB("test"); |
assert.commandWorked(db.mycoll.insert(Array.from({length: 5}, (_, i) => ({_id: i}))));
|
const cursor = db.mycoll.find().readConcern("snapshot").batchSize(1); |
|
assert.eq({_id: 0}, cursor.next());
|
assert.eq({_id: 1}, cursor.next());
|
assert.commandWorked(db.mycoll.createIndex({a: 1}));
|
// HERE: The getMore command fails with SnapshotUnavailable due to the collection's minimum visible
|
// snapshot being bumped from creating the {a: 1} index.
|
assert.eq({_id: 2}, cursor.next());
|
|
rst.stopSet();
|
Attachments
Issue Links
- duplicates
-
SERVER-47866 Secondary readers do not need to reacquire PBWM lock if there are catalog conflicts
-
- Closed
-
- related to
-
SERVER-47866 Secondary readers do not need to reacquire PBWM lock if there are catalog conflicts
-
- Closed
-