From a3cc6707b40a894ab75a4488e9b6027fc9709e1f Mon Sep 17 00:00:00 2001 From: TCeason Date: Sun, 17 Jan 2021 12:41:59 +0800 Subject: [PATCH] add MySQL Var check add MySQL var check: log_bin_use_v1_row_events=OFF --- src/Core/MySQL/MySQLGtid.cpp | 6 +++--- src/Core/MySQL/MySQLGtid.h | 2 +- src/Core/tests/mysql_protocol.cpp | 4 ++-- src/Databases/MySQL/MaterializeMySQLSyncThread.cpp | 8 +++++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Core/MySQL/MySQLGtid.cpp b/src/Core/MySQL/MySQLGtid.cpp index aac3e01369a..13dc6e0fd69 100644 --- a/src/Core/MySQL/MySQLGtid.cpp +++ b/src/Core/MySQL/MySQLGtid.cpp @@ -85,8 +85,8 @@ void GTIDSets::update(const GTID & other) ErrorCodes::LOGICAL_ERROR); } - /// Try to shirnk Sequence interval. - GTIDSet::tryShirnk(set, i, current); + /// Try to shrink Sequence interval. + GTIDSet::tryShrink(set, i, current); /// Sequence, extend the interval. if (other.seq_no == current.end) @@ -119,7 +119,7 @@ void GTIDSets::update(const GTID & other) sets.emplace_back(set); } -void GTIDSet::tryShirnk(GTIDSet & set, unsigned int i, GTIDSet::Interval & current) +void GTIDSet::tryShrink(GTIDSet & set, unsigned int i, GTIDSet::Interval & current) { if (i != set.intervals.size() -1) { diff --git a/src/Core/MySQL/MySQLGtid.h b/src/Core/MySQL/MySQLGtid.h index 27aabdafc11..c8a571d2569 100644 --- a/src/Core/MySQL/MySQLGtid.h +++ b/src/Core/MySQL/MySQLGtid.h @@ -27,7 +27,7 @@ public: void tryMerge(size_t i); - static void tryShirnk(GTIDSet & set, unsigned int i, Interval & current); + static void tryShrink(GTIDSet & set, unsigned int i, Interval & current); }; class GTIDSets diff --git a/src/Core/tests/mysql_protocol.cpp b/src/Core/tests/mysql_protocol.cpp index 98555ddcfe0..1b81d856c9a 100644 --- a/src/Core/tests/mysql_protocol.cpp +++ b/src/Core/tests/mysql_protocol.cpp @@ -262,12 +262,12 @@ int main(int argc, char ** argv) "20662d71-9d91-11ea-bbc2-0242ac110003:9", "10662d71-9d91-11ea-bbc2-0242ac110003:6-7,20662d71-9d91-11ea-bbc2-0242ac110003:9"}, - {"shirnk-sequence", + {"shrink-sequence", "10662d71-9d91-11ea-bbc2-0242ac110003:1-3:4-5:7", "10662d71-9d91-11ea-bbc2-0242ac110003:6", "10662d71-9d91-11ea-bbc2-0242ac110003:1-7"}, - {"shirnk-sequence", + {"shrink-sequence", "10662d71-9d91-11ea-bbc2-0242ac110003:1-3:4-5:10", "10662d71-9d91-11ea-bbc2-0242ac110003:8", "10662d71-9d91-11ea-bbc2-0242ac110003:1-5:8:10" diff --git a/src/Databases/MySQL/MaterializeMySQLSyncThread.cpp b/src/Databases/MySQL/MaterializeMySQLSyncThread.cpp index 1da033fa4b3..9f4de9ea35a 100644 --- a/src/Databases/MySQL/MaterializeMySQLSyncThread.cpp +++ b/src/Databases/MySQL/MaterializeMySQLSyncThread.cpp @@ -95,18 +95,20 @@ static void checkMySQLVariables(const mysqlxx::Pool::Entry & connection) "(Variable_name = 'log_bin' AND upper(Value) = 'ON') " "OR (Variable_name = 'binlog_format' AND upper(Value) = 'ROW') " "OR (Variable_name = 'binlog_row_image' AND upper(Value) = 'FULL') " - "OR (Variable_name = 'default_authentication_plugin' AND upper(Value) = 'MYSQL_NATIVE_PASSWORD');"; + "OR (Variable_name = 'default_authentication_plugin' AND upper(Value) = 'MYSQL_NATIVE_PASSWORD') " + "OR (Variable_name = 'log_bin_use_v1_row_events' AND upper(Value) = 'OFF');"; MySQLBlockInputStream variables_input(connection, check_query, variables_header, DEFAULT_BLOCK_SIZE, false, true); Block variables_block = variables_input.read(); - if (!variables_block || variables_block.rows() != 4) + if (!variables_block || variables_block.rows() != 5) { std::unordered_map variables_error_message{ {"log_bin", "log_bin = 'ON'"}, {"binlog_format", "binlog_format='ROW'"}, {"binlog_row_image", "binlog_row_image='FULL'"}, - {"default_authentication_plugin", "default_authentication_plugin='mysql_native_password'"} + {"default_authentication_plugin", "default_authentication_plugin='mysql_native_password'"}, + {"log_bin_use_v1_row_events", "log_bin_use_v1_row_events='OFF'"} }; ColumnPtr variable_name_column = variables_block.getByName("Variable_name").column;