summaryrefslogtreecommitdiff
path: root/lib/input
diff options
context:
space:
mode:
Diffstat (limited to 'lib/input')
-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