257 TransactionTooLarge: TransactionTooLarge
MongoDBWhat does it mean?
A multi-document transaction exceeded the allowed size/operation-count limits. The transaction was rejected because the changes accumulated in it (oplog entry or memory usage) went over the upper limit.
Why does it happen?
Modifying/inserting a large number of documents in a single transaction pushed the total data produced by the transaction too high (e.g. the volume of changes that must be held in the WiredTiger cache, or server limits such as transactionLimitBytes). Since 4.2 a transaction can be split across multiple oplog entries, so the 16 MB oplog entry limit alone is not decisive. Using transactions for bulk data migration/ETL easily hits this limit.
How to fix it
Split the transaction into smaller pieces; commit each batch in a separate transaction. Multi-document transactions are designed to be short and small; prefer doing large bulk updates without transactions (idempotent, chunk by chunk) or splitting them with bulk write. Avoid modifying thousands of documents in a single transaction.
More from this engine
- 216 ElectionInProgressElectionInProgress
- 225 TransactionTooOldTransactionTooOld
- 246 SnapshotUnavailableSnapshotUnavailable
- 276 IndexBuildAbortedIndexBuildAborted
- 86 IndexKeySpecsConflictIndexKeySpecsConflict
- 166 CommandNotSupportedOnViewCommandNotSupportedOnView
- 168 InvalidPipelineOperatorInvalidPipelineOperator