Skip to content

PBS-37 feature: Combine binlog_server with minimysql_server into a single executable (part 6) - #184

Merged
percona-ysorokin merged 1 commit into
Percona-Lab:mainfrom
percona-ysorokin:combined_binary_logger
Sep 17, 2026
Merged

percona-ysorokin merged 1 commit into
Percona-Lab:mainfrom
percona-ysorokin:combined_binary_logger

Conversation

@percona-ysorokin

@percona-ysorokin percona-ysorokin commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

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

Reworked 'binsrv::basic_logger' class to support multi-threading.
'binsrv::basic_logger' class now includes a mutex that serializes calls
to 'do_log()' method. Also, added new 'log_format()' method which
accepts variadic parameters identical to 'std::format()' for easier
message composition.

A number of calls to 'binsrv::basic_logger::log()' which were preceded
by manual log message composition changed to 'log_format()'.

'minimysql::network_service' class reworked to use
'binsrv::basic_logger' instead of direct prints to 'std::cout' /
'std::cerr'.

Added new no-op implementation of the 'binsrv::basic_logger' called
'binsrv::null_logger' that simply does nothing in 'do_print()' method.

Operations that were not involved in fetching events ('list',
'search_by_timestamp', 'search_by_gtid_set', and 'purge_binlogs') now
use an instance of this 'binsrv::null_logger' as a logger.

Fixed 'binlog_streaming.auth_method_switch' MTR test case as network
events are now logged into the same log file as the rest of PBS events.

Improved 'log_span_dump()' logger helper function - now it generates hex
dump strings only when the log level is set to 'trace'.

Improved 'generate_binsrv_config.inc' MTR include file - it is now
possible to specify the log level which will be set in the
'<logger.level>' configuration parameter. If not specified, the default
value 'trace' will be used.

As 'binlog_streaming.checkpointing' MTR test case operates with a big
number of binlog events, the log file generated by the binlog server
utility can become quite large and can cause really long execution time
under Valgrind. Fixed by reducing log level for this test case to
'info'.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation is coherent, with only minor log-message and documentation corrections remaining.

Pull request overview

Adds thread-safe centralized logging across storage, replication, and MiniMySQL networking.

Changes:

  • Serializes logger output and adds std::format-based logging.
  • Routes MiniMySQL diagnostics through basic_logger.
  • Adds null_logger for non-fetch storage operations.
File summaries
File Description
CMakeLists.txt Registers null_logger.
src/binsrv/basic_logger.cpp Serializes output calls.
src/binsrv/basic_logger.hpp Adds atomic levels and formatted logging.
src/binsrv/exception_handling_helpers.cpp Uses formatted exception logs.
src/binsrv/null_logger.hpp Adds no-op logger.
src/binsrv/storage.cpp Requires and directly uses a logger.
src/binsrv/storage.hpp Removes obsolete logging helper.
src/minimysql/connection_context.cpp Renames auth-switch parser.
src/minimysql/connection_context.hpp Exposes last sequence number.
src/minimysql/network_service.cpp Routes network diagnostics through logging.
src/minimysql/network_service.hpp Injects and retains a logger.
src/operations/collector_context.cpp Converts messages to formatted logging.
src/operations/list_operation.cpp Uses null_logger.
src/operations/logger_helpers.cpp Simplifies message formatting.
src/operations/pull_operation.cpp Shares logger with network service.
src/operations/purge_binlogs_operation.cpp Uses null_logger.
src/operations/search_by_gtid_set_operation.cpp Uses null_logger.
src/operations/search_by_timestamp_operation.cpp Uses null_logger.
Review details
  • Files reviewed: 18/18 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


class [[nodiscard]] null_logger final : public basic_logger {
public:
// 'delimiter' is the highest severity, so even message formatting is skipped
Comment thread src/minimysql/network_service.cpp Outdated
<< " max_packet_size : " << context.get_client_max_packet_size()
<< '\n';
logger.log_format(binsrv::log_severity::info,
"net : parsed client auth method switch {}",
@percona-ysorokin
percona-ysorokin force-pushed the combined_binary_logger branch 2 times, most recently from a6787f0 to adde08a Compare September 16, 2026 13:35
…ngle executable (part 6)

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

Reworked 'binsrv::basic_logger' class to support multi-threading.
'binsrv::basic_logger' class now includes a mutex that serializes calls
to 'do_log()' method. Also, added new 'log_format()' method which
accepts variadic parameters identical to 'std::format()' for easier
message composition.

A number of calls to 'binsrv::basic_logger::log()' which were preceded
by manual log message composition changed to 'log_format()'.

'minimysql::network_service' class reworked to use
'binsrv::basic_logger' instead of direct prints to 'std::cout' /
'std::cerr'.

Added new no-op implementation of the 'binsrv::basic_logger' called
'binsrv::null_logger' that simply does nothing in 'do_print()' method.

Operations that were not involved in fetching events ('list',
'search_by_timestamp', 'search_by_gtid_set', and 'purge_binlogs') now
use an instance of this 'binsrv::null_logger' as a logger.

Fixed 'binlog_streaming.auth_method_switch' MTR test case as network
events are now logged into the same log file as the rest of PBS events.

Improved 'log_span_dump()' logger helper function - now it generates hex
dump strings only when the log level is set to 'trace'.

Improved 'generate_binsrv_config.inc' MTR include file - it is now
possible to specify the log level which will be set in the
'<logger.level>' configuration parameter. If not specified, the default
value 'trace' will be used.

As 'binlog_streaming.checkpointing' MTR test case operates with a big
number of binlog events, the log file generated by the binlog server
utility can become quite large and can cause really long execution time
under Valgrind. Fixed by reducing log level for this test case to
'info'.
@percona-ysorokin
percona-ysorokin merged commit 5299fce into Percona-Lab:main Sep 17, 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