136 CappedPositionLost: Capped collection position lost
MongoDB의미
capped(고정 크기) 컬렉션을 읽는 커서(보통 tailable cursor)가 위치를 잃었다. 커서가 가리키던 문서를 컬렉션이 순환적으로 덮어써 더 이상 존재하지 않는다.
원인
capped collection이 가득 차면 가장 오래된 문서가 자동으로 제거되고 덮어써진다. 소비 속도보다 빠르게 쓰이는 컬렉션을 따라가는 tailable cursor는 뒤처지고 위치가 덮어써진다. oplog 같은 capped 구조를 tail하는 consumer에서 나타난다.
해결 방법
커서 위치를 다시 잡고(새 tailable cursor 열기) tailing을 재시작한다. 애플리케이션에서 이 오류를 잡아 읽기를 새로 고친다. 근본 원인이 쓰기 속도를 따라가지 못하는 consumer라면 capped collection/oplog 크기를 늘리거나 consumer 속도를 높인다. 변경 사항을 안정적으로 추적하려면 가능하면 tailable cursor 대신 change stream을 사용한다.
같은 데이터베이스의 다른 항목
- 7 HostNotFoundCould not find host
- 175 QueryPlanKilledQuery plan killed during execution
- 11602 InterruptedDueToReplStateChangeOperation interrupted due to a replication state change (복제 상태 변경으로 작업 중단)
- 28 PathNotViableCannot use the part of the path to traverse the element (경로의 일부로 요소를 탐색할 수 없음)
- 216 ElectionInProgressElectionInProgress
- 225 TransactionTooOldTransactionTooOld
- 246 SnapshotUnavailableSnapshotUnavailable