mongodb runtime_error ai_generated partial

MongoServerError: Queryable backup mode failed to create consistent snapshot: operationTime too far behind

ID: mongodb/queryable-backup-mode-failed

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
1Evidence
2024-08-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
mongodb 6.0 active
mongodb 7.0 active

Root Cause

The secondary node's oplog window is insufficient to provide a consistent snapshot for queryable backup mode due to high write volume or slow replication.

generic

中文

由于高写入量或复制缓慢,从节点的oplog窗口不足以提供可查询备份模式所需的一致性快照。

Official Documentation

https://www.mongodb.com/docs/manual/tutorial/queryable-backup/

Workarounds

  1. 85% success Increase oplog size on all replica set members: `db.adminCommand({ replSetResizeOplog: 1, size: 20480 })` (20GB) to retain more history for queryable backup.
    Increase oplog size on all replica set members: `db.adminCommand({ replSetResizeOplog: 1, size: 20480 })` (20GB) to retain more history for queryable backup.
  2. 70% success Reduce write load on the primary during backup windows by throttling application writes or scheduling backups during off-peak hours.
    Reduce write load on the primary during backup windows by throttling application writes or scheduling backups during off-peak hours.
  3. 78% success Use `db.adminCommand({ setParameter: 1, queryableBackupModeSeconds: 600 })` to increase the allowed backup window from default 300 seconds to 600 seconds.
    Use `db.adminCommand({ setParameter: 1, queryableBackupModeSeconds: 600 })` to increase the allowed backup window from default 300 seconds to 600 seconds.

中文步骤

  1. Increase oplog size on all replica set members: `db.adminCommand({ replSetResizeOplog: 1, size: 20480 })` (20GB) to retain more history for queryable backup.
  2. Reduce write load on the primary during backup windows by throttling application writes or scheduling backups during off-peak hours.
  3. Use `db.adminCommand({ setParameter: 1, queryableBackupModeSeconds: 600 })` to increase the allowed backup window from default 300 seconds to 600 seconds.

Dead Ends

Common approaches that don't work:

  1. 85% fail

    Restarting clears the oplog cache but does not increase the oplog size or speed up catching up to the primary; lag may resume immediately.

  2. 75% fail

    Lowering write concern does not affect the total write load; it only changes acknowledgment behavior, potentially causing data loss in failover.

  3. 95% fail

    operationTime is a server-side logical clock; manual changes are rejected and can cause snapshot inconsistency.