summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-07-31 19:58:52 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-07-31 19:58:52 +0100
commitc5c48d2895eac6210e8bc914646b89e2ceb02190 (patch)
treee3d740954d5ec7089be07b8e1ff402bf4d5fff2e /lib
parentUnlocking an unlocked mutex trips tsan (diff)
downloadmygrate-c5c48d2895eac6210e8bc914646b89e2ceb02190.tar.bz2
mygrate-c5c48d2895eac6210e8bc914646b89e2ceb02190.tar.xz
mygrate-c5c48d2895eac6210e8bc914646b89e2ceb02190.zip
Verify that server binlog-format is row
Diffstat (limited to 'lib')
-rw-r--r--lib/input/replStream.cpp7
-rw-r--r--lib/input/sql/selectBinLogFormat.sql1
2 files changed, 8 insertions, 0 deletions
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 <eventHandlerBase.h>
#include <eventHandlers.h>
#include <helpers.h>
+#include <input/sql/selectBinLogFormat.h>
#include <memory>
#include <stdexcept>
#include <utility>
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<ConfigError>((**input::sql::selectBinLogFormat::execute(this)).get<std::string_view>() == "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