Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/perfect-plums-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-module-mysql': patch
---

Resolved excessive memory consumption during MySQL initial replication.
8 changes: 6 additions & 2 deletions modules/module-mysql/src/replication/BinLogStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,16 @@ AND table_type = 'BASE TABLE';`,
columns = toColumnDescriptors(fields);
});

for await (let row of query.stream()) {
for await (let row of stream) {
if (this.stopped) {
throw new Error('Abort signal received - initial replication interrupted.');
}

if (columns == null) {
throw new Error(`No 'fields' event emitted`);
}
const record = common.toSQLiteRow(row, columns!);

const record = common.toSQLiteRow(row, columns!);
await batch.save({
tag: storage.SaveOperationTag.INSERT,
sourceTable: table,
Expand Down
Loading