Skip to content

Commit 5c42854

Browse files
committed
Add comments on the performance issue.
1 parent 40c08c3 commit 5c42854

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

modules/module-mongodb/src/replication/ChangeStream.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,17 @@ export class ChangeStream {
442442
});
443443
}
444444
}
445+
446+
// When we have a large number of collections, the performance of the pipeline
447+
// depends a lot on how the filters here are specified.
448+
// Currently, only the multipleDatabases == false case is optimized, and the
449+
// wildcard matching version is not tested (but we assume that will be more
450+
// limited in the number of them).
451+
// Specifically, the `ns: {$in: [...]}` version can lead to PSYNC_S1345 timeouts in
452+
// some cases when we have a large number of collections.
453+
// For details, see:
454+
// https://github.com/powersync-ja/powersync-service/pull/417
455+
// https://jira.mongodb.org/browse/SERVER-114532
445456
const nsFilter = multipleDatabases
446457
? // cluster-level: filter on the entire namespace
447458
{ ns: { $in: $inFilters } }

0 commit comments

Comments
 (0)