[SERVER-32024] Race between setting profiling level on a secondary and apply drop/create of database Created: 17/Nov/17  Updated: 06/Dec/22  Resolved: 01/Dec/17

Status: Closed
Project: Core Server
Component/s: Diagnostics, Querying, Replication
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Tess Avitabile (Inactive) Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-32025 Ensure database drop/recreate is repl... Closed
Assigned Teams:
Query
Operating System: ALL
Steps To Reproduce:

(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();
})();

Participants:

 Description   

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.



 Comments   
Comment by Tess Avitabile (Inactive) [ 17/Nov/17 ]

We could also just await the replication of the dropDatabase. But I am arguing that this is a bug in the server, not in the test.

Comment by Esha Maharishi (Inactive) [ 17/Nov/17 ]

I wonder if we just need to fix our tests that expect this behavior to use afterClusterTime?

Generated at Thu Feb 08 04:28:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.