0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

compact fix

This commit is contained in:
dwight 2011-04-04 14:16:37 -04:00
parent dafb88648f
commit 0ff487c7d1
3 changed files with 7 additions and 4 deletions

View File

@ -353,6 +353,8 @@ coreServerFiles += processInfoFiles
if has_option( "asio" ):
coreServerFiles += [ "util/message_server_asio.cpp" ]
# mongos + mongod files
# todo: move some mongod specific stuff out of here
serverOnlyFiles = Split( "util/logfile.cpp util/alignedbuilder.cpp db/mongommf.cpp db/dur.cpp db/durop.cpp db/dur_writetodatafiles.cpp db/dur_preplogbuffer.cpp db/dur_commitjob.cpp db/dur_recover.cpp db/dur_journal.cpp db/query.cpp db/update.cpp db/introspect.cpp db/btree.cpp db/clientcursor.cpp db/tests.cpp db/repl.cpp db/repl/rs.cpp db/repl/consensus.cpp db/repl/rs_initiate.cpp db/repl/replset_commands.cpp db/repl/manager.cpp db/repl/health.cpp db/repl/heartbeat.cpp db/repl/rs_config.cpp db/repl/rs_rollback.cpp db/repl/rs_sync.cpp db/repl/rs_initialsync.cpp db/oplog.cpp db/repl_block.cpp db/btreecursor.cpp db/cloner.cpp db/namespace.cpp db/cap.cpp db/matcher_covered.cpp db/dbeval.cpp db/restapi.cpp db/dbhelpers.cpp db/instance.cpp db/client.cpp db/database.cpp db/pdfile.cpp db/cursor.cpp db/security_commands.cpp db/security.cpp db/queryoptimizer.cpp db/extsort.cpp db/cmdline.cpp" )
serverOnlyFiles += [ "db/index.cpp" ] + Glob( "db/geo/*.cpp" )
@ -1089,7 +1091,7 @@ def checkErrorCodes():
checkErrorCodes()
# main db target
mongodOnlyFiles = [ "db/db.cpp" ]
mongodOnlyFiles = [ "db/db.cpp", "db/compact.cpp" ]
if windows:
mongodOnlyFiles.append( "util/ntservice.cpp" )
mongod = env.Program( "mongod" , commonFiles + coreDbFiles + coreServerFiles + serverOnlyFiles + mongodOnlyFiles )

View File

@ -61,7 +61,6 @@ namespace mongo {
log() << "compact copying records" << endl;
unsigned totalSize = 0;
int nrecs = 0;
int prev = DiskLoc::NullOfs;
DiskLoc L = e->firstRecord;
if( !L.isNull() )
while( 1 ) {
@ -109,7 +108,7 @@ namespace mongo {
}
bool _compact(const char *ns, NamespaceDetails *d, string& errmsg) {
int les = d->lastExtentSize;
//int les = d->lastExtentSize;
// this is a big job, so might as well make things tidy before we start just to be nice.
getDur().commitNow();

View File

@ -8,7 +8,9 @@ t.insert({});
print("1");
assert(db.runCommand({ compact: 'compacttest', dev: true }).ok);
var res = db.runCommand({ compact: 'compacttest', dev: true });
printjson(res);
assert(res.ok);
assert(t.count() == 1);
var v = t.validate(true);
assert(v.ok);