0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

SERVER-2454 improve error messages for CollectionScan DEAD cases

This commit is contained in:
David Storch 2015-07-07 16:54:49 -04:00
parent 9edbe630a7
commit 332781c598
2 changed files with 11 additions and 5 deletions

View File

@ -135,6 +135,7 @@ error_code("ConfigServersInconsistent", 132)
error_code("FailedToSatisfyReadPreference", 133)
error_code("XXX_TEMP_NAME_ReadCommittedCurrentlyUnavailable", 134)
error_code("StaleTerm", 135)
error_code("CappedPositionLost", 136)
# Non-sequential error codes (for compatibility only)
error_code("NotMaster", 10107) #this comes from assert_util.h

View File

@ -76,7 +76,11 @@ PlanStage::StageState CollectionScan::work(WorkingSetID* out) {
ScopedTimer timer(&_commonStats.executionTimeMillis);
if (_isDead) {
Status status(ErrorCodes::InternalError, "CollectionScan died");
Status status(
ErrorCodes::CappedPositionLost,
str::stream()
<< "CollectionScan died due to position in capped collection being deleted. "
<< "Last seen record id: " << _lastSeenId);
*out = WorkingSetCommon::allocateStatusMember(_workingSet, status);
return PlanStage::DEAD;
}
@ -106,8 +110,10 @@ PlanStage::StageState CollectionScan::work(WorkingSetID* out) {
// time we'd need to create a cursor after already getting a record out of it.
if (!_cursor->seekExact(_lastSeenId)) {
_isDead = true;
Status status(ErrorCodes::InternalError,
"CollectionScan died: Unexpected RecordId");
Status status(ErrorCodes::CappedPositionLost,
str::stream() << "CollectionScan died due to failure to restore "
<< "tailable cursor position. "
<< "Last seen record id: " << _lastSeenId);
*out = WorkingSetCommon::allocateStatusMember(_workingSet, status);
return PlanStage::DEAD;
}
@ -222,8 +228,7 @@ void CollectionScan::restoreState(OperationContext* opCtx) {
++_commonStats.unyields;
if (_cursor) {
if (!_cursor->restore(opCtx)) {
warning() << "Collection dropped or state deleted during yield of CollectionScan: "
<< opCtx->getNS();
warning() << "Could not restore RecordCursor for CollectionScan: " << opCtx->getNS();
_isDead = true;
}
}