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

cloneCollection implicitly takes out a G_X lock

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 2.2.7, 2.8.0-rc0
    • Concurrency
    • Storage Execution
    • ALL

    Description

      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)

      Attachments

        Activity

          People

            backlog-server-execution Backlog - Storage Execution Team
            alvin Alvin Richards (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: