2 / 2
Mar 5

Hello,

I’m facing an issue while trying to restore data after upgrading MongoDB from version 4.4.29 to 8.0.3. Here’s a brief overview of what happened:

Steps Taken:

  1. I had MongoDB 4.4.29 installed on my centos 8 server.
  2. Before upgrading, I tried taking a dump of my data using the mongodump command. However, only the admin collection was dumped, and not the entire data.
  3. After this, I proceeded with upgrading MongoDB to version 8.0.3.
  4. Now, I currently have two MongoDB instances running:
    • MongoDB 4.4.29 (for the old data)
    • MongoDB 8.0.3 (new version)

The Issue:
When trying to restore the data from the directory containing the old MongoDB data (version 4.4.29), I’m encountering the following error:

Error Message:

{"t":{"$date":"2025-02-21T05:20:40.295+00:00"},"s":"I", "c":"STORAGE", "id":21029, "ctx":"initandlisten","msg":"repairDatabase","attr":{"db":"admin"}} {"t":{"$date":"2025-02-21T05:20:40.295+00:00"},"s":"F", "c":"-", "id":23081, "ctx":"initandlisten","msg":"Invariant failure","attr":{"expr":"buildUUID","msg":"collection: admin.system.versionindex:_id_","file":"src/mongo/db/catalog/index_catalog_impl.cpp","line":133}} {"t":{"$date":"2025-02-21T05:20:40.295+00:00"},"s":"F", "c":"-", "id":23082, "ctx":"initandlisten","msg":"\n\n***aborting after invariant() failure\n\n"} {"t":{"$date":"2025-02-21T05:20:40.295+00:00"},"s":"F", "c":"CONTROL", "id":4757800, "ctx":"initandlisten","msg":"Writing fatal message","attr":{"message":"Got signal: 6 (Aborted).\n"}} {"t":{"$date":"2025-02-21T05:20:40.354+00:00"},"s":"I", "c":"CONTROL", "id":31431, "ctx":"initandlisten","msg":"BACKTRACE: {bt}","attr":{"bt":{"backtrace":[{"a":"56464229FC8A","b":"56463F48B000","o":"2E14C8A","s":"_ZN5mongo18stack_trace_detail12_GLOBAL__N_119printStackTraceImplERKNS1_7OptionsEPNS_14StackTraceSinkE.constprop.606","s+":"1EA"},{"a":"5646422A1719","b":"56463F48B000","o":"2E16719","s":"_ZN5mongo15printStackTraceEv","s+":"29"},{"a":"56464229EAA6","b":"56463F48B000","o":"2E13AA6","s":"_ZN5mongo12_GLOBAL__N_116abruptQuitActionEiP9siginfo_tPv","s+":"66"},{"a":"7F1D7A5B7C20","b":"7F1D7A5A5000","o":"12C20","s":"funlockfile","s+":"50"},{"a":"7F1D7A21737F","b":"7F1D7A1E0000","o":"3737F","s":"gsignal","s+":"10F"},{"a":"7F1D7A201DB5","b":"7F1D7A1E0000","o":"21DB5","s":"abort","s+":"127"},{"a":"5646403D4DBE","b":"56463F48B000","o":"F49DBE","s":"_ZN5mongo22invariantFailedWithMsgEPKcRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES1_j","s+":"153"},{"a":"5646401D9B05","b":"56463F48B000","o":"D4EB05","s":"_ZN5mongo16IndexCatalogImpl4initEPNS_16OperationContextE.cold.1307","s+":"1B"},{"a":"564640DA3CB8","b":"56463F48B000","o":"1918CB8","s":"_ZN5mongo14CollectionImpl4initEPNS_16OperationContextE","s+":"328"},{"a":"564640DADBE6","b":"56463F48B000","o":"1922BE6","s":"_ZNK5mongo12DatabaseImpl4initEPNS_16OperationContextE","s+":"D6"},{"a":"564640DA90F8","b":"56463F48B000","o":"191E0F8","s":"_ZN5mongo18DatabaseHolderImpl6openDbEPNS_16OperationContextENS_10StringDataEPb","s+":"308"},{"a":"564640909EBE","b":"56463F48B000","o":"147EEBE","s":"_ZN5mongo14repairDatabaseEPNS_16OperationContextEPNS_13StorageEngineERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE","s+":"26E"},{"a":"564640904C2E","b":"56463F48B000","o":"1479C2E","s":"_ZN5mongo30repairDatabasesAndCheckVersionEPNS_16OperationContextE","s+":"34E"},{"a":"564640471FF7","b":"56463F48B000","o":"FE6FF7","s":"_ZN5mongo12_GLOBAL__N_114_initAndListenEPNS_14ServiceContextEi.isra.1587","s+":"817"},{"a":"564640475EF2","b":"56463F48B000","o":"FEAEF2","s":"_ZN5mongo12_GLOBAL__N_111mongoDbMainEiPPc","s+":"A52"},{"a":"5646403E49F9","b":"56463F48B000","o":"F599F9","s":"main","s+":"9"},{"a":"7F1D7A203493","b":"7F1D7A1E0000","o":"23493","s":"__libc_start_main","s+":"F3"},{"a":"56464047100E","b":"56463F48B000","o":"FE600E","s":"_start","s+":"2E"}],"processInfo":{"mongodbVersion":"4.4.29","gitVersion":"f4dda329a99811c707eb06d05ad023599f9be263","compiledModules":[],"uname":{"sysname":"Linux","release":"4.18.0-348.7.1.el8_5.x86_64","version":"#1 SMP Wed Dec 22 13:25:12 UTC 2021","machine":"x86_64"},"somap":[{"b":"56463F48B000","elfType":3,"buildId":"4A7AD6968917F8CE8ABBAAE37FA79443DEAABE14"},{"b":"7F1D7A5A5000","path":"/lib64/libpthread.so.0","elfType":3,"buildId":"7A60D9380CC2284FE162F9900B28F4DBDB7029FD"},{"b":"7F1D7A1E0000","path":"/lib64/libc.so.6","elfType":3,"buildId":"ACEB5A6A8E8000A295B4024B2754D117433411EF"}]}}}}

What I’ve Tried:

  • I’ve tried restoring the data using the mongorestore command, but the same error keeps appearing.
  • I’ve also tried using the --repair flag, but that did not work either.

Questions:

  1. Is there any known issue with restoring data from MongoDB 4.4.29 to 8.0.3?
  2. What steps can I take to resolve the Invariant failure error and restore my data successfully?
  3. Would it be better to try a different method for upgrading or restoring the dump?

Any help or advice would be appreciated. Thank you in advance!

Please follow the upgrade path of mongodb. There is something wrong with the kua version upgrade, which is explained in the document.