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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1, 4.2.2
    • Affects Version/s: None
    • Component/s: Catalog
    • None
    • Fully Compatible
    • ALL
    • v4.2
    • 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(); })();
    • Execution Team 2019-10-07
    • 10

      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.

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

              Created:
              Updated:
              Resolved: