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

Secondary oplog can have entry to create a same name but different capitalized database before dropping the old one

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3.1, 4.2.2
    • Component/s: Catalog
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.2
    • Steps To Reproduce:
      Hide

      resmoke --suites=replica_sets test.js

      (function() {
          'use strict';
       
          load("jstests/libs/check_log.js");
       
          const rst = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0}}]});
          rst.startSet();
          rst.initiate();
       
          const dbNameUpper = "A";
          const dbNameLower = "a";
       
          const primary = rst.getPrimary();
       
          let upperDB = primary.getDB(dbNameUpper);
          assert.commandWorked(upperDB.createCollection("test"));
       
          assert.commandWorked(
              upperDB.adminCommand({configureFailPoint: 'dropDatabaseHangBeforeLog', mode: "alwaysOn"}));
          let awaitDropUpper = startParallelShell(() => {
              db.getSiblingDB("A").dropDatabase();
          }, primary.port);
       
          checkLog.contains(primary, "dropDatabase - fail point dropDatabaseHangBeforeLog enabled.");
       
          let lowerDB = primary.getDB(dbNameLower);
          assert.commandWorked(lowerDB.createCollection("test"));
       
          rst.awaitReplication();
       
       
          assert.commandWorked(
              lowerDB.adminCommand({configureFailPoint: 'dropDatabaseHangBeforeLog', mode: "alwaysOn"}));
          awaitDropUpper();
       
          rst.stopSet();
      })();
      

      Show
      resmoke --suites=replica_sets test.js (function() { 'use strict' ;   load( "jstests/libs/check_log.js" );   const rst = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0 }}]}); rst.startSet(); rst.initiate();   const dbNameUpper = "A" ; const dbNameLower = "a" ;   const primary = rst.getPrimary();   let upperDB = primary.getDB(dbNameUpper); assert .commandWorked(upperDB.createCollection( "test" ));   assert .commandWorked( upperDB.adminCommand({configureFailPoint: 'dropDatabaseHangBeforeLog' , mode: "alwaysOn" })); let awaitDropUpper = startParallelShell(() => { db.getSiblingDB( "A" ).dropDatabase(); }, primary.port);   checkLog.contains(primary, "dropDatabase - fail point dropDatabaseHangBeforeLog enabled." );   let lowerDB = primary.getDB(dbNameLower); assert .commandWorked(lowerDB.createCollection( "test" ));   rst.awaitReplication();     assert .commandWorked( lowerDB.adminCommand({configureFailPoint: 'dropDatabaseHangBeforeLog' , mode: "alwaysOn" })); awaitDropUpper();   rst.stopSet(); })();
    • Sprint:
      Execution Team 2019-10-07
    • Linked BF Score:
      10

      Description

      This started occurring in our testing when the exclusive global locks were removed in dropDatabase() here.

      The secondaries oplog can have oplog entries to create the same name but differently capitalized database name prior to running the oplog entry to drop the older database.

      In this code, there's a small window between the dropDb() call and creating the oplog entry for secondaries where a create database command on the same name but different capitalization can occur causing the createDb oplog entry to get sent to secondaries before the dropDb oplog entry. The secondary will try to create the database, but will fassert because another database with the same name but different capitalization still exists.

        Attachments

          Activity

            People

            Assignee:
            gregory.wlodarek Gregory Wlodarek
            Reporter:
            gregory.wlodarek Gregory Wlodarek
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: