Skip to content

Commit 3ed519f

Browse files
committed
[MDEV-6877] Added binlog_row_image system variable
The system variable is present but it does not do anything yet.
1 parent 768620e commit 3ed519f

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

sql/sql_class.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ enum enum_mark_columns
9696
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
9797
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
9898

99+
enum enum_binlog_row_image {
100+
/** PKE in the before image and changed columns in the after image */
101+
BINLOG_ROW_IMAGE_MINIMAL= 0,
102+
/** Whenever possible, before and after image contain all columns except blobs. */
103+
BINLOG_ROW_IMAGE_NOBLOB= 1,
104+
/** All columns in both before and after image. */
105+
BINLOG_ROW_IMAGE_FULL= 2
106+
};
107+
108+
99109
/* Bits for different SQL modes modes (including ANSI mode) */
100110
#define MODE_REAL_AS_FLOAT (1ULL << 0)
101111
#define MODE_PIPES_AS_CONCAT (1ULL << 1)
@@ -588,6 +598,7 @@ typedef struct system_variables
588598
/* Flags for slow log filtering */
589599
ulong log_slow_rate_limit;
590600
ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format)
601+
ulong binlog_row_image;
591602
ulong progress_report_time;
592603
ulong completion_type;
593604
ulong query_cache_type;

sql/sys_vars.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5200,6 +5200,22 @@ static Sys_var_mybool Sys_encrypt_tmp_files(
52005200
READ_ONLY GLOBAL_VAR(encrypt_tmp_files),
52015201
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
52025202

5203+
static const char *binlog_row_image_names[]= {"MINIMAL", "NOBLOB", "FULL", NullS};
5204+
static Sys_var_enum Sys_binlog_row_image(
5205+
"binlog_row_image",
5206+
"Controls whether rows should be logged in 'FULL', 'NOBLOB' or "
5207+
"'MINIMAL' formats. 'FULL', means that all columns in the before "
5208+
"and after image are logged. 'NOBLOB', means that mysqld avoids logging "
5209+
"blob columns whenever possible (eg, blob column was not changed or "
5210+
"is not part of primary key). 'MINIMAL', means that a PK equivalent (PK "
5211+
"columns or full row if there is no PK in the table) is logged in the "
5212+
"before image, and only changed columns are logged in the after image. "
5213+
"(Default: FULL).",
5214+
SESSION_VAR(binlog_row_image), CMD_LINE(REQUIRED_ARG),
5215+
binlog_row_image_names, DEFAULT(BINLOG_ROW_IMAGE_FULL),
5216+
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
5217+
ON_UPDATE(NULL));
5218+
52035219
static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var)
52045220
{
52055221
longlong previous_val= thd->variables.pseudo_slave_mode;

0 commit comments

Comments
 (0)