某库的日志里报一堆这样的警告,
warning: ClientCursor::yield can't unlock b/c of recursive lock ns:
加索引解决
源码里有一段相关的代码如下 :
void ClientCursor::staticYield( int micros , const StringData& ns , Record * rec ) {
killCurrentOp.checkForInterrupt( false );
{
auto_ptr<RWLockRecursive::Shared> lk;
if ( rec )
lk.reset( new RWLockRecursive::Shared( MongoFile::mmmutex) );
dbtempreleasecond unlock;
if ( unlock.unlocked() ) {
if ( micros == -1 )
micros = Client::recommendedYieldMicros();
if ( micros > 0 )
sleepmicros( micros );
}
else {
CurOp * c = cc().curop();
while ( c->parent() )
c = c->parent();
warning() << "ClientCursor::yield can't unlock b/c of recursive lock"
<< " ns: " << ns
<< " top: " << c->info()
<< endl;
}
if ( rec )
rec->touch();
lk.reset(0); // need to release this before dbtempreleasecond
}
}
【参考】
mongodb_src/db/clientcursor.cpp
时间: 2024-09-20 09:21:47