From a53ff9a810e2d6162c7e801bb7a3b8a845813e54 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Tue, 14 Sep 2010 10:05:58 -0400 Subject: [PATCH] better name and comments --- s/d_logic.h | 28 ++++++++++++++-------------- s/d_migrate.cpp | 2 +- s/d_state.cpp | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/s/d_logic.h b/s/d_logic.h index a000f6ba830..ff183a52111 100644 --- a/s/d_logic.h +++ b/s/d_logic.h @@ -92,10 +92,10 @@ namespace mongo { extern ShardingState shardingState; - // -------------- - // --- per connection --- - // -------------- - + /** + * one per connection from mongos + * holds version state for each namesapce + */ class ShardedConnectionInfo { public: ShardedConnectionInfo(); @@ -110,31 +110,31 @@ namespace mongo { static ShardedConnectionInfo* get( bool create ); static void reset(); - bool inForceMode() const { - return _forceMode; + bool inForceVersionOkMode() const { + return _forceVersionOk; } - void enterForceMode(){ _forceMode = true; } - void leaveForceMode(){ _forceMode = false; } + void enterForceVersionOkMode(){ _forceVersionOk = true; } + void leaveForceVersionOkMode(){ _forceVersionOk = false; } private: OID _id; NSVersionMap _versions; - bool _forceMode; + bool _forceVersionOk; // if this is true, then chunk version #s aren't check, and all ops are allowed static boost::thread_specific_ptr _tl; }; - struct ShardForceModeBlock { - ShardForceModeBlock(){ + struct ShardForceVersionOkModeBlock { + ShardForceVersionOkModeBlock(){ info = ShardedConnectionInfo::get( false ); if ( info ) - info->enterForceMode(); + info->enterForceVersionOkMode(); } - ~ShardForceModeBlock(){ + ~ShardForceVersionOkModeBlock(){ if ( info ) - info->leaveForceMode(); + info->leaveForceVersionOkMode(); } ShardedConnectionInfo * info; diff --git a/s/d_migrate.cpp b/s/d_migrate.cpp index c811cd0284f..fbd93b81287 100644 --- a/s/d_migrate.cpp +++ b/s/d_migrate.cpp @@ -93,7 +93,7 @@ namespace mongo { BSONObj max; set initial; void doRemove(){ - ShardForceModeBlock sf; + ShardForceVersionOkModeBlock sf; writelock lk(ns); RemoveSaver rs("moveChunk",ns,"post-cleanup"); long long num = Helpers::removeRange( ns , min , max , true , false , cmdLine.moveParanoia ? &rs : 0 ); diff --git a/s/d_state.cpp b/s/d_state.cpp index 5925d5a1b5b..c2cefb7c785 100644 --- a/s/d_state.cpp +++ b/s/d_state.cpp @@ -235,7 +235,7 @@ namespace mongo { boost::thread_specific_ptr ShardedConnectionInfo::_tl; ShardedConnectionInfo::ShardedConnectionInfo(){ - _forceMode = false; + _forceVersionOk = false; _id.clear(); } @@ -566,7 +566,7 @@ namespace mongo { return true; } - if ( info->inForceMode() ){ + if ( info->inForceVersionOkMode() ){ return true; }