MongoDB - 断言失败isOk()db / pdfile.h

时间:2011-11-02 10:59:39

标签: mongodb

我已经使用了mongodb几天,直到今天一直很好。

查询数据库时出错。

Wed Nov  2 17:56:44 [initandlisten] connection accepted from 127.0.0.1:49234 #1
Wed Nov  2 17:56:45 [conn1] command admin.$cmd command: { listDatabases: 1 } ntoreturn:1 reslen:338 813ms
Wed Nov  2 17:56:46 [conn1]  admin.system.namespaces Assertion failure isOk() db/pdfile.h 300
0x10007d703 0x100087eec 0x1004165e4 0x10040774b 0x100410823 0x100437df9 0x1004b3006 0x100426693 0x100426b53 0x100429f45 0x10042d8f0 0x10043109e 0x10043353b 0x10043662a 0x1004a13ca 0x1003d5e0f 0x1003e298a 0x100603394 0x100148d8c 0x10060a554 
 0   mongod                              0x000000010007d703 _ZN5mongo12sayDbContextEPKc + 195
 1   mongod                              0x0000000100087eec _ZN5mongo8assertedEPKcS1_j + 300
 2   mongod                              0x00000001004165e4 _ZN5mongo11DataFileMgr9getExtentERKNS_7DiskLocE + 148
 3   mongod                              0x000000010040774b _ZN5mongo11DataFileMgr7findAllEPKcRKNS_7DiskLocE + 75
 4   mongod                              0x0000000100410823 _ZN5mongo13findTableScanEPKcRKNS_7BSONObjERKNS_7DiskLocE + 131
 5   mongod                              0x0000000100437df9 _ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocEi + 1081
 6   mongod                              0x00000001004b3006 _ZN5mongo11UserQueryOp5_initEv + 214
 7   mongod                              0x0000000100426693 _ZN5mongo7QueryOp4initEv + 323
 8   mongod                              0x0000000100426b53 _ZN5mongo12QueryPlanSet6Runner6initOpERNS_7QueryOpE + 35
 9   mongod                              0x0000000100429f45 _ZN5mongo12QueryPlanSet6Runner4initEv + 245
 10  mongod                              0x000000010042d8f0 _ZN5mongo12QueryPlanSet6Runner22runUntilFirstCompletesEv + 32
 11  mongod                              0x000000010043109e _ZN5mongo12QueryPlanSet5runOpERNS_7QueryOpE + 334
 12  mongod                              0x000000010043353b _ZN5mongo16MultiPlanScanner9runOpOnceERNS_7QueryOpE + 1115
 13  mongod                              0x000000010043662a _ZN5mongo16MultiPlanScanner5runOpERNS_7QueryOpE + 26
 14  mongod                              0x00000001004a13ca _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 3194
 15  mongod                              0x00000001003d5e0f _ZN5mongo13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 623
 16  mongod                              0x00000001003e298a _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1402
 17  mongod                              0x0000000100603394 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 148
 18  mongod                              0x0000000100148d8c _ZN5mongo3pms9threadRunEPNS_13MessagingPortE + 700
 19  mongod                              0x000000010060a554 thread_proxy + 132
Wed Nov  2 17:56:46 [conn1] assertion 0 assertion db/pdfile.h:300 ns:admin.system.namespaces query:{}
Wed Nov  2 17:56:51 [conn1] end connection 127.0.0.1:49234

我重启mongod进程但没有帮助。

我试图修复数据库,但也得到了错误。

bin: $ ./mongod --repair --dbpath  ../data/db 
Wed Nov  2 18:10:51 [initandlisten] MongoDB starting : pid=678 port=27017 dbpath=../data/db 64-bit host=KTs-MacBook-Pro.local
Wed Nov  2 18:10:51 [initandlisten] db version v2.0.0, pdfile version 4.5
Wed Nov  2 18:10:51 [initandlisten] git version: 695c67dff0ffc361b8568a13366f027caa406222
Wed Nov  2 18:10:51 [initandlisten] build info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Wed Nov  2 18:10:51 [initandlisten] options: { dbpath: "../data/db", repair: true }
Wed Nov  2 18:10:51 [initandlisten] journal dir=../data/db/journal
Wed Nov  2 18:10:51 [initandlisten] recover : no journal files present, no recovery needed
Wed Nov  2 18:10:51 [initandlisten] ****
Wed Nov  2 18:10:51 [initandlisten] ****
Wed Nov  2 18:10:51 [initandlisten] need to upgrade database admin with pdfile version 4.5, new version: 4.5
Wed Nov  2 18:10:51 [initandlisten]      starting upgrade
Wed Nov  2 18:10:51 [initandlisten]  admin repairDatabase admin
Wed Nov  2 18:10:51 [initandlisten] removeJournalFiles
Wed Nov  2 18:10:51 [initandlisten]  admin.system.namespaces Assertion failure isOk() db/pdfile.h 300
0x10007d703 0x100087eec 0x1004165e4 0x10040774b 0x100410823 0x100437df9 0x1004b3006 0x100426693 0x100426b53 0x100429f45 0x10042d8f0 0x10043109e 0x10043353b 0x10043662a 0x1004a13ca 0x1003d5e0f 0x1003e298a 0x1003e480f 0x1000ed8ec 0x1000c8b73 
 0   mongod                              0x000000010007d703 _ZN5mongo12sayDbContextEPKc + 195
 1   mongod                              0x0000000100087eec _ZN5mongo8assertedEPKcS1_j + 300
 2   mongod                              0x00000001004165e4 _ZN5mongo11DataFileMgr9getExtentERKNS_7DiskLocE + 148
 3   mongod                              0x000000010040774b _ZN5mongo11DataFileMgr7findAllEPKcRKNS_7DiskLocE + 75
 4   mongod                              0x0000000100410823 _ZN5mongo13findTableScanEPKcRKNS_7BSONObjERKNS_7DiskLocE + 131
 5   mongod                              0x0000000100437df9 _ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocEi + 1081
 6   mongod                              0x00000001004b3006 _ZN5mongo11UserQueryOp5_initEv + 214
 7   mongod                              0x0000000100426693 _ZN5mongo7QueryOp4initEv + 323
 8   mongod                              0x0000000100426b53 _ZN5mongo12QueryPlanSet6Runner6initOpERNS_7QueryOpE + 35
 9   mongod                              0x0000000100429f45 _ZN5mongo12QueryPlanSet6Runner4initEv + 245
 10  mongod                              0x000000010042d8f0 _ZN5mongo12QueryPlanSet6Runner22runUntilFirstCompletesEv + 32
 11  mongod                              0x000000010043109e _ZN5mongo12QueryPlanSet5runOpERNS_7QueryOpE + 334
 12  mongod                              0x000000010043353b _ZN5mongo16MultiPlanScanner9runOpOnceERNS_7QueryOpE + 1115
 13  mongod                              0x000000010043662a _ZN5mongo16MultiPlanScanner5runOpERNS_7QueryOpE + 26
 14  mongod                              0x00000001004a13ca _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 3194
 15  mongod                              0x00000001003d5e0f _ZN5mongo13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 623
 16  mongod                              0x00000001003e298a _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1402
 17  mongod                              0x00000001003e480f _ZN5mongo14DBDirectClient4callERNS_7MessageES2_bPSs + 111
 18  mongod                              0x00000001000ed8ec _ZN5mongo14DBClientCursor4initEv + 76
 19  mongod                              0x00000001000c8b73 _ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 739
Wed Nov  2 18:10:51 [initandlisten] assertion 0 assertion db/pdfile.h:300 ns:admin.system.namespaces query:{}
Wed Nov  2 18:10:51 [initandlisten]  admin clone failed for admin with error: query failed admin.system.namespaces
Wed Nov  2 18:10:51 [initandlisten] removeJournalFiles
Wed Nov  2 18:10:51 [initandlisten]  admin Assertion failure doDBUpgrade( dbName , errmsg , h ) db/db.cpp 298
0x10007d703 0x100087eec 0x1005f4f2f 0x1005f5c3c 0x1005f6274 0x1005f7d6f 0x1000013c4 
 0   mongod                              0x000000010007d703 _ZN5mongo12sayDbContextEPKc + 195
 1   mongod                              0x0000000100087eec _ZN5mongo8assertedEPKcS1_j + 300
 2   mongod                              0x00000001005f4f2f _ZN5mongo30repairDatabasesAndCheckVersionEv + 2063
 3   mongod                              0x00000001005f5c3c _ZN5mongo14_initAndListenEi + 1036
 4   mongod                              0x00000001005f6274 _ZN5mongo13initAndListenEi + 36
 5   mongod                              0x00000001005f7d6f main + 3647
 6   mongod                              0x00000001000013c4 start + 52
Wed Nov  2 18:10:51 [initandlisten] exception in initAndListen: 0 assertion db/db.cpp:298, terminating
Wed Nov  2 18:10:51 dbexit: 
Wed Nov  2 18:10:51 [initandlisten] shutdown: going to close listening sockets...
Wed Nov  2 18:10:51 [initandlisten] shutdown: going to flush diaglog...
Wed Nov  2 18:10:51 [initandlisten] shutdown: going to close sockets...
Wed Nov  2 18:10:51 [initandlisten] shutdown: waiting for fs preallocator...
Wed Nov  2 18:10:51 [initandlisten] shutdown: lock for final commit...
Wed Nov  2 18:10:51 [initandlisten] shutdown: final commit...
Wed Nov  2 18:10:51 [initandlisten] shutdown: closing all files...
Wed Nov  2 18:10:51 [initandlisten] closeAllFiles() finished
Wed Nov  2 18:10:51 [initandlisten] journalCleanup...
Wed Nov  2 18:10:51 [initandlisten] removeJournalFiles
Wed Nov  2 18:10:51 [initandlisten] shutdown: removing fs lock...
Wed Nov  2 18:10:51 dbexit: really exiting now

mongodb版本是v2.0.0,pdfile版本是4.5,git版本是695c67dff0ffc361b8568a13366f027caa406222。

mongodb中有5个数据库,但只有一个数据库出错。

我还尝试通过mongodump恢复数据,但是获得了空的bson文件。

有什么想法吗?感谢

2 个答案:

答案 0 :(得分:1)

我能够通过转到我的数据目录(在上面的示例中将是

)来解决此问题
/data/db

并删除所有jicd.x和local.x文件

如果锁定文件的大小不是0字节,您可能也想删除该文件。

答案 1 :(得分:0)

mongodb JIRA门票链接是https://jira.mongodb.org/browse/SERVER-4198

作为故障单中的注释,通过删除master = true设置然后运行修复来解决问题。

我没有尝试过这种方法,只是作为参考。