Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-17250

logOp rollback when legacy insert creates a namespace and then fails to insert the document (fatal assertion)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 3.1.0
    • Affects Version/s: 3.0.0-rc8
    • Component/s: Write Ops
    • Fully Compatible
    • ALL

      db/instance.cpp, checkAndInsert() has this code:

      877    WriteUnitOfWork wunit(txn);
      878    Collection* collection = ctx.db()->getCollection( ns );
      879    if ( !collection ) {
      880        collection = ctx.db()->createCollection( txn, ns );
      881        verify( collection );
      882        repl::logOp(txn,
      883                    "c",
      884                    (ctx.db()->name() + ".$cmd").c_str(),
      885                    BSON("create" << nsToCollectionSubstring(ns)));
      886    }
      887
      888    StatusWith<RecordId> status = collection->insertDocument( txn, js, true );
      889    uassertStatusOK( status.getStatus() );
      890    repl::logOp(txn, "i", ns, js);
      891    wunit.commit();
      

      If the uassertStatusOK() call on 889 throws after creating a collection, then the server will abort with an fassert: 'Rollback of logOp not currently allowed'

      Rollback of logOp not currently allowed (SERVER-15192)
      Fatal Assertion 18805
      
      #0  0x00007ffff7bcc20b in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
      #1  0x00000000018d53ce in mongo::breakpoint () at src/mongo/util/debugger.cpp:63
      #2  0x00000000018ca463 in mongo::fassertFailed (msgid=18805) at src/mongo/util/assert_util.cpp:165
      #3  0x00000000015f6f54 in mongo::repl::RollbackPreventer::rollback (this=0x30cc428) at src/mongo/db/repl/oplog.cpp:389
      #4  0x00000000017005b8 in mongo::DurRecoveryUnit::rollbackInnermostChanges (this=0x32ce340) at src/mongo/db/storage/mmap_v1/dur_recovery_unit.cpp:174
      #5  0x00000000016ffcc6 in mongo::DurRecoveryUnit::endUnitOfWork (this=0x32ce340) at src/mongo/db/storage/mmap_v1/dur_recovery_unit.cpp:78
      #6  0x0000000001141854 in mongo::WriteUnitOfWork::~WriteUnitOfWork (this=0x7ffff7fcc1a0, __in_chrg=<optimized out>) at src/mongo/db/operation_context.h:156
      #7  0x000000000144d9a6 in mongo::checkAndInsert (txn=0x7ffff7fcc7d0, ctx=..., ns=0x4d82814 "test.logop_rollback", js=...) at src/mongo/db/instance.cpp:892
      #8  0x000000000144eff3 in mongo::receivedInsert (txn=0x7ffff7fcc7d0, m=..., op=...) at src/mongo/db/instance.cpp:1078
      #9  0x000000000144a341 in mongo::assembleResponse (txn=0x7ffff7fcc7d0, m=..., dbresponse=..., remote=..., fromDBDirectClient=false) at src/mongo/db/instance.cpp:460
      #10 0x0000000001142274 in mongo::MyMessageHandler::process (this=0x30cc1c8, m=..., port=0x30f2580, le=0x34102d0) at src/mongo/db/db.cpp:206
      #11 0x00000000018f34d4 in mongo::PortMessageServer::handleIncomingMsg (arg=0x30f2580) at src/mongo/util/net/message_server_port.cpp:229
      #12 0x00007ffff7bc4182 in start_thread (arg=0x7ffff7fcd700) at pthread_create.c:312
      #13 0x00007ffff6cc500d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

            Assignee:
            daniel.alabi@10gen.com Daniel Alabi
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: