Implement truncate() for non-capped MMAPv1 collections

XMLWordPrintableJSON

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

      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 Stearn
            Reporter:
            Kamran K. (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: