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

checkDBHashesForReplSet is not robust to missing collections

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.0-rc0, 4.7.0
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • v4.4
    • Repl 2020-04-06
    • 0

      I might not have chased this bug fully[1] but what I've observed is the following:

      When checking dbhashes across replica set nodes, a collection that's on the primary, but missing on a secondary will proceed to compare collStats for the missing collection. A collstats for a missing collection:

      test> db.server848.stats()
      {
      	"ns" : "test.server848",
      	"size" : 0,
      	"count" : 0,
      	"storageSize" : 0,
      	"totalSize" : 0,
      	"nindexes" : 0,
      	"totalIndexSize" : 0,
      	"indexSizes" : {
      		
      	},
      	"scaleFactor" : 1,
      	"ok" : 1
      }
      

      First observation of note is that calling collStats on a missing collection returns ok: 1 avoiding the early return.

      Second, the indexBuilds field is (javascript) undefined.

      If the primary's indexBuilds is undefined (leftArr), the code is robust.

      If the secondary's indexBuilds is undefined (rightArr), a type error is hit.

      [1] It's not obvious to me whether something changed in how collStats responds, or if this was always a failure waiting to happen.

            Assignee:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Reporter:
            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: