diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-07-07 02:14:34 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-07-07 02:14:34 -0400 |
commit | 9ff2f6ce50b3caddcee7c43fffd3136e8c354270 (patch) | |
tree | 3398d366e9714032682f66196d83bb5708009879 | |
parent | 6f755db29cbf8683bf226eb5ff27575996786607 (diff) | |
download | mongo-9ff2f6ce50b3caddcee7c43fffd3136e8c354270.tar.gz |
fix chunk cleaning
-rw-r--r-- | s/d_migrate.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/s/d_migrate.cpp b/s/d_migrate.cpp index fd92b15b635..6f2607d1ab8 100644 --- a/s/d_migrate.cpp +++ b/s/d_migrate.cpp @@ -190,13 +190,14 @@ namespace mongo { class MigrateFromStatus { public: - MigrateFromStatus() : _m("MigrateFromStatus") { + MigrateFromStatus() : _m("MigrateFromStatus") , _workLock( "MigrateFromStatus::WorkLock" ) { _active = false; _inCriticalSection = false; _memoryUsed = 0; } void start( string ns , const BSONObj& min , const BSONObj& max ) { + scoped_lock lk( _workLock ); scoped_lock l(_m); // reads and writes _active assert( ! _active ); @@ -519,9 +520,10 @@ namespace mongo { void doRemove( OldDataCleanup& cleanup ) { while ( true ) { { - scoped_lock lk( _m ); + scoped_lock lk( _workLock ); if ( ! _active ) { cleanup.doRemove(); + return; } } sleepmillis( 100 ); @@ -551,6 +553,9 @@ namespace mongo { list<BSONObj> _deleted; // objects deleted during clone that should be deleted later long long _memoryUsed; // bytes in _reload + _deleted + mutable mongo::mutex _workLock; // this is used to make sure only 1 thread is doing serious work + // for now, this means migrate or removing old chunk data + bool _getActive() const { scoped_lock l(_m); return _active; } void _setActive( bool b ) { scoped_lock l(_m); _active = b; } |