summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Lerner <alerner@10gen.com>2013-04-09 15:59:22 -0400
committerAlberto Lerner <alerner@10gen.com>2013-04-09 16:02:19 -0400
commitab76660a759117bf60d5b54d0b0d257d105fb55b (patch)
tree52e62c11f8a4d540497746a863b4d92532b3ef92
parent6edf4a7f081a4d2dc7c515a29908b79af5e94771 (diff)
downloadmongo-ab76660a759117bf60d5b54d0b0d257d105fb55b.tar.gz
SERVER-7271 Improve error reporting when migrate commit fails.
-rw-r--r--src/mongo/client/distlock.cpp11
-rw-r--r--src/mongo/s/d_migrate.cpp4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/client/distlock.cpp b/src/mongo/client/distlock.cpp
index 7a6efbc1b05..8b932e73b3a 100644
--- a/src/mongo/client/distlock.cpp
+++ b/src/mongo/client/distlock.cpp
@@ -511,21 +511,20 @@ namespace mongo {
conn.done();
if ( lockObj.isEmpty() ) {
- *errMsg = str::stream() << "could not assert if lock " << _name << " "
- << "was held because there was correspondant document in the "
- << "locks collection";
+ *errMsg = str::stream() << "no lock for " << _name << " exists in the locks collection";
return false;
}
if ( lockObj[LocksType::state()].numberInt() < 2 ) {
- *errMsg = str::stream() << "lock " << _name << " is not held because its current "
- << "state is " << lockObj[LocksType::state()].numberInt();
+ *errMsg = str::stream() << "lock " << _name << " current state is not held ("
+ << lockObj[LocksType::state()].numberInt() << ")";
return false;
}
if ( lockObj[LocksType::process()].String() != _processId ) {
*errMsg = str::stream() << "lock " << _name << " is currently being held by "
- << " another process " << lockObj[LocksType::process()].String();
+ << "another process ("
+ << lockObj[LocksType::process()].String() << ")";
return false;
}
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp
index f36d8a3b0c4..a9507e0b96c 100644
--- a/src/mongo/s/d_migrate.cpp
+++ b/src/mongo/s/d_migrate.cpp
@@ -1421,6 +1421,7 @@ namespace mongo {
BSONObjBuilder b;
e.getInfo().append( b );
cmdResult = b.obj();
+ errmsg = cmdResult.toString();
}
if ( exceptionCode == PrepareConfigsFailedCode ) {
@@ -1443,6 +1444,8 @@ namespace mongo {
}
log() << "Shard version successfully reset to clean up failed migration" << endl;
+
+ errmsg = "Failed to send migrate commit to configs because " + errmsg;
return false;
}
@@ -1475,6 +1478,7 @@ namespace mongo {
if ( checkVersion.isEquivalentTo( nextVersion ) ) {
log() << "moveChunk commit confirmed" << migrateLog;
+ errmsg.clear();
}
else {