mirror of
https://github.com/MariaDB/server.git
synced 2025-11-09 11:41:36 +03:00
Cherry-pick the commits the mysql and some changes.
WL#4618 RBR: extended table metadata in the binary log
This patch extends Table Map Event. It appends some new fields for
more metadata. The new metadata includes:
- Signedness of Numberic Columns
- Character Set of Character Columns and Binary Columns
- Column Name
- String Value of SET Columns
- String Value of ENUM Columns
- Primary Key
- Character Set of SET Columns and ENUM Columns
- Geometry Type
Some of them are optional, the patch introduces a GLOBAL system
variable to control it. It is binlog_row_metadata.
- Scope: GLOBAL
- Dynamic: Yes
- Type: ENUM
- Values: {NO_LOG, MINIMAL, FULL}
- Default: NO_LOG
Only Signedness, character set and geometry type are logged if it is MINIMAL.
Otherwise all of them are logged.
Also add a binlog_type_info() to field, So that we can have extract
relevant binlog info from field.
91 lines
2.8 KiB
Plaintext
91 lines
2.8 KiB
Plaintext
NO_LOG Expected
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
NO_LOG
|
|
SELECT @@SESSION.binlog_row_metadata;
|
|
ERROR HY000: Variable 'binlog_row_metadata' is a GLOBAL variable
|
|
'#---------------------BS_STVARS_002_01----------------------#'
|
|
SET @start_value= @@global.binlog_row_metadata;
|
|
SELECT COUNT(@@GLOBAL.binlog_row_metadata);
|
|
COUNT(@@GLOBAL.binlog_row_metadata)
|
|
1
|
|
1 Expected
|
|
'#---------------------BS_STVARS_002_02----------------------#'
|
|
SET @@GLOBAL.binlog_row_metadata=0;
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
NO_LOG
|
|
NO_LOG Expected
|
|
SET @@GLOBAL.binlog_row_metadata=1;
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
MINIMAL
|
|
MINIMAL Expected
|
|
SET @@GLOBAL.binlog_row_metadata=2;
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
FULL
|
|
FULL Expected
|
|
SET @@GLOBAL.binlog_row_metadata=NO_LOG;
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
NO_LOG
|
|
NO_LOG Expected
|
|
SET @@GLOBAL.binlog_row_metadata=MINIMAL;
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
MINIMAL
|
|
MINIMAL Expected
|
|
SET @@GLOBAL.binlog_row_metadata=FULL;
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
FULL
|
|
FULL Expected
|
|
SET @@GLOBAL.binlog_row_metadata='NO_LOG';
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
NO_LOG
|
|
NO_LOG Expected
|
|
SET @@GLOBAL.binlog_row_metadata='MINIMAL';
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
MINIMAL
|
|
MINIMAL Expected
|
|
SET @@GLOBAL.binlog_row_metadata='FULL';
|
|
SELECT @@GLOBAL.binlog_row_metadata;
|
|
@@GLOBAL.binlog_row_metadata
|
|
FULL
|
|
FULL Expected
|
|
'#---------------------BS_STVARS_002_03----------------------#'
|
|
SET @@GLOBAL.binlog_row_metadata='MINIMAl';
|
|
SELECT *
|
|
FROM information_schema.global_variables
|
|
WHERE VARIABLE_NAME='binlog_row_metadata';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
BINLOG_ROW_METADATA MINIMAL
|
|
'#---------------------BS_STVARS_002_04----------------------#'
|
|
SELECT *
|
|
FROM information_schema.session_variables
|
|
WHERE VARIABLE_NAME LIKE 'binlog_row_metadata';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
BINLOG_ROW_METADATA MINIMAL
|
|
'#---------------------BS_STVARS_002_05----------------------#'
|
|
SELECT COUNT(@@binlog_row_metadata);
|
|
COUNT(@@binlog_row_metadata)
|
|
1
|
|
1 Expected
|
|
SELECT COUNT(@@GLOBAL.binlog_row_metadata);
|
|
COUNT(@@GLOBAL.binlog_row_metadata)
|
|
1
|
|
1 Expected
|
|
'#---------------------BS_STVARS_002_06----------------------#'
|
|
SET GLOBAL binlog_row_metadata = full1;
|
|
ERROR 42000: Variable 'binlog_row_metadata' can't be set to the value of 'full1'
|
|
SET GLOBAL binlog_row_metadata = "full1";
|
|
ERROR 42000: Variable 'binlog_row_metadata' can't be set to the value of 'full1'
|
|
SET GLOBAL binlog_row_metadata = 3;
|
|
ERROR 42000: Variable 'binlog_row_metadata' can't be set to the value of '3'
|
|
SET GLOBAL binlog_row_metadata = -1;
|
|
ERROR 42000: Variable 'binlog_row_metadata' can't be set to the value of '-1'
|
|
SET @@global.binlog_row_metadata= @start_value;
|