From 80f97319bcb9ac199a2660a09304a13a864d1583 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 8 May 2009 16:43:22 -0700 Subject: fix repair segfault --- db/cloner.cpp | 4 ++-- jstests/repair.js | 5 +++++ mongo.xcodeproj/project.pbxproj | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 jstests/repair.js diff --git a/db/cloner.cpp b/db/cloner.cpp index 0aefa13c781..4df68fa5d21 100644 --- a/db/cloner.cpp +++ b/db/cloner.cpp @@ -210,7 +210,7 @@ namespace mongo { { string err; const char *toname = to_name.c_str(); - setClient( toname ); + DBContext c( toname ); userCreateNS(toname, options, err, logForRepl); /* chunks are big enough that we should create the _id index up front, that should @@ -220,8 +220,8 @@ namespace mongo { */ if ( strstr(toname, "._chunks") ) ensureHaveIdIndex(toname); + copy(from_name, to_name.c_str(), false, logForRepl, masterSameProcess, slaveOk); } - copy(from_name, to_name.c_str(), false, logForRepl, masterSameProcess, slaveOk); } // now build the indexes diff --git a/jstests/repair.js b/jstests/repair.js new file mode 100644 index 00000000000..96944b86851 --- /dev/null +++ b/jstests/repair.js @@ -0,0 +1,5 @@ +t = db.jstests_repair; +t.drop(); +t.save( { i:1 } ); +db.repairDatabase(); +assert( t.validate().valid ); diff --git a/mongo.xcodeproj/project.pbxproj b/mongo.xcodeproj/project.pbxproj index e197280e63e..52f1d5a061f 100644 --- a/mongo.xcodeproj/project.pbxproj +++ b/mongo.xcodeproj/project.pbxproj @@ -149,6 +149,7 @@ 938A7A480F54873600FB7A07 /* reccache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reccache.h; sourceTree = ""; }; 938A7A490F54873600FB7A07 /* reci.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reci.h; sourceTree = ""; }; 938A7A4A0F54873600FB7A07 /* recstore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = recstore.h; sourceTree = ""; }; + 938DEC930FB4F97F00C393D8 /* repair.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = repair.js; sourceTree = ""; }; 939C67200F535D72006570D3 /* cursor8.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = cursor8.js; sourceTree = ""; }; 93A13A210F4620A500AF1B0D /* commands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commands.cpp; sourceTree = ""; }; 93A13A230F4620A500AF1B0D /* config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = config.cpp; sourceTree = ""; }; @@ -575,6 +576,7 @@ 93A8D1D10F37544800C92B85 /* jstests */ = { isa = PBXGroup; children = ( + 938DEC930FB4F97F00C393D8 /* repair.js */, 93A47EC50FB0B0BA00E760DD /* recovery */, 93C392D00FAA4162007D6E4A /* minmax.js */, 9343373F0F9CD6900019D5C0 /* index8.js */, -- cgit v1.2.1