hi, I am exporting from MongoDB into Snowflake - e...
# replication-troubleshooting
a
hi, I am exporting from MongoDB into Snowflake - everything works fine for smaller tables. I have some tables that are a bit too big in MongoDB and I am worried they will take like 2 days to copy over by which point the MongoDB oplog will have expired and incremental syncing would fail. Is that what will happen if initial sync takes longer than oplog window or does Airbyte handle this gracefully? If not, what can I do to deal with it?
k
You’re right to be concerned: if the initial MongoDB → Snowflake sync takes longer than the MongoDB oplog/change-stream retention window, you can lose the resume token and Airbyte will fail CDC / incremental sync with errors like “invalid resume token” or “saved offset is not valid,” and you’ll need to re-import the collection. [[MongoDB v2 limits](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations)] The docs and linked GitHub issue make a few key points: - MongoDB change streams are backed by the replica set oplog and inherit its retention limits. [[MongoDB v2 limits](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations)] - Syncs that run less frequently than the oplog retention window (or, effectively, take longer than that window before capturing a new resume position) may hit missing-data / invalid-resume-token issues. [[MongoDB v2 limits](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations)] - For large initial imports, if the import duration exceeds oplog retention, an invalid resume token will force you to re-import the collection to avoid missed changes. [[MongoDB v2 limits](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations)] - A contributor confirmed that if the LSN/resume position doesn’t advance before the oplog recycles, the next sync can fail and that you must have at least one successful sync within the retention window. [[GitHub issue 62833](https://github.com/airbytehq/airbyte/issues/62833)] So Airbyte does not “gracefully” bypass this limitation; it depends on the oplog being long enough for the initial snapshot plus CDC catch‑up. ### What you can do Based on the docs and issues, your options are: 1. Increase MongoDB oplog size / retention window - Recommended to hold at least 24 hours of changes; ideally up to a week. [[MongoDB v2 limits](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations)] - This is the primary mitigation when importing large collections. 2. Increase Airbyte sync frequency - Ensure at least one successful sync that reads and advances the resume token within the retention window. [[GitHub issue 62833](https://github.com/airbytehq/airbyte/issues/62833)] - General CDC best practice is that sync frequency must be shorter than the WAL/oplog retention period so you don’t lose the position. [[CDC config](https://docs.airbyte.com/platform/understanding-airbyte/cdc-best-practices#general-airbyte-configuration)] 3. Reduce initial-load volume per sync The docs don’t prescribe a specific tactic for MongoDB here, but patterns in other threads suggest: - Split data into multiple collections or views and sync them separately, so each initial load is smaller (similar to strategies discussed for other large CDC sources). [[Forum huge tables](https://discuss.airbyte.io/t/3783)] - For non‑CDC connectors, you can also use incremental sync with an appropriate cursor and time window to avoid massive full loads, but MongoDB v2’s CDC behavior is tied to snapshot + oplog as documented. [[MongoDB v2](https://docs.airbyte.com/integrations/sources/mongodb-v2); [Incremental sync concept](https://docs.airbyte.com/platform/1.6/connector-development/connector-builder-ui/incremental-sync)] 4. Plan for possible re-import - If the initial import does run longer than the oplog retention, the docs explicitly say you may need to re-import the collection when the resume token becomes invalid. [[MongoDB v2 limits](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations)] If you can, first test one of the “big” collections in a lower environment and measure how long the initial sync takes; then ensure your oplog retention comfortably exceeds that duration plus some buffer.