Exception com.mongodb.MongoCommandException: Command failed with error 26 (NamespaceNotFound) thrown sometimes.
Vladcorjuc opened this issue · comments
Description
We noticed that our spring-boot microservices wich are using mongock will throw the following exception: com.mongodb.MongoCommandException: Command failed with error 26 (NamespaceNotFound): 'ns does not exist: {DATABASE_NAME}.mongockChangeLog' where {DATABASE_NAME} is our database name.
This does not happen frequently, we suspect that a connection reset occurred.
PRIORITY
NORMAL
Version and environment
Mongock
- Mongock version: 5
- Modules involved: "io.mongock:mongock:5.4.0", "io.mongock:mongock-springboot:5.4.0", "io.mongock:mongock-bom:5.4.0", "io.mongock:mongodb-springdata-v4-driver:5.4.0"
- How Mongock is used: we use the builder approach with a SpringDataMongoV4Driver driver and a defaultLock
Environment
- Framework and libraries versions. Especially those that affect directly to Mongock: Spring boot 3.2.4, MongoDb Atlas with MongoDb at version 6.0
- Infrastructure: Our app is running in a Kubernetes environment
Steps to Reproduce
Steps to reproduce are unknown since this happens rarely.
Behaviour
Expected behavior:
No error should be thrown and migration should work as expected.
Actual behavior:
An error is thrown : com.mongodb.MongoCommandException: Command failed with error 26 (NamespaceNotFound): 'ns does not exist: {DATABASE_NAME}.mongockChangeLog' on server {MONGODB_SERVER}. The full response is {"ok": 0.0, "errmsg": "ns does not exist: {DATABASE_NAME}.mongockChangeLog", "code": 26, "codeName": "NamespaceNotFound", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1710957686, "i": 3}}, "signature": {"hash": {"$binary": {"base64": "QNKnOK7Nmvqb8rrHKD4EZUP8s9A=", "subType": "00"}}, "keyId": 7292061381421957121}}, "operationTime": {"$timestamp": {"t": 1710957686, "i": 3}}}
How often the bug happens: 4%
Link to repository using Mongock
Not Available
Hello @Vladcorjuc , we couldn't reproduce this error. It should be caused by something specific to your configuration, environment o even MongoDb Atlas. Could you share any additional detail about your configuration that can be useful to understand the origin of it?