Skip to content

IndexBuildsCoordinator error when trying to drop db #585

@Heinan-Phau

Description

@Heinan-Phau

Hello all,

I am using mongo image 4.4.18.
when I run my UTs (I use mocha) in the clean step of my tests I use dropDatabase on each of my connections.
this results in this failure MongoServerError: cannot perform operation: a background operation is currently running for database dbName
after some searching, it seems that the reason is that, at this time, mongo has this op IndexBuildsCoordinator which, to my understanding, means that it tries to index some collection while I try to drop the DB, and it causes the error.

however, from mongo 4.4 docs, I see this:

Starting in MongoDB 4.4, the [db.dropDatabase()](https://www.mongodb.com/docs/v4.4/reference/method/db.dropDatabase/#mongodb-method-db.dropDatabase) method and 
[dropDatabase](https://www.mongodb.com/docs/v4.4/reference/command/dropDatabase/#mongodb-dbcommand-dbcmd.dropDatabase)
 command abort any in-progress index builds on collections in the target database before dropping the database.   
Aborting an index build has the same effect as dropping the built index. Prior to MongoDB 4.4, attempting to drop a database that contains a collection with an in-progress index build results in an error, and the database is not dropped.

so as I understand, my case should not happen in image 4.4.18 since it was fixed from version 4.2.
can anyone help to clarify the issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions