mirror of
https://github.com/MariaDB/server.git
synced 2025-11-09 11:41:36 +03:00
The aim of the InnoDB change buffer is to avoid delays when a leaf page of a secondary index is not present in the buffer pool, and a record needs to be inserted, delete-marked, or purged. Instead of reading the page into the buffer pool for making such a modification, we may insert a record to the change buffer (a special index tree in the InnoDB system tablespace). The buffered changes are guaranteed to be merged if the index page actually needs to be read later. The change buffer could be useful when the database is stored on a rotational medium (hard disk) where random seeks are slower than sequential reads or writes. Obviously, the change buffer will cause write amplification, due to potentially large amount of metadata that is being written to the change buffer. We will have to write redo log records for modifying the change buffer tree as well as the user tablespace. Furthermore, in the user tablespace, we must maintain a change buffer bitmap page that uses 2 bits for estimating the amount of free space in pages, and 1 bit to specify whether buffered changes exist. This bitmap needs to be updated on every operation, which could reduce performance. Even if the change buffer were free of bugs such as MDEV-24449 (potentially causing the corruption of any page in the system tablespace) or MDEV-26977 (corruption of secondary indexes due to a currently unknown reason), it will make diagnosis of other data corruption harder. Because of all this, it is best to disable the change buffer by default.
66 lines
2.9 KiB
Plaintext
66 lines
2.9 KiB
Plaintext
SET @start_global_value = @@global.innodb_change_buffering;
|
|
SELECT @start_global_value;
|
|
@start_global_value
|
|
none
|
|
Valid values are 'all', 'deletes', 'changes', 'inserts', 'none', 'purges'
|
|
select @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges');
|
|
@@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges')
|
|
1
|
|
select @@global.innodb_change_buffering;
|
|
@@global.innodb_change_buffering
|
|
none
|
|
select @@session.innodb_change_buffering;
|
|
ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable
|
|
show global variables like 'innodb_change_buffering';
|
|
Variable_name Value
|
|
innodb_change_buffering none
|
|
show session variables like 'innodb_change_buffering';
|
|
Variable_name Value
|
|
innodb_change_buffering none
|
|
select * from information_schema.global_variables where variable_name='innodb_change_buffering';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
INNODB_CHANGE_BUFFERING none
|
|
select * from information_schema.session_variables where variable_name='innodb_change_buffering';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
INNODB_CHANGE_BUFFERING none
|
|
set global innodb_change_buffering='none';
|
|
select @@global.innodb_change_buffering;
|
|
@@global.innodb_change_buffering
|
|
none
|
|
select * from information_schema.global_variables where variable_name='innodb_change_buffering';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
INNODB_CHANGE_BUFFERING none
|
|
select * from information_schema.session_variables where variable_name='innodb_change_buffering';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
INNODB_CHANGE_BUFFERING none
|
|
set @@global.innodb_change_buffering='inserts';
|
|
select @@global.innodb_change_buffering;
|
|
@@global.innodb_change_buffering
|
|
inserts
|
|
select * from information_schema.global_variables where variable_name='innodb_change_buffering';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
INNODB_CHANGE_BUFFERING inserts
|
|
select * from information_schema.session_variables where variable_name='innodb_change_buffering';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
INNODB_CHANGE_BUFFERING inserts
|
|
set session innodb_change_buffering='some';
|
|
ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable and should be set with SET GLOBAL
|
|
set @@session.innodb_change_buffering='some';
|
|
ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable and should be set with SET GLOBAL
|
|
set global innodb_change_buffering=1.1;
|
|
ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering'
|
|
set global innodb_change_buffering=1;
|
|
SELECT @@global.innodb_change_buffering;
|
|
@@global.innodb_change_buffering
|
|
inserts
|
|
set global innodb_change_buffering=-2;
|
|
ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of '-2'
|
|
set global innodb_change_buffering=1e1;
|
|
ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering'
|
|
set global innodb_change_buffering='some';
|
|
ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of 'some'
|
|
SET @@global.innodb_change_buffering = @start_global_value;
|
|
SELECT @@global.innodb_change_buffering;
|
|
@@global.innodb_change_buffering
|
|
none
|