[SERVER-34772] Read concern snapshot should prohibit queries with tailable option Created: 01/May/18  Updated: 29/Oct/23  Resolved: 08/May/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.7.9
Fix Version/s: 4.0.0

Type: Bug Priority: Major - P3
Reporter: Robert Guo (Inactive) Assignee: Ian Boros
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-33738 Create a runCommand() override method... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var r = new ReplSetTest({nodes:2});
r.startSet();
r.initiate();
 
var dbName = 'test';
var collName = 'tailable-cursor-repro';
 
const sessionOptions = {causalConsistency: false};
const session = r.getPrimary().startSession(sessionOptions);
const sessionDb = session.getDatabase(dbName);
const sessionColl = sessionDb.getCollection(collName);
 
assert.commandWorked(sessionDb.runCommand({create: collName, writeConcern: {w: "majority"}, capped: true, size:2048}));
 
session.startTransaction();
sessionColl.insert({x:1});
var cmdRes = sessionDb.runCommand({find: collName, batchSize: 2, awaitData: true, tailable: true});
cmdRes = sessionDb.runCommand({getMore: cmdRes.cursor.id, collection: collName});
 
// session.commitTransaction();

Sprint: Query 2018-05-07, Query 2018-05-21
Participants:

 Description   

Stacktrace:

 2018-05-01T13:06:22.333-0400 F -        [conn1] Invariant failure _yieldPolicy->canReleaseLocksDuringExecution() src/mongo/db/query/plan_executor.cpp 429
 2018-05-01T13:06:22.333-0400 F -        [conn1] 
 
 ***aborting after invariant() failure
 
 mongo::invariantFailed(char const*, char const*, unsigned int)
 mongo::PlanExecutor::shouldWaitForInserts()
 mongo::PlanExecutor::getNextImpl(mongo::Snapshotted<mongo::BSONObj>*, mongo::RecordId*)
 mongo::PlanExecutor::getNext(mongo::BSONObj*, mongo::RecordId*)
 mongo::(anonymous namespace)::GetMoreCmd::runParsed(mongo::OperationContext*, mongo::NamespaceString const&, mongo::GetMoreRequest const&, mongo::BSONObj const&, mongo::BSONObjBuilder&)
 mongo::(anonymous namespace)::GetMoreCmd::run(mongo::OperationContext*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, mongo::BSONObj const&, mongo::BSONObjBuilder&)
 mongo::BasicCommand::Invocation::run(mongo::OperationContext*, mongo::CommandReplyBuilder*)
 mongo::(anonymous namespace)::invokeInTransaction(mongo::OperationContext*, mongo::CommandInvocation*, mongo::CommandReplyBuilder*)
 mongo::(anonymous namespace)::execCommandDatabase(mongo::OperationContext*, mongo::Command*, mongo::OpMsgRequest const&, mongo::rpc::ReplyBuilderInterface*, mongo::ServiceEntryPointCommon::Hooks const&)
 mongo::ServiceEntryPointCommon::handleRequest(mongo::OperationContext*, mongo::Message const&, mongo::ServiceEntryPointCommon::Hooks const&)
 mongo::ServiceEntryPointMongod::handleRequest(mongo::OperationContext*, mongo::Message const&)
 mongo::ServiceStateMachine::_processMessage(mongo::ServiceStateMachine::ThreadGuard)
 mongo::ServiceStateMachine::_runNextInGuard(mongo::ServiceStateMachine::ThreadGuard)
 std::__1::__function::__func<mongo::ServiceStateMachine::_scheduleNextWithGuard(mongo::ServiceStateMachine::ThreadGuard, mongo::transport::ServiceExecutor::ScheduleFlags, mongo::transport::ServiceExecutorTaskName, mongo::ServiceStateMachine::Ownership)::$_0, std::__1::allocator<mongo::ServiceStateMachine::_scheduleNextWithGuard(mongo::ServiceStateMachine::ThreadGuard, mongo::transport::ServiceExecutor::ScheduleFlags, mongo::transport::ServiceExecutorTaskName, mongo::ServiceStateMachine::Ownership)::$_0>, void ()>::operator()()
 mongo::transport::ServiceExecutorSynchronous::schedule(std::__1::function<void ()>, mongo::transport::ServiceExecutor::ScheduleFlags, mongo::transport::ServiceExecutorTaskName)
 mongo::ServiceStateMachine::_scheduleNextWithGuard(mongo::ServiceStateMachine::ThreadGuard, mongo::transport::ServiceExecutor::ScheduleFlags, mongo::transport::ServiceExecutorTaskName, mongo::ServiceStateMachine::Ownership)
 mongo::ServiceStateMachine::_sourceCallback(mongo::Status)
 mongo::ServiceStateMachine::_sourceMessage(mongo::ServiceStateMachine::ThreadGuard)
 mongo::ServiceStateMachine::_runNextInGuard(mongo::ServiceStateMachine::ThreadGuard)
 std::__1::__function::__func<mongo::ServiceStateMachine::_scheduleNextWithGuard(mongo::ServiceStateMachine::ThreadGuard, mongo::transport::ServiceExecutor::ScheduleFlags, mongo::transport::ServiceExecutorTaskName, mongo::ServiceStateMachine::Ownership)::$_0, std::__1::allocator<mongo::ServiceStateMachine::_scheduleNextWithGuard(mongo::ServiceStateMachine::ThreadGuard, mongo::transport::ServiceExecutor::ScheduleFlags, mongo::transport::ServiceExecutorTaskName, mongo::ServiceStateMachine::Ownership)::$_0>, void ()>::operator()()
 std::__1::__function::__func<mongo::transport::ServiceExecutorSynchronous::schedule(std::__1::function<void ()>, mongo::transport::ServiceExecutor::ScheduleFlags, mongo::transport::ServiceExecutorTaskName)::$_0, std::__1::allocator<mongo::transport::ServiceExecutorSynchronous::schedule(std::__1::function<void ()>, mongo::transport::ServiceExecutor::ScheduleFlags, mongo::transport::ServiceExecutorTaskName)::$_0>, void ()>::operator()()
 mongo::(anonymous namespace)::runFunc(void*)



 Comments   
Comment by Githook User [ 08/May/18 ]

Author:

{'email': 'ian.boros@10gen.com', 'name': 'Ian Boros'}

Message: SERVER-34772 ban creation of tailable cursors in transactions
Branch: master
https://github.com/mongodb/mongo/commit/86671cb48822051421ae8c66c99ea79722990263

Comment by David Storch [ 02/May/18 ]

ian.boros, assigning this fix to you given that you're a little low on work right now. james.wahlin or Eric should be able to help if you have any questions and should be able to review the patch.

Comment by Eric Milkie [ 01/May/18 ]

Tailable cursors with read concern snapshot should have been prohibited. We missed that check, I think.

Generated at Thu Feb 08 04:37:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.