0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00
This commit is contained in:
Aaron 2010-06-28 14:06:25 -07:00
parent 8f1c46589e
commit 344a92341e
2 changed files with 55 additions and 0 deletions

51
jstests/disk/repair3.js Normal file
View File

@ -0,0 +1,51 @@
// test --repairpath on aother partition
var baseName = "jstests_disk_repair3";
repairpath = "/data/db/repairpartitiontest"
doIt = false;
files = listFiles( "/data/db" );
for ( i in files ) {
if ( files[ i ].name == repairpath ) {
doIt = true;
}
}
if ( !doIt ) {
print( "path /data/db/repairpartitiontest/ missing, skipping repair3 test" );
doIt = false;
}
if ( doIt ) {
port = allocatePorts( 1 )[ 0 ];
dbpath = "/data/db/" + baseName + "/";
resetDbpath( dbpath );
resetDbpath( repairpath );
m = startMongoProgram( "mongod", "--port", port, "--dbpath", dbpath, "--repairpath", repairpath, "--nohttpinterface", "--bind_ip", "127.0.0.1" );
db = m.getDB( baseName );
db[ baseName ].save( {} );
assert.commandWorked( db.runCommand( {repairDatabase:1, backupOriginalFiles:true} ) );
function check() {
files = listFiles( dbpath );
for( f in files ) {
assert( ! new RegExp( "^" + dbpath + "backup_" ).test( files[ f ].name ), "backup dir in dbpath" );
}
assert.eq.automsg( "1", "db[ baseName ].count()" );
}
check();
stopMongod( port );
resetDbpath( repairpath );
rc = runMongoProgram( "mongod", "--repair", "--port", port, "--dbpath", dbpath, "--repairpath", repairpath, "--nohttpinterface", "--bind_ip", "127.0.0.1" );
assert.eq.automsg( "0", "rc" );
m = startMongoProgram( "mongod", "--port", port, "--dbpath", dbpath, "--repairpath", repairpath, "--nohttpinterface", "--bind_ip", "127.0.0.1" );
db = m.getDB( baseName );
check();
stopMongod( port );
}

View File

@ -558,6 +558,8 @@
93C8ED001147824B00F28017 /* thread_pool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = thread_pool.cpp; sourceTree = "<group>"; };
93C8ED041147828F00F28017 /* index.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = index.cpp; sourceTree = "<group>"; };
93C9236B11D9427B00BA617F /* in1.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = in1.js; sourceTree = "<group>"; };
93C9236C11D943C500BA617F /* repair3.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = repair3.js; sourceTree = "<group>"; };
93C9236D11D943CD00BA617F /* preallocate2.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = preallocate2.js; sourceTree = "<group>"; };
93CC40C2113C407A00734218 /* insert1.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = insert1.js; sourceTree = "<group>"; };
93CC441A113DE6BA00734218 /* indexg.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = indexg.js; sourceTree = "<group>"; };
93CC4484113E602400734218 /* in3.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = in3.js; sourceTree = "<group>"; };
@ -1099,6 +1101,8 @@
934BEBCD10DFFA9600178102 /* disk */ = {
isa = PBXGroup;
children = (
93C9236D11D943CD00BA617F /* preallocate2.js */,
93C9236C11D943C500BA617F /* repair3.js */,
93B9F5A7112B12440066ECD2 /* slavefromsnapshot.js */,
9391C9DD1120F9D300292B19 /* newcollection.js */,
938E60AC110F734800A8760A /* directoryperdb.js */,