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

cloneCollection implicitly takes out a G_X lock

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.7, 2.8.0-rc0
    • Component/s: Concurrency
    • Storage Execution
    • ALL

      Problem

      The cloneCollection command calls the copyCollection method on the Cloner class

      https://github.com/mongodb/mongo/blob/master/src/mongo/db/commands/clone_collection.cpp#L143

      Cloner cloner;
      ...
      return cloner.copyCollection(txn, collection, query, errmsg, true, false, copyIndexes);
      

      The Cloner class does the following

      https://github.com/mongodb/mongo/blob/master/src/mongo/db/cloner.cpp#L113

                  // XXX: can probably take dblock instead
                  Lock::GlobalWrite lk(txn->lockState());
      

      Solution

      cloneCollection (since the source is a different server) probably only needs to take out a DB_X on the local (i.e. destination) server. However, all usages of should be checked in case the lock type has to be determined by the caller function (in this case cloneCollection)

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            alvin Alvin Richards (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: