/* static */ BSONObj WriteBackListener::waitFor( const ConnectionIdent& ident, const OID& oid ) { Timer t; Timer lastMessageTimer; while ( t.minutes() < 60 ) { { scoped_lock lk( _seenWritebacksLock ); WBStatus s = _seenWritebacks[ident]; if ( oid < s.id ) { // this means we're waiting for a GLE that already passed. // it should be impossible because once we call GLE, no other // writebacks should happen with that connection id msgasserted( 14041 , str::stream() << "got writeback waitfor for older id " << " oid: " << oid << " s.id: " << s.id << " ident: " << ident.toString() ); } else if ( oid == s.id ) { return s.gle; } // Stay in lock so we can use the status if( lastMessageTimer.seconds() > 10 ){ warning() << "waiting for writeback " << oid << " from connection " << ident.toString() << " for " << t.seconds() << " secs" << ", currently at id " << s.id << endl; lastMessageTimer.reset(); } } sleepmillis( 10 ); } uasserted( 13403 , str::stream() << "didn't get writeback for: " << oid << " after: " << t.millis() << " ms" << " from connection " << ident.toString() ); throw 1; // never gets here }
/* static */ BSONObj WriteBackListener::waitFor( const ConnectionIdent& ident, const OID& oid ) { Timer t; for ( int i=0; i<5000; i++ ) { { scoped_lock lk( _seenWritebacksLock ); WBStatus s = _seenWritebacks[ident]; if ( oid < s.id ) { // this means we're waiting for a GLE that already passed. // it should be impossible because once we call GLE, no other // writebacks should happen with that connection id msgasserted( 14041 , str::stream() << "got writeback waitfor for older id " << " oid: " << oid << " s.id: " << s.id << " ident: " << ident.toString() ); } else if ( oid == s.id ) { return s.gle; } } sleepmillis( 10 ); } uasserted( 13403 , str::stream() << "didn't get writeback for: " << oid << " after: " << t.millis() << " ms" ); throw 1; // never gets here }