<@U04S8PLJWMT> hello bro, another day another airb...
# ask-ai
h
@kapa.ai hello bro, another day another airbyte issue → so one of our connection is mongodb connection which has CDC enabled with resync data + capture mode as lookup. The issue is every night one of the table gets written and its size is around 64gb in the source. we don’t pull this table into the waehouse using airbyte. but still the airbyte logs show pulling op logs for around 45 mins and moving aournd 70 gb from our infra but in reality only 30 mb of data gets written to the wahouse. the table that we sync is migrants, and the catalog table name is migrants_catalog_green. Can you tell me why this might be happening ?
k
Thinking completed Hey! This is a well-known issue with the MongoDB CDC connector, and the knowledge sources explain exactly what's happening here. Why Airbyte is scanning ~70 GB for only 30 MB of actual data The root cause is how Debezium (the CDC engine used by the MongoDB connector) builds its change stream pipeline. By default, it uses
filters.match.mode=regex
, which produces a pipeline like this:
Copy code
[{$replaceRoot: {newRoot: {namespace: {$concat: ["$ns.db", ".", "$ns.coll"]}, event: "$$ROOT"}}},
 {$match: {namespace: {$regularExpression: {...}}, ...}}, ...]
Because the
$match
is on a computed field (
namespace
), MongoDB cannot push the collection filter down into the oplog scan. This means: • Every oplog entry for the entire database is materialized as a full change event — including
updateLookup
— before being discarded. • Your 64 GB write-heavy table (the one you're not syncing) is generating massive oplog traffic every night. • Airbyte's connector has to read and discard all of those events just to find the small amount of data relevant to
migrants_catalog_green
. That's why you see ~70 GB of data moving out of your infra over 45 minutes, but only ~30 MB landing in the warehouse. [GitHub PR #87574] What's the fix? There are two paths: 1. Upgrade to MongoDB Source 3.0.0 (recommended) MongoDB source 3.0.0 is a full rewrite on Airbyte's Bulk CDK that reads change streams using the native MongoDB driver instead of Debezium. This eliminates the oplog COLLSCAN problem entirely. [GitHub Issue #80250] 2. If you're on an older version PR #87574 (targeting connector version 2.1.2) fixes this by switching to
filters.match.mode=literal
, which produces a plain
$match
on
ns
that MongoDB can push into the oplog scan — throughput reportedly went from ~9k to ~137k oplog entries/s in testing. [GitHub PR #87574] TL;DR Your 64 GB nightly-write table is not synced, but because it lives in the same database, the connector is forced to read and discard all its oplog events before it can find the records for
migrants_catalog_green
. Upgrading to MongoDB source 3.0.0 is the cleanest fix. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
h
@kapa.ai which is better 1st or 2nd . what is meant by the throughput went from 9k to 137k ?
k
Thinking completed Which is better: 1st or 2nd? Option 1 (upgrade to 3.0.0) is the better choice. • 3.0.0 reads change streams with the native MongoDB driver instead of Debezium, so the regex filter problem goes away. [Issue #80250] • The resume token is now checkpointed from the last change event or the change stream's post-batch token, so it keeps moving forward even when no events match your selected collections. [Issue #80250] • Most connections upgrade in place with no clear or refresh. [Migration guide] Option 2 (PR #87574) is still marked open in the sources, so I can't confirm it has been released. It is a patch on the old Debezium-based connector, and it only changes the filter mode. Before upgrading, check the migration guide. Action is needed if you sync views or time series collections, or if Schema Enforced is on and you have boolean fields. Also, the "Capture mode" setting is removed in 3.0.0. Updates always read the document's current state, which is the same as your "Lookup" setting, so that part shouldn't change for you. [Migration guide] > Note: the Docker image name changed from
airbyte/source-mongodb-v2
to
airbyte/source-mongodb
. If you use a mirrored registry or image allowlist, add the new name first. What does "throughput went from 9k to 137k" mean? It is the number of oplog entries MongoDB can process per second when running the change stream pipeline. The PR author measured this on a secondary node, over the same oplog segment, with `fullDocument: updateLookup`: In plain terms, with the regex filter MongoDB had to build a full change event for every oplog entry before discarding the unwanted ones, so it worked through only ~9,000 entries per second. With the literal filter, MongoDB discards non-matching entries early in the oplog scan, so it handled ~137,000 per second, roughly 15x faster. [PR #87574] For your case, a nightly burst on the large unsynced collection should then be skipped much faster, instead of taking ~45 minutes. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help., with interactive elements
h
@kapa.ai but this only speeds up the process right, still it will download ? or it will reject the othe rtable with huge data.
k
Thinking completed Good question. Short answer: the filtering happens on the MongoDB server, so the unsynced table's events are mostly not sent to Airbyte. It's not just a speed-up on Airbyte's side. What the knowledge sources say • Old behavior (regex mode): MongoDB couldn't push the collection filter into the oplog scan. It built a full change event for every entry in the database (including
updateLookup
) before discarding the ones you don't sync. [PR #87574] • With the literal filter (PR #87574): MongoDB applies the
$match
during the oplog scan, so non-matching entries are discarded before any transformation or lookup. The PR describes this as "Change stream batches are filtered server-side." [PR #87574] So the unsynced table's changes are rejected by MongoDB itself, rather than being downloaded and then dropped by the connector. Caveats • MongoDB still has to scan the oplog on its side, so some server-side work remains. That's why the improvement is reported as ~9k → ~137k entries/s rather than zero cost. [PR #87574] • That PR is still open, so I can't confirm it's released. • For 3.0.0, the sources say it uses the native driver with
db.watch()
for one database, or
client.watch()
plus a
$match
on
ns.db
for several. They don't explicitly say how the collection-level filter is applied, so I can't confirm it avoids all transfer of the unsynced table's events. [PR #88383] If you upgrade to 3.0.0, I'd compare the sync logs and network transfer after the nightly write to confirm the ~70 GB drops. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
h
@kapa.ai here, so my workspace only shows two mongodb connectors and the new verison 3.0.2 is a new mongodb connector which is not being shown here. how to show it ? is it in a new airbyte version ?
k
Thinking completed The knowledge sources don't say whether 3.0.2 requires a newer Airbyte platform version, so I can't confirm that. Here is what they do show. What your screenshot shows Your existing connector is
airbyte/source-mongodb-v2
at version 2.0.4, with "Update available: 3.0.2". So 3.0.x is not a separate new connector. It is an upgrade to the same MongoDB source you already have, which is why no extra connector appears in the list. The 3.0.0 PR confirms this: it keeps the same
definitionId
and replaces the Debezium connector in place, so existing connections upgrade without a reset. [PR #88383] One discrepancy: the migration guide says the Docker image was renamed to
airbyte/source-mongodb
, while the PR description says the image name stays the same. Your screenshot still shows
-v2
, so I can't tell which one applies to 3.0.2. How to upgrade 1. Go to Workspace settings > Sources. On Self-Managed Enterprise, use Organization settings > Sources. 2. Find the MongoDB connector. If you self-manage Airbyte, you may first need to click Change to update the connector image to the latest available version. 3. Select the connector instance, click Upgrade, and confirm. [Upgrade guide] Before upgrading • Major version bumps are never automatic, so you must upgrade manually. • If you use a mirrored registry or image allowlist, add
airbyte/source-mongodb
first. [Migration guide] • Check the migration guide for views, time series collections, and boolean fields with Schema Enforced on. If the Upgrade button doesn't work, or the new image isn't available in your registry, the sources don't say whether a platform upgrade is needed. In that case, check your Airbyte version's release notes or ask in Airbyte support. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
h
@kapa.ai we use our self hosted airbyte version 1.8.3 . when i iam upgrading the connector that’s there in the screen shot i am getting the error → Warning Failed 95s (x5 over 4m20s) kubelet spec.containers{main}: Failed to pull image “024209611402.dkr.ecr.ap-south-1.amazonaws.com/docker-hub/airbyte/source-mongodb-v2:3.0.2”: rpc error: code = NotFound desc = failed to pull and unpack image “024209611402.dkr.ecr.ap-south-1.amazonaws.com/docker-hub/airbyte/source-mongodb-v2:3.0.2”: failed to resolve reference “024209611402.dkr.ecr.ap-south-1.amazonaws.com/docker-hub/airbyte/source-mongodb-v2:3.0.2”: 024209611402.dkr.ecr.ap-south-1.amazonaws.com/docker-hub/airbyte/source-mongodb-v2:3.0.2: not found
k
Thinking completed The error is most likely caused by the image rename in 3.0.0, and it also resolves the discrepancy I flagged earlier. What's happening Your cluster is trying to pull
.../docker-hub/airbyte/source-mongodb-v2:3.0.2
, and your ECR repository doesn't have that tag. Per the 3.0.0 PR, the Docker image was renamed from
airbyte/source-mongodb-v2
to
airbyte/source-mongodb
. [PR #89773] Pinned 2.x users keep running
airbyte/source-mongodb-v2
until they unpin, so 3.x tags are published under the new name. [PR #89773] Your setup also uses an ECR pull-through or mirror (
docker-hub/...
). The migration guide says Self-Managed users with a mirrored registry or image allowlist must add
airbyte/source-mongodb
before upgrading. [Migration guide] What to check 1. Confirm that
airbyte/source-mongodb:3.0.2
exists on Docker Hub and in your ECR mirror (for example under
docker-hub/airbyte/source-mongodb
). If your ECR mirror doesn't allow this repository, add it to the allowlist or pull-through rules. 2. Check that the mirror can reach and fetch the new image name. 3. Retry the upgrade after the new image is available. Caveats • The knowledge sources don't explain why your Airbyte 1.8.3 instance is requesting
source-mongodb-v2:3.0.2
rather than the renamed image. It may be that the connector registry entry your instance sees still points to the old name, or it may be a different cause. I can't confirm either from the sources. • They also don't state whether Airbyte 1.8.3 is compatible with 3.0.x. • Also, per the PR, a Docker Hub
airbyte/source-mongodb
repo already exists with legacy
0.3.x
tags, and 3.x tags don't collide with them. [PR #89773] If the image is present in ECR under the new name and the error persists, I'd suggest sharing the connector definition's image name from your instance (Settings > Sources) or asking in Airbyte support. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.