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:
parent
8b6e19c98e
commit
a53ff9a810
28
s/d_logic.h
28
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<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;
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user