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

Race between setting profiling level on a secondary and apply drop/create of database

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Labels:
      None
    • Query
    • ALL
    • Hide
      (function() {
          load("jstests/libs/write_concern_util.js");
      
          let rst = new ReplSetTest({nodes: [{rsConfig: {votes: 1}}, {rsConfig: {priority: 0, votes: 0}}]});
          rst.startSet();
          rst.initiate();
      
          // Create "test" database.
          assert.writeOK(rst.getPrimary().getDB("test").coll.insert({_id: 0}));
      
          // Stop replication on the secondary.
          stopServerReplication(rst.getSecondary());
      
          // Drop and recreate the database.
          assert.commandWorked(rst.getPrimary().getDB("test").runCommand({dropDatabase: 1}));
          assert.writeOK(rst.getPrimary().getDB("test").coll.insert({_id: 0}));
      
          // Set the profiling level on the secondary. This succeeds.
          assert.commandWorked(rst.getSecondary().getDB("test").setProfilingLevel(1));
          assert.eq(1, rst.getSecondary().getDB("test").getProfilingLevel());
      
          // Restart replication on the secondary.
          restartServerReplication(rst.getSecondary());
          rst.awaitReplication();
      
          // Profiling is turned off on the secondary.
          assert.eq(0, rst.getSecondary().getDB("test").getProfilingLevel());
      
          rst.stopSet();
      })();
      
      Show
      (function() { load( "jstests/libs/write_concern_util.js" ); let rst = new ReplSetTest({nodes: [{rsConfig: {votes: 1}}, {rsConfig: {priority: 0, votes: 0}}]}); rst.startSet(); rst.initiate(); // Create "test" database. assert .writeOK(rst.getPrimary().getDB( "test" ).coll.insert({_id: 0})); // Stop replication on the secondary. stopServerReplication(rst.getSecondary()); // Drop and recreate the database. assert .commandWorked(rst.getPrimary().getDB( "test" ).runCommand({dropDatabase: 1})); assert .writeOK(rst.getPrimary().getDB( "test" ).coll.insert({_id: 0})); // Set the profiling level on the secondary. This succeeds. assert .commandWorked(rst.getSecondary().getDB( "test" ).setProfilingLevel(1)); assert .eq(1, rst.getSecondary().getDB( "test" ).getProfilingLevel()); // Restart replication on the secondary. restartServerReplication(rst.getSecondary()); rst.awaitReplication(); // Profiling is turned off on the secondary. assert .eq(0, rst.getSecondary().getDB( "test" ).getProfilingLevel()); rst.stopSet(); })();

      When a database is dropped and recreated, then profiling is turned on on a secondary, but the secondary replicates the drop/create after profiling is turned on, then the result is that profiling is off. From the client's perspective, the drop/create happened before turning on profiling on the secondary, so they would expect profiling to be on on the secondary.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: