[CSHARP-1361] DropDatabaseAsync doesn't drop database Created: 10/Aug/15  Updated: 11/Aug/15  Resolved: 11/Aug/15

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 2.0.1
Fix Version/s: None

Type: Bug Priority: Blocker - P1
Reporter: Oliver Janik Assignee: Robert Stam
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File Program.cs    

 Description   

This command:

client.DropDatabaseAsync(dbName).Wait()

Doesn't drop the database. I can drop it from the shell just fine.

The following works just fine:

var command = new BsonDocument
{
    {"dropDatabase", 1},
};
db.RunCommandAsync<BsonDocument>(command).Wait();

This leads me to believe there's problem with the DropDatabaseAsync method.



 Comments   
Comment by Robert Stam [ 11/Aug/15 ]

OK. Thanks for letting us know.

Comment by Oliver Janik [ 11/Aug/15 ]

My bad. It appears I had a data problem in step 2) that was causing all the issues. This no longer happens for me. Please Close the issue.

Comment by Oliver Janik [ 11/Aug/15 ]

Ah, that's a valuable information, that wasn't apparent. How do I wait for the drop operation to complete?

And yes you're right I've been doing more testing today and it's definitely a race condition. The sequence is as follows:

1) Drop the database
2) Recreate the database and start inserting data

I was getting conflict issue and duplicated keys in step 2.

Comment by Robert Stam [ 10/Aug/15 ]

One additional piece of information: the dropDatabase command can sometimes take a long time to execute on the server, so the database might not get dropped immediately.

Comment by Robert Stam [ 10/Aug/15 ]

I am unable to reproduce this.

See the attached Program.cs file for the code I used to verify that DropDatabaseAsync is working.

What leads you to believe that the database is not being dropped? Can you provide source code to reproduce with?

Thanks.

Generated at Wed Feb 07 21:39:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.