From 3ed519ff05fe6e5f6e1970194ed5510812c253b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sat, 21 Mar 2015 20:43:24 +0200 Subject: [PATCH] [MDEV-6877] Added binlog_row_image system variable The system variable is present but it does not do anything yet. --- sql/sql_class.h | 11 +++++++++++ sql/sys_vars.cc | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/sql/sql_class.h b/sql/sql_class.h index 37b1dd9d43d..fabba30eb8d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -96,6 +96,16 @@ enum enum_mark_columns { MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE}; enum enum_filetype { FILETYPE_CSV, FILETYPE_XML }; +enum enum_binlog_row_image { + /** PKE in the before image and changed columns in the after image */ + BINLOG_ROW_IMAGE_MINIMAL= 0, + /** Whenever possible, before and after image contain all columns except blobs. */ + BINLOG_ROW_IMAGE_NOBLOB= 1, + /** All columns in both before and after image. */ + BINLOG_ROW_IMAGE_FULL= 2 +}; + + /* Bits for different SQL modes modes (including ANSI mode) */ #define MODE_REAL_AS_FLOAT (1ULL << 0) #define MODE_PIPES_AS_CONCAT (1ULL << 1) @@ -588,6 +598,7 @@ typedef struct system_variables /* Flags for slow log filtering */ ulong log_slow_rate_limit; ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format) + ulong binlog_row_image; ulong progress_report_time; ulong completion_type; ulong query_cache_type; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 889a88db98b..7a7b9d1c87e 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5200,6 +5200,22 @@ static Sys_var_mybool Sys_encrypt_tmp_files( READ_ONLY GLOBAL_VAR(encrypt_tmp_files), CMD_LINE(OPT_ARG), DEFAULT(TRUE)); +static const char *binlog_row_image_names[]= {"MINIMAL", "NOBLOB", "FULL", NullS}; +static Sys_var_enum Sys_binlog_row_image( + "binlog_row_image", + "Controls whether rows should be logged in 'FULL', 'NOBLOB' or " + "'MINIMAL' formats. 'FULL', means that all columns in the before " + "and after image are logged. 'NOBLOB', means that mysqld avoids logging " + "blob columns whenever possible (eg, blob column was not changed or " + "is not part of primary key). 'MINIMAL', means that a PK equivalent (PK " + "columns or full row if there is no PK in the table) is logged in the " + "before image, and only changed columns are logged in the after image. " + "(Default: FULL).", + SESSION_VAR(binlog_row_image), CMD_LINE(REQUIRED_ARG), + binlog_row_image_names, DEFAULT(BINLOG_ROW_IMAGE_FULL), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL), + ON_UPDATE(NULL)); + static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var) { longlong previous_val= thd->variables.pseudo_slave_mode;