Skip to content

[MySQL] Extend replication keep alive mechanism. #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 73 commits into from
Aug 12, 2025

Conversation

Rentacookie
Copy link
Contributor

@Rentacookie Rentacookie commented Jul 30, 2025

When the source MySQL database is idle for long periods of time, write checkpoints in powersync can be sparse.

We use hearbeat events on the BinLog to keep the replication connection alive. But now we also latch onto these events to update the keep alive timestamp on the sync rules.

…kage directly

Added check for tablemap events
…tener class.

Introduced a mechanism to limit the maximum size of the binlog processing queue, thus also limiting memory usage.
This maximum processing queue size is configurable
# Conflicts:
#	modules/module-mysql/package.json
Cleaned up BinLogStream logs a bit
Simplified BinLogListener stopping mechanism
Added a few more defensive stopped checks to the binlog listener
… memory usage rather than number of events.

Introduced a maximum timeout that the binlog processing queue can be paused before auto-resuming. This is to prevent the replication connection timing out.
Made SourceTable implement SourceEntityDescriptor interface
…trics instead of ignoring them. SourceTable.

Moved MySQL table detail retrieval logic to utility function.
# Conflicts:
#	modules/module-mongodb-storage/src/storage/implementation/MongoBucketBatch.ts
#	modules/module-mongodb-storage/src/storage/implementation/MongoSyncBucketStorage.ts
#	modules/module-mongodb/src/replication/ChangeStream.ts
#	modules/module-mysql/package.json
#	modules/module-mysql/src/replication/BinLogStream.ts
#	modules/module-mysql/src/replication/zongji/BinLogListener.ts
#	modules/module-mysql/src/replication/zongji/zongji-utils.ts
#	modules/module-mysql/test/src/BinLogListener.test.ts
#	modules/module-postgres-storage/src/storage/PostgresSyncRulesStorage.ts
#	modules/module-postgres/src/replication/WalStream.ts
#	packages/service-core/src/storage/SourceTable.ts
#	pnpm-lock.yaml
Improved binlog table filtering
Added extended type definitions for node-sql-parser package
Cleaned up MySQL tests in general and added a few new test utils
Copy link

changeset-bot bot commented Jul 30, 2025

🦋 Changeset detected

Latest commit: 45306b8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@powersync/service-module-mysql Minor
@powersync/service-module-postgres-storage Patch
@powersync/service-module-mongodb-storage Patch
@powersync/service-core Patch
@powersync/service-schema Patch
@powersync/service-image Patch
@powersync/service-module-mongodb Patch
@powersync/service-module-postgres Patch
@powersync/service-core-tests Patch
@powersync/service-module-core Patch
test-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Rentacookie Rentacookie changed the title Mysql replication keepalive mechanism [MySQL] Add replication keep alive Jul 30, 2025
@Rentacookie Rentacookie requested a review from rkistner July 30, 2025 09:21
@Rentacookie Rentacookie changed the title [MySQL] Add replication keep alive Proposal: [MySQL] Add replication keep alive. Jul 30, 2025
@Rentacookie Rentacookie changed the title Proposal: [MySQL] Add replication keep alive. [MySQL] Extend replication keep alive mechanism. Aug 6, 2025
@Rentacookie Rentacookie marked this pull request as ready for review August 6, 2025 12:32
Copy link
Contributor

@rkistner rkistner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@Rentacookie Rentacookie merged commit d49bebe into main Aug 12, 2025
21 checks passed
@Rentacookie Rentacookie deleted the mysql-replication-keepalive-mechanism branch August 12, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants