raghavj
raghavj

Reputation: 63

MongoDB crashing due to missing collection*.wt file

Similar threads are present on SO and other forums, however my issue seems to be different in that I can start mongod and read from it successfully. When running the command 'show dbs' in the mongosh terminal, it returns an error saying:

MongoServerError: unable to open cursor at URI statistics:table:collection-124-8620454490016200065. reason: No such file or directory

Also, when trying to write large amount of data to the db it the mongod service itself crashes due to missing .wt files. The mongod.log file says:

{"t":{"$date":"2022-02-28T12:11:51.031+05:30"},"s":"E",  "c":"STORAGE",  "id":22435,   "ctx":"conn26124","msg":"WiredTiger error","attr":{"error":2,"message":"[1646030511:31871][2824:0x7f3c0e85e700], file:collection-102-8620454490016200065.wt, WT_SESSION.open_cursor: __posix_open_file, 805: /var/lib/mongo/collection-102-8620454490016200065.wt: handle-open: open: No such file or directory"}}
{"t":{"$date":"2022-02-28T12:11:51.036+05:30"},"s":"F",  "c":"STORAGE",  "id":50883,   "ctx":"conn26124","msg":"Cursor not found","attr":{"error":{"code":43,"codeName":"CursorNotFound","errmsg":"Failed to open a WiredTiger cursor. Reason: UnknownError: 2: No such file or directory, uri: table:collection-102-8620454490016200065, config: "}}}
{"t":{"$date":"2022-02-28T12:11:51.037+05:30"},"s":"F",  "c":"-",        "id":23091,   "ctx":"conn26124","msg":"Fatal assertion","attr":{"msgid":50883,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_cursor.cpp","line":72}}
{"t":{"$date":"2022-02-28T12:11:51.037+05:30"},"s":"F",  "c":"-",        "id":23092,   "ctx":"conn26124","msg":"\n\n***aborting after fassert() failure\n\n"}

I assume one collection is missing from the db. I have no means to verify this. Data loss for any corrupted data is not an issue. Just need to get the db working again.

Update: as suggested in the comments, mongod --dbpath /data/db --repair worked as expected. Although it seems some collections were lost from one of the dbs. Good reminder for backups!

Upvotes: 1

Views: 1282

Answers (0)

Related Questions