support filtering out deletion operation types for mongo#4585
Conversation
4c561d9 to
9713f30
Compare
9713f30 to
4204ede
Compare
| // Unlike Postgres, MongoDB doesn't need a dedicated replication connection: | ||
| // change streams are cursors served by the connector's pooled client. | ||
| // Since SetupReplConn is called once per SyncFlow activity, resolving | ||
| // dynamic config here avoids per-batch catalog reads. |
There was a problem hiding this comment.
Also evaluated populating this in the mongo connector itself similar to Postgres, but this is a more logical place for it despite the SetupReplConn naming is a bit misleading. Not all mongo connectors instantiated need to worry about operation type exclusion, in fact only cdc does. So populating excludedOps here feels like the more natural placement. Although I can be persuaded otherwise.
I think we have a few other cdc-related settings that are being fetched every batch today (when we expect them to be fetched every SyncFlow and only update on pause/resume), so they behave more like APPLY_MODE_IMMEDIATE even though they are labeled APPLY_MODE_AFTER_RESUME, resulting in a lot of db calls that could be avoided. So one of the follow-up would be to identify these dynconf and move them here as well.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
| // which dynLookup checks before the service-level dynamic_settings catalog value. | ||
| const pipeLevelSettings: { name: string; sourceTypes: DBType[] }[] = [ | ||
| { | ||
| name: 'PEERDB_MONGODB_EXCLUDED_OPERATION_TYPES', |
There was a problem hiding this comment.
Can we expose the setting with a more user-friendly name in the UI vs. the raw setting name? In a similar direction, "Setting Overrides" bleeds implementation details; if we expose it as a configurable setting, it should be implied it's a safe override. Maybe "Replication Settings" would be more appropriate and future-proof, with a helper text like "Changes apply to this mirror only and take precedence over global defaults"?
There was a problem hiding this comment.
ah yeah, that's a good idea for the pipe-level setting override.
There was a problem hiding this comment.
We already have a system for overriding settings on the mirror level, some of our OSS customers are using that for the multi-tenancy setup. The UI is even clunkier (text box accepting raw JSON) but there is a precedent and if we're introducing support in editing, those probably should be unified (at some UX level).
peerdb/ui/app/mirrors/create/helpers/cdc.ts
Lines 227 to 238 in 58babbd
| TargetForSetting: protos.DynconfTarget_ALL, | ||
| }, | ||
| { | ||
| Name: "PEERDB_MONGODB_EXCLUDED_OPERATION_TYPES", |
There was a problem hiding this comment.
Since the set of options is bound and known, should this be a multi-select field instead to reduce the risk of typos? Not sure if we have building blocks for this in the UI components, so a comma-separated list is fine to start; just wanted to flag.
There was a problem hiding this comment.
For global settings tab, this isn't super trivial to change; but for the pipe-level configs we can build something more user-friendly and translate it to env var on our end
pfcoperez
left a comment
There was a problem hiding this comment.
LGTM, conditioned on the log message change and on the confirmation that dups are inconsequential.
This reverts commit 3b4c4f5.
|
Removed the UI component for now, will address as a follow-up. In the mean time the env can be updated via flow-api: |
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |

Allow filtering out operations by type. This is already possible today with Postgres publications. Here we extend this feature to MongoDB by filtering out operations in the pipeline definition. This allows data to be filtered out on the server-side.
Adding a UI component in Edit Mirror page that supports updating the setting for a mirror (vs. the
settingstab, that would update the setting for all pipes). If both are set, pipe-level setting will take precedence. Here we introduce a source-type-specific allowlist so the settings override shows up for applicable pipes (in this case, only Mongo pipe will display this option). Note that theCDCFlowConfigUpdatefield inFlowStateChangeRequestalready supports updatedEnv today, so this PR just surfaces it to the UI.Test: added uinit/e2e tests; also verified locally e2e that pipeline filtering works as expected and can be modified dynamically on pause/resume.
Fixes: DBI-922