Skip to content

PBS-53: Support for blocking mode for COM_BINLOG_DUMP - #199

Merged
kamil-holubicki merged 3 commits into
Percona-Lab:mainfrom
kamil-holubicki:PBS-53
Oct 6, 2026
Merged

kamil-holubicki merged 3 commits into
Percona-Lab:mainfrom
kamil-holubicki:PBS-53

Conversation

@kamil-holubicki

Copy link
Copy Markdown
Contributor

No description provided.

https://perconadev.atlassian.net/browse/PBS-53

When the client's COM_BINLOG_DUMP packet does not carry the
BINLOG_DUMP_NON_BLOCK flag, the server now waits for new events to
appear instead of disconnecting after serving the last available
event. The current implementation uses a simple polling loop with a
hardcoded 500 ms interval.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@percona-ysorokin percona-ysorokin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM with one minor MTR comment

--echo *** must keep the connection open and deliver events as they become
--echo *** available instead of disconnecting on EOF.
--let $downstream1_dump = $MYSQL_TMP_DIR/rs_blocking_dump_1.sql
--let $proc_command_line = $MYSQL_BINLOG --read-from-remote-server --stop-never --host=127.0.0.1 --port=$binsrv_replication_source_port --user=rpl --password=password --default-auth=caching_sha2_password $first_binlog > $downstream1_dump 2>/dev/null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
--let $proc_command_line = $MYSQL_BINLOG --read-from-remote-server --stop-never --host=127.0.0.1 --port=$binsrv_replication_source_port --user=rpl --password=password --default-auth=caching_sha2_password $first_binlog > $downstream1_dump 2>/dev/null
--let $proc_command_line = $MYSQL_BINLOG --read-from-remote-server --stop-never --host=127.0.0.1 --port=$binsrv_replication_source_port --user=$binsrv_auth_user --password=$binsrv_auth_password --default-auth=caching_sha2_password $first_binlog > $downstream1_dump 2>/dev/null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

--echo *** that two concurrent blocking COM_BINLOG_DUMP sessions are
--echo *** exercised at the same time.
--let $downstream2_dump = $MYSQL_TMP_DIR/rs_blocking_dump_2.sql
--let $proc_command_line = $MYSQL_BINLOG --read-from-remote-server --stop-never --host=127.0.0.1 --port=$binsrv_replication_source_port --user=rpl --password=password --default-auth=caching_sha2_password $first_binlog > $downstream2_dump 2>/dev/null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
--let $proc_command_line = $MYSQL_BINLOG --read-from-remote-server --stop-never --host=127.0.0.1 --port=$binsrv_replication_source_port --user=rpl --password=password --default-auth=caching_sha2_password $first_binlog > $downstream2_dump 2>/dev/null
--let $proc_command_line = $MYSQL_BINLOG --read-from-remote-server --stop-never --host=127.0.0.1 --port=$binsrv_replication_source_port --user=$binsrv_auth_user --password=$binsrv_auth_password --default-auth=caching_sha2_password $first_binlog > $downstream2_dump 2>/dev/null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

kamil-holubicki and others added 2 commits October 6, 2026 08:49
https://perconadev.atlassian.net/browse/PBS-53

Introduced 'binlog_streaming.rs_blocking_dump' which verifies that PBS
keeps a COM_BINLOG_DUMP connection open and delivers newly produced
events to downstream clients when the request does not carry the
BINLOG_DUMP_NON_BLOCK flag.

Flow:
* Start 'binlog_server pull' in background with a 1-second checkpoint
  interval so small test transactions flush to storage quickly.
* Spawn two concurrent 'mysqlbinlog --read-from-remote-server
  --stop-never' sessions against PBS. '--stop-never' clears
  BINLOG_DUMP_NON_BLOCK, so PBS must enter the blocking path.
* Execute a first batch of transactions on the source and wait for the
  resulting DDL to appear in both downstream output files.
* Sleep for 3 seconds with the source quiet to exercise the per-session
  idle-polling loop.
* Execute a second batch and wait for its DDL to appear in both
  downstream output files. Without blocking-mode support, the sessions
  would have been closed on EOF after the first batch and the second
  wait would time out, failing the test.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…exity

https://perconadev.atlassian.net/browse/PBS-53

The blocking-mode branches added to the 'binlog_dump' case in
'minimysql::session()' pushed the function over clang-tidy's
'readability-function-cognitive-complexity' threshold (30 vs 25) and
broke the Clang 20 CI jobs.

Moved the body of the 'binlog_dump' case into a new free coroutine
'handle_binlog_dump_command()' in the anonymous namespace. The case
body now reduces to one 'co_await' plus setting 'terminated = true',
which brings 'session()' back under the limit. Behavior is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@kamil-holubicki
kamil-holubicki merged commit ddafb06 into Percona-Lab:main Oct 6, 2026
8 checks passed
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