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

scan_checked_replset.js attempts to incorrectly scan on truncated collection name

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL

      Currently, scan_checked_replset.js parses namespaces from documents by splitting the namespace on a period ".".

      let [dbName, collName] = doc.namespace.split('.', 2);
      

      This is problematic for collections that contain periods in the collection name, e.g:

      admin.system.users
      config.system.sessions
      

      This leads to the script attempting to scan on partial namespaces:

      {
      	"msg" : "Scanning range",
      	"range" : {
      		"_id" : {
      			"db" : "admin",
      			"collection" : "system",
      			"minKey" : { "$minKey" : 1 },
      			"maxKey" : { "$maxKey" : 1 }
      		}
      	}
      }
      {
      	"msg" : "Scanning range",
      	"range" : {
      		"_id" : {
      			"db" : "config",
      			"collection" : "system",
      			"minKey" : { "$minKey" : 1 },
      			"maxKey" : { "$maxKey" : 1 }
      		}
      	}
      }
      

      We can fix this by ensuring that the full collection name is not split against by slicing on the first occurrence of a "."

      let i = doc.namespace.indexOf(".")
      let [dbName, collName] = [doc.namespace.slice(0,i), doc.namespace.slice(i+1)];
      

            Assignee:
            eric.sedor@mongodb.com Eric Sedor
            Reporter:
            edwin.zhou@mongodb.com Edwin Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: