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

Implement truncate() for non-capped MMAPv1 collections

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7.8
    • Affects Version/s: 2.7.5
    • Component/s: Storage
    • Labels:
    • Fully Compatible

      Original title: The emptycapped command fails to restore indexes for non-capped collections

      In 2.7.0+, the emptycapped command fails to restore indexes for non-capped collections because truncate() is not implemented in SimpleRecordStoreV1. The command is also not replicated, which leads to inconsistent indexes across the primary and secondaries.

      test_commands.cpp:

      203    std::vector<BSONObj> indexes = stopIndexBuilds(txn, db, cmdObj);
      204
      205    Status status = collection->truncate(txn);
      206    if ( !status.isOK() )
      207        return appendCommandStatus( result, status );
      208
      209    IndexBuilder::restoreIndexes(indexes);
      210
      211    if (!fromRepl)
      212        repl::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj);
      

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: