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

Only start a background thread for the active oplog in WT

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.1.7
    • Component/s: Storage
    • None
    • QuInt A (10/12/15)
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      WiredTigerKVEngine::initRsOplogBackgroundThread() starts a background thread for any namespace that starts with "local.oplog."

      // static
      bool WiredTigerKVEngine::initRsOplogBackgroundThread(StringData ns) {
          if (!NamespaceString::oplog(ns)) {
              return false;
          }
      
          if (storageGlobalParams.repair) {
              LOG(1) << "not starting WiredTigerRecordStoreThread for " << ns
                     << " because we are in repair";
              return false;
          }
      
          stdx::lock_guard<stdx::mutex> lock(_backgroundThreadMutex);
          NamespaceString nss(ns);
          if (_backgroundThreadNamespaces.count(nss)) {
              log() << "WiredTigerRecordStoreThread " << ns << " already started";
          } else {
              log() << "Starting WiredTigerRecordStoreThread " << ns;
              BackgroundJob* backgroundThread = new WiredTigerRecordStoreThread(nss);
              backgroundThread->go();
              _backgroundThreadNamespaces.insert(nss);
          }
          return true;
      }
      

      Instead, it should only start a background thread for the oplog that will be inserted into when logOp() is called. A background thread should not be started if replication isn't enabled.

      This allows users to do updates that change the size of a document on a non-active oplog after SERVER-19551.

            Assignee:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: