mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-2454 improve error messages for CollectionScan DEAD cases
This commit is contained in:
parent
9edbe630a7
commit
332781c598
@ -135,6 +135,7 @@ error_code("ConfigServersInconsistent", 132)
|
|||||||
error_code("FailedToSatisfyReadPreference", 133)
|
error_code("FailedToSatisfyReadPreference", 133)
|
||||||
error_code("XXX_TEMP_NAME_ReadCommittedCurrentlyUnavailable", 134)
|
error_code("XXX_TEMP_NAME_ReadCommittedCurrentlyUnavailable", 134)
|
||||||
error_code("StaleTerm", 135)
|
error_code("StaleTerm", 135)
|
||||||
|
error_code("CappedPositionLost", 136)
|
||||||
|
|
||||||
# Non-sequential error codes (for compatibility only)
|
# Non-sequential error codes (for compatibility only)
|
||||||
error_code("NotMaster", 10107) #this comes from assert_util.h
|
error_code("NotMaster", 10107) #this comes from assert_util.h
|
||||||
|
@ -76,7 +76,11 @@ PlanStage::StageState CollectionScan::work(WorkingSetID* out) {
|
|||||||
ScopedTimer timer(&_commonStats.executionTimeMillis);
|
ScopedTimer timer(&_commonStats.executionTimeMillis);
|
||||||
|
|
||||||
if (_isDead) {
|
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);
|
*out = WorkingSetCommon::allocateStatusMember(_workingSet, status);
|
||||||
return PlanStage::DEAD;
|
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.
|
// time we'd need to create a cursor after already getting a record out of it.
|
||||||
if (!_cursor->seekExact(_lastSeenId)) {
|
if (!_cursor->seekExact(_lastSeenId)) {
|
||||||
_isDead = true;
|
_isDead = true;
|
||||||
Status status(ErrorCodes::InternalError,
|
Status status(ErrorCodes::CappedPositionLost,
|
||||||
"CollectionScan died: Unexpected RecordId");
|
str::stream() << "CollectionScan died due to failure to restore "
|
||||||
|
<< "tailable cursor position. "
|
||||||
|
<< "Last seen record id: " << _lastSeenId);
|
||||||
*out = WorkingSetCommon::allocateStatusMember(_workingSet, status);
|
*out = WorkingSetCommon::allocateStatusMember(_workingSet, status);
|
||||||
return PlanStage::DEAD;
|
return PlanStage::DEAD;
|
||||||
}
|
}
|
||||||
@ -222,8 +228,7 @@ void CollectionScan::restoreState(OperationContext* opCtx) {
|
|||||||
++_commonStats.unyields;
|
++_commonStats.unyields;
|
||||||
if (_cursor) {
|
if (_cursor) {
|
||||||
if (!_cursor->restore(opCtx)) {
|
if (!_cursor->restore(opCtx)) {
|
||||||
warning() << "Collection dropped or state deleted during yield of CollectionScan: "
|
warning() << "Could not restore RecordCursor for CollectionScan: " << opCtx->getNS();
|
||||||
<< opCtx->getNS();
|
|
||||||
_isDead = true;
|
_isDead = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user