Permalink
Browse files

more fixes for ThreadSpanningOp

  • Loading branch information...
erh committed Mar 17, 2012
1 parent 5c822e5 commit c949cad1fa6e4cb26693748b1751f4fd2e6113b8
Showing with 6 additions and 1 deletion.
  1. +4 −1 src/mongo/db/d_concurrency.cpp
  2. +1 −0 src/mongo/db/d_concurrency.h
  3. +1 −0 src/mongo/db/dbcommands_admin.cpp
@@ -236,11 +236,14 @@ namespace mongo {
threadState() = 0;
}
void Lock::ThreadSpanningOp::unsetR() {
- assert( threadState() == 'R' );

This comment has been minimized.

Show comment Hide comment
@dwight

dwight Mar 17, 2012

Owner

not sure exactly how this has evolved but originally the idea was that with ThreadSpanningOp when you use it, you use it only and it wasn't designed to interoperate with the other Lock:: classes and stuff. thus it didn't set threadstate for example. it is fine if it is different but does this now imply i can use ThreadSpanningOp interoperably with all the other Lock:: classes? i imagine it won't play nicely with them. will read more later.

@dwight

dwight Mar 17, 2012

Owner

not sure exactly how this has evolved but originally the idea was that with ThreadSpanningOp when you use it, you use it only and it wasn't designed to interoperate with the other Lock:: classes and stuff. thus it didn't set threadstate for example. it is fine if it is different but does this now imply i can use ThreadSpanningOp interoperably with all the other Lock:: classes? i imagine it won't play nicely with them. will read more later.

This comment has been minimized.

Show comment Hide comment
@erh

erh Mar 17, 2012

Owner
@erh

erh via email Mar 17, 2012

Owner
+ assert( threadState() == 'R' || threadState() == 0 );
q.unlock_R();
q.start_greed();
threadState() = 0;
}
+ void Lock::ThreadSpanningOp::handoffR() {
+ threadState() = 0;
+ }
int Lock::isLocked() {
return threadState();
@@ -77,6 +77,7 @@ namespace mongo {
static void W_to_R();
static void unsetW(); // reverts to greedy
static void unsetR(); // reverts to greedy
+ static void handoffR(); // doesn't unlock, but changes my thread state back to ''
};
};
@@ -464,6 +464,7 @@ namespace mongo {
log() << " For more info see " << FSyncCommand::url() << endl;
result.append("info", "now locked against writes, use db.fsyncUnlock() to unlock");
result.append("seeAlso", url());
+ Lock::ThreadSpanningOp::handoffR();
}
else {
// the simple fsync command case

0 comments on commit c949cad

Please sign in to comment.