0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Revert "Throttle sharding requests when processing WriteBacks"

This reverts commit 2e41c3387c.
This commit is contained in:
Eliot Horowitz 2010-07-31 01:56:38 -04:00
parent 2e41c3387c
commit c226367562

View File

@ -27,30 +27,9 @@
namespace mongo {
namespace {
mutex sleepMutex ("WriteBackThrottle");
int sleepTime (10);
Date_t throttleUntil(0);
thread_specific_ptr<int> writeBackThreadMarker; // non-NULL if in writeBack thread
void throttleIfNeeded() {
if (!writeBackThreadMarker.get() && jsTime() < throttleUntil){
int i;
{
scoped_lock lock (sleepMutex);
i = sleepTime++;
}
sleepmillis(min(1000, sleepTime));
}
}
}
// ----- Strategy ------
void Strategy::doWrite( int op , Request& r , const Shard& shard , bool checkVersion ){
throttleIfNeeded();
ShardConnection conn( shard , r.getns() );
if ( ! checkVersion )
conn.donotCheckVersion();
@ -91,8 +70,6 @@ namespace mongo {
}
void Strategy::insert( const Shard& shard , const char * ns , const BSONObj& obj ){
throttleIfNeeded();
ShardConnection dbcon( shard , ns );
if ( dbcon.setVersion() ){
dbcon.done();
@ -110,9 +87,6 @@ namespace mongo {
}
void run(){
// doesn't matter what is put in here, just that it is not NULL
writeBackThreadMarker.reset(new int());
OID lastID;
lastID.clear();
int secsToSleep = 0;
@ -141,8 +115,6 @@ namespace mongo {
}
log(1) << "writebacklisten result: " << result << endl;
throttleUntil = jsTime() + 1000;
BSONObj data = result.getObjectField( "data" );
if ( data.getBoolField( "writeBack" ) ){
@ -182,11 +154,6 @@ namespace mongo {
log() << "unknown writeBack result: " << result << endl;
}
OCCASIONALLY {
scoped_lock lock (sleepMutex);
sleepTime /= 2;
}
conn.done();
secsToSleep = 0;
continue;