Details
-
Improvement
-
Resolution: Won't Fix
-
Major - P3
-
None
-
None
-
None
-
Query
Description
There is no test which runs killCursors with stepdowns.
We should either
1) Modify the core/kill_cursors.js to work when there are stepdowns. After SERVER-21710 it will no longer need the requires_getmore tag, which currently prevents it from running under retryable_writes_jscore_stepdown_passthrough. Below is a description of why even without using getMore, we currently can't run core/killCursors.js with stepdowns.
2) Add another test which specifically runs killCursors after a stepdown.
Here is why we cannot run the current core/killCursors.js test with stepdowns:
There is some code like the following:
// Test killing a noTimeout cursor.
|
cmdRes = db.runCommand({find: coll.getName(), batchSize: 2, noCursorTimeout: true});
|
assert.commandWorked(cmdRes);
|
cursorId = cmdRes.cursor.id;
|
assert.neq(cursorId, NumberLong(0));
|
|
|
// <Here>
|
|
|
cmdRes = db.runCommand({killCursors: coll.getName(), cursors: [NumberLong(123), cursorId]});
|
assert.commandWorked(cmdRes);
|
assert.eq(cmdRes.cursorsKilled, [cursorId]);
|
assert.eq(cmdRes.cursorsNotFound, [NumberLong(123)]);
|
assert.eq(cmdRes.cursorsAlive, []);
|
assert.eq(cmdRes.cursorsUnknown, []);
|
If a stepdown happens in the location marked <Here> and the killCursors command is run on the new primary, the command will respond with "cursorsNotFound" for both cursor IDs.
You can easily reproduce this by adding a sleep where I marked <Here> and then run the relevant code in a while (1) loop.
To fix this, we could have the test run killCursors against the same node which it ran find() on using the _mongo field in a command response.