0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

better name and comments

This commit is contained in:
Eliot Horowitz 2010-09-14 10:05:58 -04:00
parent 8b6e19c98e
commit a53ff9a810
3 changed files with 17 additions and 17 deletions

View File

@ -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<ShardedConnectionInfo> _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;

View File

@ -93,7 +93,7 @@ namespace mongo {
BSONObj max;
set<CursorId> 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 );

View File

@ -235,7 +235,7 @@ namespace mongo {
boost::thread_specific_ptr<ShardedConnectionInfo> 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;
}