Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ scratch
# binaries
/mongo
/mongod
/mongod.man
/mongogrid
/mongos

Expand Down
14 changes: 14 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,20 @@ elif "win32" == os.sys.platform:
env.Append( EXTRACPPPATH=["#/../winpcap/Include"] )
env.Append( EXTRALIBPATH=["#/../winpcap/Lib"] )

if force64:
env.Append( CTRPP= winSDKHome + "/Bin/x64/ctrpp.exe" )
else:
env.Append( CTRPP= winSDKHome + "/Bin/ctrpp.exe" )
if os.path.exists( env['CTRPP'] ):
print( "found ctrpp at " + env['CTRPP'] )

ctrpp_resource_builder = Builder( action = '"$CTRPP" -prefix Ctrpp_ -rc $TARGET $SOURCE', src_suffix='.man', suffix='.rc' )
ctrpp_header_builder = Builder( action = '"$CTRPP" -prefix Ctrpp_ -o $TARGET $SOURCE', src_suffix='.man', suffix='.h' )
env['BUILDERS']['PerfCounters_Resource'] = ctrpp_resource_builder
env['BUILDERS']['PerfCounters_Header'] = ctrpp_header_builder



else:
print( "No special config for [" + os.sys.platform + "] which probably means it won't work" )

Expand Down
21 changes: 20 additions & 1 deletion src/mongo/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,14 @@ env.StaticLibrary("notmongodormongos", everythingButMongodAndMongosFiles)

mongodOnlyFiles = [ "db/db.cpp", "db/compact.cpp", "db/commands/touch.cpp" ]

if "win32" == os.sys.platform:
env.PerfCounters_Header( target='winperfcounters_ctrpp', source='db/modules/winperfcounters/mongod' )
env.PerfCounters_Resource( target='winperfcounters_ctrpp', source='db/modules/winperfcounters/mongod' )
env.RES( target='mongod', source='winperfcounters_ctrpp.rc' )
mongodOnlyFiles.append( "db/modules/winperfcounters/winperfcounters_instance.cpp" )
mongodOnlyFiles.append( "mongod.res" )
env.StaticLibrary( "winperfcounters", [ "db/modules/winperfcounters/winperfcounters.cpp" ] )

# create a library per module, and add it as a dependency
# for the mongod target; as of now, modules are only included
# in mongod, as though they were part of serverOnlyFiles
Expand All @@ -400,10 +408,21 @@ env.StaticLibrary("coreserver", coreServerFiles, LIBDEPS=["mongocommon", "script
# main db target
mongod = env.Install(
'#/', env.Program( "mongod", mongodOnlyFiles,
LIBDEPS=["coreserver", "serveronly", "coredb", "ntservice",
LIBDEPS=["coreserver", "serveronly", "coredb", "ntservice", "winperfcounters",
"mongodandmongos"] + modules ) )
Default( mongod )

# performance counters
if "win32" == os.sys.platform:
# TODO: what we really want is to always install mongod.man when installing mongod.exe
mongodman = env.Install( '#/', 'db/modules/winperfcounters/mongod.man' )
wpcprobe = env.Install( '#/', testEnv.Program( "winperfcountersprobe", [ "db/modules/winperfcounters/winperfcountersprobe.cpp" ],
LIBDEPS=["serveronly", "coreserver", "coredb", "notmongodormongos", "ntservice", "winperfcounters" ] ) )
Default( mongodman )
env.Alias( 'core', [ mongodman ] )
env.Alias( 'all', [ mongodman, wpcprobe ] )


# tools
allToolFiles = [ "tools/tool.cpp", "tools/stat_util.cpp" ]
env.StaticLibrary("alltools", allToolFiles, LIBDEPS=["serveronly", "coreserver", "coredb",
Expand Down
4 changes: 4 additions & 0 deletions src/mongo/db/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#endif
#include "stats/counters.h"
#include "background.h"
#include "module.h"
#include "dur_journal.h"
#include "dur_recover.h"
#include "d_concurrency.h"
Expand Down Expand Up @@ -954,6 +955,9 @@ namespace mongo {
log() << "shutdown: going to close listening sockets..." << endl;
ListeningSockets::get()->closeAll();

log() << "shutdown: going to shutdown modules..." << endl;
Module::shutdownAll();

log() << "shutdown: going to flush diaglog..." << endl;
_diaglog.flush();

Expand Down
12 changes: 12 additions & 0 deletions src/mongo/db/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,16 @@ namespace mongo {

}


void Module::shutdownAll() {
if ( ! _all ) {
return;
}
for ( list<Module*>::iterator i=_all->begin(); i!=_all->end(); i++ ) {
Module* m = *i;
m->shutdown();
}

}

}
3 changes: 2 additions & 1 deletion src/mongo/db/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace mongo {
virtual void init() = 0;

/**
* called when the database is about to shutdown
* called when the database is about to shutdown, can be called without init()
*/
virtual void shutdown() = 0;

Expand All @@ -61,6 +61,7 @@ namespace mongo {
static void addOptions( boost::program_options::options_description& options );
static void configAll( boost::program_options::variables_map& params );
static void initAll();
static void shutdownAll();

private:
static std::list<Module*> * _all;
Expand Down
Loading