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

Avoid reloading the view catalog on the primary and secondaries during the dbhash check



    • Fully Compatible
    • v4.2, v4.0, v3.6
    • STM 2019-08-12, STM 2019-08-26
    • 20
    • 2


      The changes from SERVER-25640 made it so the listCollections command is run with a $in query containing the names of the collections returned by the dbHash command.

      The query leads to the view catalog being reloaded because a very special filter must be used to prevent that behavior. There is logic in the checkDBHashesForReplSet() function that's only enabled for the fuzzer test suites to skip checking the dbhash when reloading the view catalog fails due to an invalid view definition; however, it seems more worthwhile to avoid reloading the view catalog as we've found that an InvalidNamespace error response may be returned for certain patterns involving null bytes.

      We should instead use the very special filter to prevent the view catalog from being reloaded on the server during the listCollections command and do the actual filtering on the client-side.

      // Don't run validate on view namespaces.
      let filter = {type: 'collection'};
      if (jsTest.options().skipValidationOnInvalidViewDefinitions) {
          // If skipValidationOnInvalidViewDefinitions=true, then we avoid resolving the view
          // catalog on the admin database.
          // TODO SERVER-25493: Remove the $exists clause once performing an initial sync from
          // versions of MongoDB <= 3.2 is no longer supported.
          filter = {$or: [filter, {type: {$exists: false}}]};




            robert.guo@mongodb.com Robert Guo (Inactive)
            max.hirschhorn@mongodb.com Max Hirschhorn
            0 Vote for this issue
            6 Start watching this issue