Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SERVER-7181 Fix error reporting in mongorestore during index build

  • Loading branch information...
commit a84fe318f8331ee687ce9232d60adffd5930489c 1 parent 19ecdc6
@renctan renctan authored milkie committed
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/mongo/tools/restore.cpp
View
18 src/mongo/tools/restore.cpp
@@ -480,18 +480,26 @@ class Restore : public BSONTool {
// We're stricter about errors for indexes than for regular data
BSONObj err = conn().getLastErrorDetailed(_curdb, false, false, _w);
- if ( ! ( err["err"].isNull() ) ) {
- if (err["err"].String() == "norepl" && _w > 1) {
+ if (err.hasField("err") && !err["err"].isNull()) {
+ if (err["err"].str() == "norepl" && _w > 1) {
error() << "Cannot specify write concern for non-replicas" << endl;
}
else {
- error() << "Error creating index " << o["ns"].String();
- error() << ": " << err["code"].Int() << " " << err["err"].String() << endl;
- error() << "To resume index restoration, run " << _name << " on file" << _fileName << " manually." << endl;
+ string errCode;
+
+ if (err.hasField("code")) {
+ errCode = str::stream() << err["code"].numberInt();
+ }
+
+ error() << "Error creating index " << o["ns"].String() << ": "
+ << errCode << " " << err["err"] << endl;
}
::abort();
}
+
+ massert(16439, str::stream() << "Error calling getLastError: " << err["errmsg"],
+ err["ok"].trueValue());
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.