From c5c48d2895eac6210e8bc914646b89e2ceb02190 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 31 Jul 2021 19:58:52 +0100 Subject: Verify that server binlog-format is row --- lib/input/replStream.cpp | 7 +++++++ lib/input/sql/selectBinLogFormat.sql | 1 + 2 files changed, 8 insertions(+) create mode 100644 lib/input/sql/selectBinLogFormat.sql (limited to 'lib') diff --git a/lib/input/replStream.cpp b/lib/input/replStream.cpp index f7452e7..d04e16b 100644 --- a/lib/input/replStream.cpp +++ b/lib/input/replStream.cpp @@ -4,11 +4,16 @@ #include #include #include +#include #include #include #include namespace MyGrate::Input { + class ConfigError : public std::runtime_error { + using std::runtime_error::runtime_error; + }; + ReplicationStream::ReplicationStream(const std::string & host, const std::string & user, const std::string & pass, unsigned short port, uint64_t sid, std::string fn, uint64_t pos) : MySQLConn {host.c_str(), user.c_str(), pass.c_str(), port}, @@ -16,6 +21,8 @@ namespace MyGrate::Input { { query("SET @mariadb_slave_capability = 4"); query("SET @master_binlog_checksum = @@global.binlog_checksum"); + verify((**input::sql::selectBinLogFormat::execute(this)).get() == "ROW", + "@@binlog_format must be 'ROW'"); } void diff --git a/lib/input/sql/selectBinLogFormat.sql b/lib/input/sql/selectBinLogFormat.sql new file mode 100644 index 0000000..da0a791 --- /dev/null +++ b/lib/input/sql/selectBinLogFormat.sql @@ -0,0 +1 @@ +SELECT @@binlog_format -- cgit v1.2.3