summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-05-08 16:43:22 -0700
committerAaron <aaron@10gen.com>2009-05-08 16:43:22 -0700
commit80f97319bcb9ac199a2660a09304a13a864d1583 (patch)
tree38113ab7da8e1bfe7c0e35271389eba09b11f9cb
parent6ebf10766c432d4b3640cf5ab51934fe95d1adfb (diff)
downloadmongo-80f97319bcb9ac199a2660a09304a13a864d1583.tar.gz
fix repair segfault
-rw-r--r--db/cloner.cpp4
-rw-r--r--jstests/repair.js5
-rw-r--r--mongo.xcodeproj/project.pbxproj2
3 files changed, 9 insertions, 2 deletions
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 = "<group>"; };
938A7A490F54873600FB7A07 /* reci.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reci.h; sourceTree = "<group>"; };
938A7A4A0F54873600FB7A07 /* recstore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = recstore.h; sourceTree = "<group>"; };
+ 938DEC930FB4F97F00C393D8 /* repair.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = repair.js; sourceTree = "<group>"; };
939C67200F535D72006570D3 /* cursor8.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = cursor8.js; sourceTree = "<group>"; };
93A13A210F4620A500AF1B0D /* commands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commands.cpp; sourceTree = "<group>"; };
93A13A230F4620A500AF1B0D /* config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = config.cpp; sourceTree = "<group>"; };
@@ -575,6 +576,7 @@
93A8D1D10F37544800C92B85 /* jstests */ = {
isa = PBXGroup;
children = (
+ 938DEC930FB4F97F00C393D8 /* repair.js */,
93A47EC50FB0B0BA00E760DD /* recovery */,
93C392D00FAA4162007D6E4A /* minmax.js */,
9343373F0F9CD6900019D5C0 /* index8.js */,