MDEV-15528 Punch holes when pages are freed

The following parameters are deprecated:

  innodb-background-scrub-data-uncompressed
  innodb-background-scrub-data-compressed
  innodb-background-scrub-data-interval
  innodb-background-scrub-data-check-interval

Removed scrubbing code completely(btr0scrub.h, btr0scrub.cc)
Removed information_schema.innodb_tablespaces_scrubbing tables
Removed the scrubbing logic from fil_crypt_thread()
parent a35b4ae8
......@@ -39,7 +39,6 @@ INNODB_SYS_TABLES
INNODB_SYS_TABLESTATS
INNODB_SYS_VIRTUAL
INNODB_TABLESPACES_ENCRYPTION
INNODB_TABLESPACES_SCRUBBING
INNODB_TRX
KEY_CACHES
KEY_COLUMN_USAGE
......@@ -120,7 +119,6 @@ INNODB_SYS_TABLES TABLE_ID
INNODB_SYS_TABLESTATS TABLE_ID
INNODB_SYS_VIRTUAL TABLE_ID
INNODB_TABLESPACES_ENCRYPTION SPACE
INNODB_TABLESPACES_SCRUBBING SPACE
INNODB_TRX trx_id
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
......@@ -201,7 +199,6 @@ INNODB_SYS_TABLES TABLE_ID
INNODB_SYS_TABLESTATS TABLE_ID
INNODB_SYS_VIRTUAL TABLE_ID
INNODB_TABLESPACES_ENCRYPTION SPACE
INNODB_TABLESPACES_SCRUBBING SPACE
INNODB_TRX trx_id
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
......@@ -287,7 +284,6 @@ INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1
INNODB_SYS_TABLESTATS information_schema.INNODB_SYS_TABLESTATS 1
INNODB_SYS_VIRTUAL information_schema.INNODB_SYS_VIRTUAL 1
INNODB_TABLESPACES_ENCRYPTION information_schema.INNODB_TABLESPACES_ENCRYPTION 1
INNODB_TABLESPACES_SCRUBBING information_schema.INNODB_TABLESPACES_SCRUBBING 1
INNODB_TRX information_schema.INNODB_TRX 1
KEY_CACHES information_schema.KEY_CACHES 1
KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
......@@ -358,7 +354,6 @@ Database: information_schema
| INNODB_SYS_TABLESTATS |
| INNODB_SYS_VIRTUAL |
| INNODB_TABLESPACES_ENCRYPTION |
| INNODB_TABLESPACES_SCRUBBING |
| INNODB_TRX |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
......@@ -429,7 +424,6 @@ Database: INFORMATION_SCHEMA
| INNODB_SYS_TABLESTATS |
| INNODB_SYS_VIRTUAL |
| INNODB_TABLESPACES_ENCRYPTION |
| INNODB_TABLESPACES_SCRUBBING |
| INNODB_TRX |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
......@@ -465,5 +459,5 @@ Wildcard: inf_rmation_schema
| information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 66
information_schema 65
mysql 31
......@@ -66,8 +66,6 @@ create sql security invoker view i_sys_virtual as select * from information_sche
create sql security definer view d_sys_virtual as select * from information_schema.innodb_sys_virtual;
create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
create sql security invoker view i_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
create sql security definer view d_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
create sql security invoker view i_trx as select * from information_schema.innodb_trx;
create sql security definer view d_trx as select * from information_schema.innodb_trx;
connection select_only;
......@@ -284,13 +282,6 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
select count(*) > -1 from d_tablespaces_encryption;
count(*) > -1
1
select count(*) > -1 from information_schema.innodb_tablespaces_scrubbing;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
select count(*) > -1 from i_tablespaces_scrubbing;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
select count(*) > -1 from d_tablespaces_scrubbing;
count(*) > -1
1
select count(*) > -1 from information_schema.innodb_trx;
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
select count(*) > -1 from i_trx;
......
......@@ -393,10 +393,6 @@ select * from information_schema.innodb_tablespaces_encryption;
SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER CURRENT_KEY_ID ROTATING_OR_FLUSHING
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_tablespaces_encryption but the InnoDB storage engine is not installed
select * from information_schema.innodb_tablespaces_scrubbing;
SPACE NAME COMPRESSED LAST_SCRUB_COMPLETED CURRENT_SCRUB_STARTED CURRENT_SCRUB_ACTIVE_THREADS CURRENT_SCRUB_PAGE_NUMBER CURRENT_SCRUB_MAX_PAGE_NUMBER ON_SSD
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_tablespaces_scrubbing but the InnoDB storage engine is not installed
select * from information_schema.innodb_mutexes;
NAME CREATE_FILE CREATE_LINE OS_WAITS
Warnings:
......
......@@ -30,4 +30,3 @@
--enable-plugin-innodb-mutexes
--enable-plugin-innodb-sys-semaphore-waits
--enable-plugin-innodb-tablespaces-encryption
--enable-plugin-innodb-tablespaces-scrubbing
......@@ -103,9 +103,6 @@ create sql security definer view d_sys_virtual as select * from information_sche
create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
create sql security invoker view i_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
create sql security definer view d_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
create sql security invoker view i_trx as select * from information_schema.innodb_trx;
create sql security definer view d_trx as select * from information_schema.innodb_trx;
......@@ -293,12 +290,6 @@ select count(*) > -1 from information_schema.innodb_tablespaces_encryption;
select count(*) > -1 from i_tablespaces_encryption;
select count(*) > -1 from d_tablespaces_encryption;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
select count(*) > -1 from information_schema.innodb_tablespaces_scrubbing;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
select count(*) > -1 from i_tablespaces_scrubbing;
select count(*) > -1 from d_tablespaces_scrubbing;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
select count(*) > -1 from information_schema.innodb_trx;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
......
......@@ -32,6 +32,5 @@ select * from information_schema.innodb_sys_datafiles;
--error 0,1109
select * from information_schema.innodb_changed_pages;
select * from information_schema.innodb_tablespaces_encryption;
select * from information_schema.innodb_tablespaces_scrubbing;
select * from information_schema.innodb_mutexes;
select * from information_schema.innodb_sys_semaphore_waits;
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING;
Table Create Table
INNODB_TABLESPACES_SCRUBBING CREATE TEMPORARY TABLE `INNODB_TABLESPACES_SCRUBBING` (
`SPACE` bigint(21) unsigned NOT NULL DEFAULT 0,
`NAME` varchar(655) DEFAULT NULL,
`COMPRESSED` int(1) unsigned NOT NULL DEFAULT 0,
`LAST_SCRUB_COMPLETED` datetime DEFAULT NULL,
`CURRENT_SCRUB_STARTED` datetime DEFAULT NULL,
`CURRENT_SCRUB_ACTIVE_THREADS` int(11) unsigned DEFAULT NULL,
`CURRENT_SCRUB_PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT 0,
`CURRENT_SCRUB_MAX_PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT 0,
`ON_SSD` int(1) unsigned NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
--source include/have_innodb.inc
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING;
......@@ -4,60 +4,74 @@ SET @start_global_value = @@global.innodb_background_scrub_data_check_interval;
#
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
3600
0
set global innodb_background_scrub_data_check_interval=10;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
10
0
set global innodb_background_scrub_data_check_interval=DEFAULT;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
3600
0
set global innodb_background_scrub_data_check_interval=20;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
20
0
set global innodb_background_scrub_data_check_interval=DEFAULT;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
3600
0
#
# exists as global only
#
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
3600
0
select @@session.innodb_background_scrub_data_check_interval;
ERROR HY000: Variable 'innodb_background_scrub_data_check_interval' is a GLOBAL variable
show global variables like 'innodb_background_scrub_data_check_interval';
Variable_name Value
innodb_background_scrub_data_check_interval 3600
innodb_background_scrub_data_check_interval 0
show session variables like 'innodb_background_scrub_data_check_interval';
Variable_name Value
innodb_background_scrub_data_check_interval 3600
innodb_background_scrub_data_check_interval 0
select * from information_schema.global_variables
where variable_name='innodb_background_scrub_data_check_interval';
VARIABLE_NAME VARIABLE_VALUE
INNODB_BACKGROUND_SCRUB_DATA_CHECK_INTERVAL 3600
INNODB_BACKGROUND_SCRUB_DATA_CHECK_INTERVAL 0
select * from information_schema.session_variables
where variable_name='innodb_background_scrub_data_check_interval';
VARIABLE_NAME VARIABLE_VALUE
INNODB_BACKGROUND_SCRUB_DATA_CHECK_INTERVAL 3600
INNODB_BACKGROUND_SCRUB_DATA_CHECK_INTERVAL 0
#
# show that it's writable
#
set global innodb_background_scrub_data_check_interval=10;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
10
0
set global innodb_background_scrub_data_check_interval=20;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
20
0
set global innodb_background_scrub_data_check_interval=1;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_check_interval;
@@global.innodb_background_scrub_data_check_interval
1
0
set session innodb_background_scrub_data_check_interval=1;
ERROR HY000: Variable 'innodb_background_scrub_data_check_interval' is a GLOBAL variable and should be set with SET GLOBAL
#
......@@ -70,3 +84,5 @@ ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_c
set global innodb_background_scrub_data_check_interval="foo";
ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_check_interval'
SET @@global.innodb_background_scrub_data_check_interval = @start_global_value;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.
......@@ -25,17 +25,23 @@ INNODB_BACKGROUND_SCRUB_DATA_COMPRESSED OFF
# show that it's writable
#
set global innodb_background_scrub_data_compressed=ON;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_compressed is deprecated and has no effect.
select @@global.innodb_background_scrub_data_compressed;
@@global.innodb_background_scrub_data_compressed
1
0
set global innodb_background_scrub_data_compressed=OFF;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_compressed is deprecated and has no effect.
select @@global.innodb_background_scrub_data_compressed;
@@global.innodb_background_scrub_data_compressed
0
set global innodb_background_scrub_data_compressed=1;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_compressed is deprecated and has no effect.
select @@global.innodb_background_scrub_data_compressed;
@@global.innodb_background_scrub_data_compressed
1
0
set session innodb_background_scrub_data_compressed=1;
ERROR HY000: Variable 'innodb_background_scrub_data_compressed' is a GLOBAL variable and should be set with SET GLOBAL
#
......@@ -48,3 +54,5 @@ ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_c
set global innodb_background_scrub_data_compressed="foo";
ERROR 42000: Variable 'innodb_background_scrub_data_compressed' can't be set to the value of 'foo'
SET @@global.innodb_background_scrub_data_compressed = @start_global_value;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_compressed is deprecated and has no effect.
......@@ -4,38 +4,44 @@ SET @start_global_value = @@global.innodb_background_scrub_data_interval;
#
select @@global.innodb_background_scrub_data_interval;
@@global.innodb_background_scrub_data_interval
604800
0
select @@session.innodb_background_scrub_data_interval;
ERROR HY000: Variable 'innodb_background_scrub_data_interval' is a GLOBAL variable
show global variables like 'innodb_background_scrub_data_interval';
Variable_name Value
innodb_background_scrub_data_interval 604800
innodb_background_scrub_data_interval 0
show session variables like 'innodb_background_scrub_data_interval';
Variable_name Value
innodb_background_scrub_data_interval 604800
innodb_background_scrub_data_interval 0
select * from information_schema.global_variables
where variable_name='innodb_background_scrub_data_interval';
VARIABLE_NAME VARIABLE_VALUE
INNODB_BACKGROUND_SCRUB_DATA_INTERVAL 604800
INNODB_BACKGROUND_SCRUB_DATA_INTERVAL 0
select * from information_schema.session_variables
where variable_name='innodb_background_scrub_data_interval';
VARIABLE_NAME VARIABLE_VALUE
INNODB_BACKGROUND_SCRUB_DATA_INTERVAL 604800
INNODB_BACKGROUND_SCRUB_DATA_INTERVAL 0
#
# show that it's writable
#
set global innodb_background_scrub_data_interval=100;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_interval;
@@global.innodb_background_scrub_data_interval
100
0
set global innodb_background_scrub_data_interval=200;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_interval;
@@global.innodb_background_scrub_data_interval
200
0
set global innodb_background_scrub_data_interval=300;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_interval is deprecated and has no effect.
select @@global.innodb_background_scrub_data_interval;
@@global.innodb_background_scrub_data_interval
300
0
set session innodb_background_scrub_data_interval=400;
ERROR HY000: Variable 'innodb_background_scrub_data_interval' is a GLOBAL variable and should be set with SET GLOBAL
#
......@@ -48,3 +54,5 @@ ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_i
set global innodb_background_scrub_data_interval="foo";
ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_interval'
SET @@global.innodb_background_scrub_data_interval = @start_global_value;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_interval is deprecated and has no effect.
......@@ -25,17 +25,23 @@ INNODB_BACKGROUND_SCRUB_DATA_UNCOMPRESSED OFF
# show that it's writable
#
set global innodb_background_scrub_data_uncompressed=ON;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_uncompressed is deprecated and has no effect.
select @@global.innodb_background_scrub_data_uncompressed;
@@global.innodb_background_scrub_data_uncompressed
1
0
set global innodb_background_scrub_data_uncompressed=OFF;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_uncompressed is deprecated and has no effect.
select @@global.innodb_background_scrub_data_uncompressed;
@@global.innodb_background_scrub_data_uncompressed
0
set global innodb_background_scrub_data_uncompressed=1;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_uncompressed is deprecated and has no effect.
select @@global.innodb_background_scrub_data_uncompressed;
@@global.innodb_background_scrub_data_uncompressed
1
0
set session innodb_background_scrub_data_uncompressed=1;
ERROR HY000: Variable 'innodb_background_scrub_data_uncompressed' is a GLOBAL variable and should be set with SET GLOBAL
#
......@@ -48,3 +54,5 @@ ERROR 42000: Incorrect argument type to variable 'innodb_background_scrub_data_u
set global innodb_background_scrub_data_uncompressed="foo";
ERROR 42000: Variable 'innodb_background_scrub_data_uncompressed' can't be set to the value of 'foo'
SET @@global.innodb_background_scrub_data_uncompressed = @start_global_value;
Warnings:
Warning 138 The parameter innodb_background_scrub_data_uncompressed is deprecated and has no effect.
SET @start_global_value = @@global.innodb_debug_force_scrubbing;
#
# exists as global only
#
select @@global.innodb_debug_force_scrubbing;
@@global.innodb_debug_force_scrubbing
0
select @@session.innodb_debug_force_scrubbing;
ERROR HY000: Variable 'innodb_debug_force_scrubbing' is a GLOBAL variable
show global variables like 'innodb_debug_force_scrubbing';
Variable_name Value
innodb_debug_force_scrubbing OFF
show session variables like 'innodb_debug_force_scrubbing';
Variable_name Value
innodb_debug_force_scrubbing OFF
select * from information_schema.global_variables
where variable_name='innodb_debug_force_scrubbing';
VARIABLE_NAME VARIABLE_VALUE
INNODB_DEBUG_FORCE_SCRUBBING OFF
select * from information_schema.session_variables
where variable_name='innodb_debug_force_scrubbing';
VARIABLE_NAME VARIABLE_VALUE
INNODB_DEBUG_FORCE_SCRUBBING OFF
#
# show that it's writable
#
set global innodb_debug_force_scrubbing=ON;
select @@global.innodb_debug_force_scrubbing;
@@global.innodb_debug_force_scrubbing
1
set global innodb_debug_force_scrubbing=OFF;
select @@global.innodb_debug_force_scrubbing;
@@global.innodb_debug_force_scrubbing
0
set global innodb_debug_force_scrubbing=1;
select @@global.innodb_debug_force_scrubbing;
@@global.innodb_debug_force_scrubbing
1
set session innodb_debug_force_scrubbing=1;
ERROR HY000: Variable 'innodb_debug_force_scrubbing' is a GLOBAL variable and should be set with SET GLOBAL
#
# incorrect types
#
set global innodb_debug_force_scrubbing=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_debug_force_scrubbing'
set global innodb_debug_force_scrubbing=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_debug_force_scrubbing'
set global innodb_debug_force_scrubbing="foo";
ERROR 42000: Variable 'innodb_debug_force_scrubbing' can't be set to the value of 'foo'
SET @@global.innodb_debug_force_scrubbing = @start_global_value;
......@@ -107,12 +107,12 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_BACKGROUND_SCRUB_DATA_CHECK_INTERVAL
SESSION_VALUE NULL
DEFAULT_VALUE 3600
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT check if spaces needs scrubbing every innodb_background_scrub_data_check_interval seconds
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 0
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
......@@ -122,21 +122,21 @@ SESSION_VALUE NULL
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Enable scrubbing of compressed data by background threads (same as encryption_threads)
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_BACKGROUND_SCRUB_DATA_INTERVAL
SESSION_VALUE NULL
DEFAULT_VALUE 604800
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT scrub spaces that were last scrubbed longer than innodb_background_scrub_data_interval seconds ago
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 0
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
......@@ -146,13 +146,13 @@ SESSION_VALUE NULL
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Enable scrubbing of uncompressed data by background threads (same as encryption_threads)
VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_BUFFER_POOL_CHUNK_SIZE
SESSION_VALUE NULL
DEFAULT_VALUE 134217728
......@@ -513,18 +513,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_DEBUG_FORCE_SCRUBBING
SESSION_VALUE NULL
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Perform extra scrubbing to increase test exposure
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY_ID
SESSION_VALUE 1
DEFAULT_VALUE 1
......@@ -710,7 +698,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of threads performing background key rotation and scrubbing
VARIABLE_COMMENT Number of threads performing background key rotation
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
......
# bool global
--source include/have_innodb.inc
--source include/have_debug.inc
SET @start_global_value = @@global.innodb_debug_force_scrubbing;
--echo #
--echo # exists as global only
--echo #
select @@global.innodb_debug_force_scrubbing;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_debug_force_scrubbing;
show global variables like 'innodb_debug_force_scrubbing';
show session variables like 'innodb_debug_force_scrubbing';
select * from information_schema.global_variables
where variable_name='innodb_debug_force_scrubbing';
select * from information_schema.session_variables
where variable_name='innodb_debug_force_scrubbing';
--echo #
--echo # show that it's writable
--echo #
set global innodb_debug_force_scrubbing=ON;
select @@global.innodb_debug_force_scrubbing;
set global innodb_debug_force_scrubbing=OFF;
select @@global.innodb_debug_force_scrubbing;
set global innodb_debug_force_scrubbing=1;
select @@global.innodb_debug_force_scrubbing;
--error ER_GLOBAL_VARIABLE
set session innodb_debug_force_scrubbing=1;
--echo #
--echo # incorrect types
--echo #
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_debug_force_scrubbing=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_debug_force_scrubbing=1e1;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_debug_force_scrubbing="foo";
SET @@global.innodb_debug_force_scrubbing = @start_global_value;
......@@ -26,7 +26,6 @@ SET(INNOBASE_SOURCES
btr/btr0bulk.cc
btr/btr0cur.cc
btr/btr0pcur.cc
btr/btr0scrub.cc
btr/btr0sea.cc
btr/btr0defragment.cc
buf/buf0buddy.cc
......
This diff is collapsed.
......@@ -37,7 +37,6 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "mtr0mtr.h"
#include "mtr0log.h"
#include "ut0ut.h"
#include "btr0scrub.h"
#include "fsp0fsp.h"
#include "fil0pagecompress.h"
#include <my_crypt.h>
......@@ -79,20 +78,12 @@ UNIV_INTERN uint srv_n_fil_crypt_iops = 100; // 10ms per iop
static uint srv_alloc_time = 3; // allocate iops for 3s at a time
static uint n_fil_crypt_iops_allocated = 0;
/** Variables for scrubbing */
extern uint srv_background_scrub_data_interval;
extern uint srv_background_scrub_data_check_interval;
#define DEBUG_KEYROTATION_THROTTLING 0
/** Statistics variables */
static fil_crypt_stat_t crypt_stat;
static ib_mutex_t crypt_stat_mutex;
/** Is background scrubbing enabled, defined on btr0scrub.cc */
extern my_bool srv_background_scrub_data_uncompressed;
extern my_bool srv_background_scrub_data_compressed;
/***********************************************************************
Check if a key needs rotation given a key_state
@param[in] crypt_data Encryption information
......@@ -1165,9 +1156,6 @@ struct rotate_thread_t {
fil_crypt_stat_t crypt_stat; // statistics
btr_scrub_t scrub_data; /* thread local data used by btr_scrub-functions
* when iterating pages of tablespace */
/** @return whether this thread should terminate */
bool should_shutdown() const {
switch (srv_shutdown_state) {
......@@ -1266,20 +1254,7 @@ fil_crypt_space_needs_rotation(
key_state->key_version,
key_state->rotate_key_age);
crypt_data->rotate_state.scrubbing.is_active =
btr_scrub_start_space(space->id, &state->scrub_data);
time_t diff = time(0) - crypt_data->rotate_state.scrubbing.
last_scrub_completed;
bool need_scrubbing =
(srv_background_scrub_data_uncompressed ||
srv_background_scrub_data_compressed) &&
crypt_data->rotate_state.scrubbing.is_active
&& diff >= 0
&& ulint(diff) >= srv_background_scrub_data_interval;
if (need_key_rotation == false && need_scrubbing == false) {
if (need_key_rotation == false) {
break;
}
......@@ -1728,69 +1703,6 @@ fil_crypt_get_page_throttle_func(
return block;
}
/***********************************************************************
Get block and allocation status
note: innodb locks fil_space_latch and then block when allocating page
but locks block and then fil_space_latch when freeing page.
@param[in,out] state Rotation state
@param[in] offset Page offset
@param[in,out] mtr Minitransaction
@param[out] allocation_status Allocation status
@param[out] sleeptime_ms Sleep time
@return block or NULL
*/
static
buf_block_t*
btr_scrub_get_block_and_allocation_status(
rotate_thread_t* state,
ulint offset,
mtr_t* mtr,
btr_scrub_page_allocation_status_t *allocation_status,
ulint* sleeptime_ms)
{
mtr_t local_mtr;
buf_block_t *block = NULL;
fil_space_t* space = state->space;
ut_ad(space->referenced());
mtr_start(&local_mtr);
*allocation_status = fseg_page_is_free(space, (uint32_t)offset) ?
BTR_SCRUB_PAGE_FREE :
BTR_SCRUB_PAGE_ALLOCATED;
if (*allocation_status == BTR_SCRUB_PAGE_FREE) {
/* this is easy case, we lock fil_space_latch first and
then block */
block = fil_crypt_get_page_throttle(state,
offset, mtr,
sleeptime_ms);
mtr_commit(&local_mtr);
} else {
/* page is allocated according to xdes */
/* release fil_space_latch *before* fetching block */
mtr_commit(&local_mtr);
/* NOTE: when we have locked dict_index_get_lock(),
* it's safe to release fil_space_latch and then fetch block
* as dict_index_get_lock() is needed to make tree modifications
* such as free-ing a page
*/
block = fil_crypt_get_page_throttle(state,
offset, mtr,
sleeptime_ms);
}
return block;
}
/***********************************************************************
Rotate one page
@param[in,out] key_state Key state
......@@ -1829,7 +1741,6 @@ fil_crypt_rotate_page(
offset, &mtr,
&sleeptime_ms)) {
bool modified = false;
int needs_scrubbing = BTR_SCRUB_SKIP_PAGE;
byte* frame = buf_block_get_frame(block);
const lsn_t block_lsn = mach_read_from_8(FIL_PAGE_LSN + frame);
uint kv = buf_page_get_key_version(frame, space->flags);
......@@ -1885,74 +1796,11 @@ fil_crypt_rotate_page(
state->min_key_version_found = kv;
}
}
needs_scrubbing = btr_page_needs_scrubbing(
&state->scrub_data, block,
BTR_SCRUB_PAGE_ALLOCATION_UNKNOWN);
}
mtr.commit();
lsn_t end_lsn = mtr.commit_lsn();
if (needs_scrubbing == BTR_SCRUB_PAGE) {
mtr.start();
/*
* refetch page and allocation status
*/
btr_scrub_page_allocation_status_t allocated;
block = btr_scrub_get_block_and_allocation_status(
state, offset, &mtr,
&allocated,
&sleeptime_ms);
if (block) {
mtr.set_named_space(space);
/* get required table/index and index-locks */
needs_scrubbing = btr_scrub_recheck_page(
&state->scrub_data, block, allocated, &mtr);
if (needs_scrubbing == BTR_SCRUB_PAGE) {
/* we need to refetch it once more now that we have
* index locked */
block = btr_scrub_get_block_and_allocation_status(
state, offset, &mtr,
&allocated,
&sleeptime_ms);
needs_scrubbing = btr_scrub_page(&state->scrub_data,
block, allocated,
&mtr);
}
/* NOTE: mtr is committed inside btr_scrub_recheck_page()
* and/or btr_scrub_page. This is to make sure that
* locks & pages are latched in corrected order,
* the mtr is in some circumstances restarted.
* (mtr_commit() + mtr_start())
*/
}
}
if (needs_scrubbing != BTR_SCRUB_PAGE) {
/* if page didn't need scrubbing it might be that cleanups
are needed. do those outside of any mtr to prevent deadlocks.
the information what kinds of cleanups that are needed are
encoded inside the needs_scrubbing, but this is opaque to
this function (except the value BTR_SCRUB_PAGE) */
btr_scrub_skip_page(&state->scrub_data, needs_scrubbing);
}
if (needs_scrubbing == BTR_SCRUB_TURNED_OFF) {
/* if we just detected that scrubbing was turned off
* update global state to reflect this */
ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
crypt_data->rotate_state.scrubbing.is_active = false;
mutex_exit(&crypt_data->mutex);
}
if (modified) {
/* if we modified page, we take lsn from mtr */
......@@ -2137,31 +1985,14 @@ static void fil_crypt_complete_rotate_space(rotate_thread_t* state)
crypt_data->rotate_state.flushing = true;
crypt_data->min_key_version =
crypt_data->rotate_state.min_key_version_found;
}
/* inform scrubbing */
crypt_data->rotate_state.scrubbing.is_active = false;
mutex_exit(&crypt_data->mutex);
/* all threads must call btr_scrub_complete_space wo/ mutex held */
if (state->scrub_data.scrubbing) {
btr_scrub_complete_space(&state->scrub_data);
if (should_flush) {
/* only last thread updates last_scrub_completed */
ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
crypt_data->rotate_state.scrubbing.
last_scrub_completed = time(0);
mutex_exit(&crypt_data->mutex);
}
}
if (should_flush) {
mutex_exit(&crypt_data->mutex);
fil_crypt_flush_space(state);
mutex_enter(&crypt_data->mutex);
crypt_data->rotate_state.flushing = false;
mutex_exit(&crypt_data->mutex);
} else {
mutex_exit(&crypt_data->mutex);
}
} else {
mutex_enter(&crypt_data->mutex);
......@@ -2194,8 +2025,6 @@ DECLARE_THREAD(fil_crypt_thread)(void*)
key_state_t new_state;
time_t wait_start = time(0);
while (!thr.should_shutdown()) {
/* wait for key state changes
......@@ -2213,17 +2042,6 @@ DECLARE_THREAD(fil_crypt_thread)(void*)
* a space*/
break;
}
time_t waited = time(0) - wait_start;
/* Break if we have waited the background scrub
internal and background scrubbing is enabled */
if (waited >= 0
&& ulint(waited) >= srv_background_scrub_data_check_interval
&& (srv_background_scrub_data_uncompressed
|| srv_background_scrub_data_compressed)) {
break;
}
}
recheck = false;
......@@ -2604,45 +2422,6 @@ fil_crypt_total_stat(
mutex_exit(&crypt_stat_mutex);
}
/*********************************************************************
Get scrub status for a space (used by information_schema)
@param[in] space Tablespace
@param[out] status Scrub status */
UNIV_INTERN
void
fil_space_get_scrub_status(
const fil_space_t* space,
struct fil_space_scrub_status_t* status)
{
memset(status, 0, sizeof(*status));
ut_ad(space->referenced());
fil_space_crypt_t* crypt_data = space->crypt_data;
status->space = space->id;
if (crypt_data != NULL) {
status->compressed = FSP_FLAGS_GET_ZIP_SSIZE(space->flags) > 0;
mutex_enter(&crypt_data->mutex);
status->last_scrub_completed =
crypt_data->rotate_state.scrubbing.last_scrub_completed;
if (crypt_data->rotate_state.active_threads > 0 &&
crypt_data->rotate_state.scrubbing.is_active) {
status->scrubbing = true;
status->current_scrub_started =
crypt_data->rotate_state.start_time;
status->current_scrub_active_threads =
crypt_data->rotate_state.active_threads;
status->current_scrub_page_number =
crypt_data->rotate_state.next_offset;
status->current_scrub_max_page_number =
crypt_data->rotate_state.max_offset;
}
mutex_exit(&crypt_data->mutex);
}
}
#endif /* UNIV_INNOCHECKSUM */
/**
......
......@@ -213,14 +213,8 @@ static char* innodb_version_str = (char*) INNODB_VERSION_STR;
extern uint srv_fil_crypt_rotate_key_age;
extern uint srv_n_fil_crypt_iops;
extern my_bool srv_immediate_scrub_data_uncompressed;
extern my_bool srv_background_scrub_data_uncompressed;
extern my_bool srv_background_scrub_data_compressed;
extern uint srv_background_scrub_data_interval;
extern uint srv_background_scrub_data_check_interval;
#ifdef UNIV_DEBUG
my_bool innodb_evict_tables_on_commit_debug;
extern my_bool srv_scrub_force_testing;
#endif
/** Note we cannot use rec_format_enum because we do not allow
......@@ -1081,22 +1075,6 @@ static SHOW_VAR innodb_status_variables[]= {
{"encryption_n_temp_blocks_decrypted",
&export_vars.innodb_n_temp_blocks_decrypted, SHOW_LONGLONG},
/* scrubing */
{"scrub_background_page_reorganizations",
&export_vars.innodb_scrub_page_reorganizations, SHOW_SIZE_T},
{"scrub_background_page_splits", &export_vars.innodb_scrub_page_splits,
SHOW_SIZE_T},
{"scrub_background_page_split_failures_underflow",
&export_vars.innodb_scrub_page_split_failures_underflow, SHOW_SIZE_T},
{"scrub_background_page_split_failures_out_of_filespace",
&export_vars.innodb_scrub_page_split_failures_out_of_filespace,SHOW_SIZE_T},
{"scrub_background_page_split_failures_missing_index",
&export_vars.innodb_scrub_page_split_failures_missing_index, SHOW_SIZE_T},
{"scrub_background_page_split_failures_unknown",
&export_vars.innodb_scrub_page_split_failures_unknown, SHOW_SIZE_T},
{"encryption_num_key_requests", &export_vars.innodb_encryption_key_requests,
SHOW_LONGLONG},
{NullS, NullS, SHOW_LONG}
};
......@@ -3454,6 +3432,26 @@ static const char* innodb_page_cleaners_msg
= "The parameter innodb_page_cleaners is deprecated and has no effect.";
ulong srv_n_log_files;
static my_bool innodb_background_scrub_data_uncompressed;
static const char* innodb_background_scrub_data_uncompressed_msg
= "The parameter innodb_background_scrub_data_uncompressed is deprecated and has no effect.";
static my_bool innodb_background_scrub_data_compressed;
static const char* innodb_background_scrub_data_compressed_msg
= "The parameter innodb_background_scrub_data_compressed is deprecated and has no effect.";
static uint innodb_background_scrub_data_check_interval;
static const char* innodb_background_scrub_data_check_interval_msg
= "The parameter innodb_background_scrub_data_check_interval is deprecated and has no effect.";
static uint innodb_background_scrub_data_interval;
static const char* innodb_background_scrub_data_interval_msg
= "The parameter innodb_background_scrub_data_interval is deprecated and has no effect.";
} // namespace deprecated
/** Initialize, validate and normalize the InnoDB startup parameters.
......@@ -18934,6 +18932,46 @@ innodb_scrub_log_speed_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
deprecated::innodb_scrub_log_speed_msg);
}
static void
innodb_background_scrub_data_uncompressed_warn(THD* thd, st_mysql_sys_var*,
void*, const void*)
{
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
deprecated::innodb_background_scrub_data_uncompressed_msg);
}
static void
innodb_background_scrub_data_compressed_warn(THD* thd, st_mysql_sys_var*,
void*, const void*)
{
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
deprecated::innodb_background_scrub_data_compressed_msg);
}
static void
innodb_background_scrub_data_check_interval_warn(
THD* thd, st_mysql_sys_var*, void*, const void*)
{
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
deprecated::innodb_background_scrub_data_check_interval_msg);
}
static void
innodb_background_scrub_data_interval_warn(
THD* thd, st_mysql_sys_var*, void*, const void*)
{
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
deprecated::innodb_background_scrub_data_interval_msg);
}
static SHOW_VAR innodb_status_variables_export[]= {
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
......@@ -20151,8 +20189,7 @@ static MYSQL_SYSVAR_ENUM(encrypt_tables, srv_encrypt_tables,
static MYSQL_SYSVAR_UINT(encryption_threads, srv_n_fil_crypt_threads,
PLUGIN_VAR_RQCMDARG,
"Number of threads performing background key rotation and "
"scrubbing",
"Number of threads performing background key rotation ",
NULL,
innodb_encryption_threads_update,
srv_n_fil_crypt_threads, 0, UINT_MAX32, 0);
......@@ -20197,47 +20234,24 @@ static MYSQL_SYSVAR_BOOL(immediate_scrub_data_uncompressed,
NULL, NULL, FALSE);
static MYSQL_SYSVAR_BOOL(background_scrub_data_uncompressed,
srv_background_scrub_data_uncompressed,
0,
"Enable scrubbing of uncompressed data by "
"background threads (same as encryption_threads)",
NULL, NULL, FALSE);
deprecated::innodb_background_scrub_data_uncompressed,
PLUGIN_VAR_OPCMDARG, innodb_deprecated_ignored, NULL,
innodb_background_scrub_data_uncompressed_warn, FALSE);
static MYSQL_SYSVAR_BOOL(background_scrub_data_compressed,
srv_background_scrub_data_compressed,
0,
"Enable scrubbing of compressed data by "
"background threads (same as encryption_threads)",
NULL, NULL, FALSE);
deprecated::innodb_background_scrub_data_compressed,
PLUGIN_VAR_OPCMDARG, innodb_deprecated_ignored, NULL,
innodb_background_scrub_data_compressed_warn, FALSE);
static MYSQL_SYSVAR_UINT(background_scrub_data_check_interval,
srv_background_scrub_data_check_interval,
0,
"check if spaces needs scrubbing every "
"innodb_background_scrub_data_check_interval "
"seconds",
NULL, NULL,
srv_background_scrub_data_check_interval,
1,
UINT_MAX32, 0);
deprecated::innodb_background_scrub_data_check_interval,
0, innodb_deprecated_ignored, NULL,
innodb_background_scrub_data_check_interval_warn, 0, 0, 0, 0);
static MYSQL_SYSVAR_UINT(background_scrub_data_interval,
srv_background_scrub_data_interval,
0,
"scrub spaces that were last scrubbed longer than "
" innodb_background_scrub_data_interval seconds ago",
NULL, NULL,
srv_background_scrub_data_interval,
1,
UINT_MAX32, 0);
#ifdef UNIV_DEBUG
static MYSQL_SYSVAR_BOOL(debug_force_scrubbing,
srv_scrub_force_testing,
0,
"Perform extra scrubbing to increase test exposure",
NULL, NULL, FALSE);
#endif /* UNIV_DEBUG */
deprecated::innodb_background_scrub_data_interval,
0, innodb_deprecated_ignored, NULL,
innodb_background_scrub_data_interval_warn, 0, 0, 0, 0);
static MYSQL_SYSVAR_BOOL(encrypt_temporary_tables, innodb_encrypt_temporary_tables,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
......@@ -20442,9 +20456,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(background_scrub_data_compressed),
MYSQL_SYSVAR(background_scrub_data_interval),
MYSQL_SYSVAR(background_scrub_data_check_interval),
#ifdef UNIV_DEBUG
MYSQL_SYSVAR(debug_force_scrubbing),
#endif
MYSQL_SYSVAR(buf_dump_status_frequency),
MYSQL_SYSVAR(background_thread),
MYSQL_SYSVAR(encrypt_temporary_tables),
......@@ -20499,8 +20510,7 @@ i_s_innodb_sys_datafiles,
i_s_innodb_sys_virtual,
i_s_innodb_mutexes,
i_s_innodb_sys_semaphore_waits,
i_s_innodb_tablespaces_encryption,
i_s_innodb_tablespaces_scrubbing
i_s_innodb_tablespaces_encryption
maria_declare_plugin_end;
/** @brief Initialize the default value of innodb_commit_concurrency.
......
......@@ -7159,228 +7159,6 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
};
namespace Show {
/** TABLESPACES_SCRUBBING ********************************************/
/* Fields of the table INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING */
static ST_FIELD_INFO innodb_tablespaces_scrubbing_fields_info[] =
{
#define TABLESPACES_SCRUBBING_SPACE 0
Column("SPACE", ULonglong(), NOT_NULL),
#define TABLESPACES_SCRUBBING_NAME 1
Column("NAME", Varchar(MAX_FULL_NAME_LEN + 1), NULLABLE),
#define TABLESPACES_SCRUBBING_COMPRESSED 2
Column("COMPRESSED", ULong(1), NOT_NULL),
#define TABLESPACES_SCRUBBING_LAST_SCRUB_COMPLETED 3
Column("LAST_SCRUB_COMPLETED", Datetime(0), NULLABLE),
#define TABLESPACES_SCRUBBING_CURRENT_SCRUB_STARTED 4
Column("CURRENT_SCRUB_STARTED", Datetime(0), NULLABLE),
#define TABLESPACES_SCRUBBING_CURRENT_SCRUB_ACTIVE_THREADS 5
Column("CURRENT_SCRUB_ACTIVE_THREADS", ULong(), NULLABLE),
#define TABLESPACES_SCRUBBING_CURRENT_SCRUB_PAGE_NUMBER 6
Column("CURRENT_SCRUB_PAGE_NUMBER", ULonglong(),NOT_NULL),
#define TABLESPACES_SCRUBBING_CURRENT_SCRUB_MAX_PAGE_NUMBER 7
Column("CURRENT_SCRUB_MAX_PAGE_NUMBER", ULonglong(), NOT_NULL),
#define TABLESPACES_SCRUBBING_ON_SSD 8
Column("ON_SSD", ULong(1), NOT_NULL),
CEnd()
};
} // namespace Show
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING
with information collected by scanning SYS_TABLESPACES table and
fil_space.
@param[in] thd Thread handle
@param[in] space Tablespace
@param[in] table_to_fill I_S table
@return 0 on success */
static
int
i_s_dict_fill_tablespaces_scrubbing(
THD* thd,
fil_space_t* space,
TABLE* table_to_fill)
{
Field** fields;
struct fil_space_scrub_status_t status;
DBUG_ENTER("i_s_dict_fill_tablespaces_scrubbing");
fields = table_to_fill->field;
fil_space_get_scrub_status(space, &status);
OK(fields[TABLESPACES_SCRUBBING_SPACE]->store(space->id, true));
OK(field_store_string(fields[TABLESPACES_SCRUBBING_NAME],
space->name));
OK(fields[TABLESPACES_SCRUBBING_COMPRESSED]->store(
status.compressed ? 1 : 0, true));
if (status.last_scrub_completed == 0) {
fields[TABLESPACES_SCRUBBING_LAST_SCRUB_COMPLETED]->set_null();
} else {
fields[TABLESPACES_SCRUBBING_LAST_SCRUB_COMPLETED]
->set_notnull();
OK(field_store_time_t(
fields[TABLESPACES_SCRUBBING_LAST_SCRUB_COMPLETED],
status.last_scrub_completed));
}
int field_numbers[] = {
TABLESPACES_SCRUBBING_CURRENT_SCRUB_STARTED,
TABLESPACES_SCRUBBING_CURRENT_SCRUB_ACTIVE_THREADS,
TABLESPACES_SCRUBBING_CURRENT_SCRUB_PAGE_NUMBER,
TABLESPACES_SCRUBBING_CURRENT_SCRUB_MAX_PAGE_NUMBER };
if (status.scrubbing) {
for (uint i = 0; i < array_elements(field_numbers); i++) {
fields[field_numbers[i]]->set_notnull();
}
OK(field_store_time_t(
fields[TABLESPACES_SCRUBBING_CURRENT_SCRUB_STARTED],
status.current_scrub_started));
OK(fields[TABLESPACES_SCRUBBING_CURRENT_SCRUB_ACTIVE_THREADS]
->store(status.current_scrub_active_threads, true));
OK(fields[TABLESPACES_SCRUBBING_CURRENT_SCRUB_PAGE_NUMBER]
->store(status.current_scrub_page_number, true));
OK(fields[TABLESPACES_SCRUBBING_CURRENT_SCRUB_MAX_PAGE_NUMBER]
->store(status.current_scrub_max_page_number, true));
} else {
for (uint i = 0; i < array_elements(field_numbers); i++) {
fields[field_numbers[i]]->set_null();
}
}
OK(fields[TABLESPACES_SCRUBBING_ON_SSD]->store(!space->is_rotational(),
true));
OK(schema_table_store_record(thd, table_to_fill));
DBUG_RETURN(0);
}
/*******************************************************************//**
Function to populate INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING table.
Loop through each record in TABLESPACES_SCRUBBING, and extract the column
information and fill the INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING table.
@return 0 on success */
static
int
i_s_tablespaces_scrubbing_fill_table(
/*===========================*/
THD* thd, /*!< in: thread */
TABLE_LIST* tables, /*!< in/out: tables to fill */
Item* ) /*!< in: condition (not used) */
{
DBUG_ENTER("i_s_tablespaces_scrubbing_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
/* deny access to user without SUPER_ACL privilege */
if (check_global_access(thd, SUPER_ACL)) {
DBUG_RETURN(0);
}
mutex_enter(&fil_system.mutex);
for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system.space_list);
space; space = UT_LIST_GET_NEXT(space_list, space)) {
if (space->purpose == FIL_TYPE_TABLESPACE
&& !space->is_stopping()) {
space->acquire();
mutex_exit(&fil_system.mutex);
if (int err = i_s_dict_fill_tablespaces_scrubbing(
thd, space, tables->table)) {
space->release();
DBUG_RETURN(err);
}
mutex_enter(&fil_system.mutex);
space->release();
}
}
mutex_exit(&fil_system.mutex);
DBUG_RETURN(0);
}
/*******************************************************************//**
Bind the dynamic table INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING
@return 0 on success */
static
int
innodb_tablespaces_scrubbing_init(
/*========================*/
void* p) /*!< in/out: table schema object */
{
ST_SCHEMA_TABLE* schema;
DBUG_ENTER("innodb_tablespaces_scrubbing_init");
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = Show::innodb_tablespaces_scrubbing_fields_info;
schema->fill_table = i_s_tablespaces_scrubbing_fill_table;
DBUG_RETURN(0);
}
UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_scrubbing =
{
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
/* int */
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
/* pointer to type-specific plugin descriptor */
/* void* */
STRUCT_FLD(info, &i_s_info),
/* plugin name */
/* const char* */
STRUCT_FLD(name, "INNODB_TABLESPACES_SCRUBBING"),
/* plugin author (for SHOW PLUGINS) */
/* const char* */
STRUCT_FLD(author, "Google Inc"),
/* general descriptive text (for SHOW PLUGINS) */
/* const char* */
STRUCT_FLD(descr, "InnoDB TABLESPACES_SCRUBBING"),
/* the plugin license (PLUGIN_LICENSE_XXX) */
/* int */
STRUCT_FLD(license, PLUGIN_LICENSE_BSD),
/* the function to invoke when plugin is loaded */
/* int (*)(void*); */
STRUCT_FLD(init, innodb_tablespaces_scrubbing_init),
/* the function to invoke when plugin is unloaded */
/* int (*)(void*); */
STRUCT_FLD(deinit, i_s_common_deinit),
/* plugin version (for SHOW PLUGINS) */
/* unsigned int */
STRUCT_FLD(version, INNODB_VERSION_SHORT),
/* struct st_mysql_show_var* */
STRUCT_FLD(status_vars, NULL),
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
};
namespace Show {
/** INNODB_MUTEXES *********************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_MUTEXES */
......
// Copyright 2014 Google
#ifndef btr0scrub_h
#define btr0scrub_h
#include "dict0dict.h"
/**
* enum describing page allocation status
*/
enum btr_scrub_page_allocation_status_t {
BTR_SCRUB_PAGE_FREE,
BTR_SCRUB_PAGE_ALLOCATED,
BTR_SCRUB_PAGE_ALLOCATION_UNKNOWN
};
/**
* constants returned by btr_page_needs_scrubbing & btr_scrub_recheck_page
*/
#define BTR_SCRUB_PAGE 1 /* page should be scrubbed */
#define BTR_SCRUB_SKIP_PAGE 2 /* no scrub & no action */
#define BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE 3 /* no scrub & close table */
#define BTR_SCRUB_SKIP_PAGE_AND_COMPLETE_SPACE 4 /* no scrub & complete space */
#define BTR_SCRUB_TURNED_OFF 5 /* we detected that scrubbing
was disabled by global
variable */
/**************************************************************//**
struct for keeping scrub statistics. */
struct btr_scrub_stat_t {
/* page reorganizations */
ulint page_reorganizations;
/* page splits */
ulint page_splits;
/* scrub failures */
ulint page_split_failures_underflow;
ulint page_split_failures_out_of_filespace;
ulint page_split_failures_missing_index;
ulint page_split_failures_unknown;
};
/**************************************************************//**
struct for thread local scrub state. */
struct btr_scrub_t {
/* current space */
ulint space;
/* is scrubbing enabled for this space */
bool scrubbing;
/* is current space compressed */
bool compressed;
dict_table_t* current_table;
dict_index_t* current_index;
/* savepoint for X_LATCH of block */
ulint savepoint;
/* statistic counters */
btr_scrub_stat_t scrub_stat;
};
/*********************************************************************
Init scrub global variables */
UNIV_INTERN
void
btr_scrub_init();
/*********************************************************************
Cleanup scrub globals */
UNIV_INTERN
void
btr_scrub_cleanup();
/***********************************************************************
Return crypt statistics */
UNIV_INTERN
void
btr_scrub_total_stat(
/*==================*/
btr_scrub_stat_t *stat); /*!< out: stats to update */
/**************************************************************//**
Check if a page needs scrubbing
* @return BTR_SCRUB_PAGE if page should be scrubbed
* else btr_scrub_skip_page should be called
* with this return value (and without any latches held)
*/
UNIV_INTERN
int
btr_page_needs_scrubbing(
/*=====================*/
btr_scrub_t* scrub_data, /*!< in: scrub data */
buf_block_t* block, /*!< in: block to check, latched */
btr_scrub_page_allocation_status_t allocated); /*!< in: is block
allocated, free or
unknown */
/****************************************************************
Recheck if a page needs scrubbing, and if it does load appropriate
table and index
* @return BTR_SCRUB_PAGE if page should be scrubbed
* else btr_scrub_skip_page should be called
* with this return value (and without any latches held)
*/
UNIV_INTERN
int
btr_scrub_recheck_page(
/*====================*/
btr_scrub_t* scrub_data, /*!< inut: scrub data */
buf_block_t* block, /*!< in: block */
btr_scrub_page_allocation_status_t allocated, /*!< in: is block
allocated or free */
mtr_t* mtr); /*!< in: mtr */
/****************************************************************
Perform actual scrubbing of page */
UNIV_INTERN
int
btr_scrub_page(
/*============*/
btr_scrub_t* scrub_data, /*!< in/out: scrub data */
buf_block_t* block, /*!< in: block */
btr_scrub_page_allocation_status_t allocated, /*!< in: is block
allocated or free */
mtr_t* mtr); /*!< in: mtr */
/****************************************************************
Perform cleanup needed for a page not needing scrubbing */
UNIV_INTERN
void
btr_scrub_skip_page(
/*============*/
btr_scrub_t* scrub_data, /*!< in/out: scrub data */
int needs_scrubbing); /*!< in: return value from
btr_page_needs_scrubbing or
btr_scrub_recheck_page which encodes what kind
of cleanup is needed */
/****************************************************************
Start iterating a space
* @return true if scrubbing is turned on */
UNIV_INTERN
bool
btr_scrub_start_space(
/*===================*/
ulint space, /*!< in: space */
btr_scrub_t* scrub_data); /*!< in/out: scrub data */
/** Complete iterating a space.
@param[in,out] scrub_data scrub data */
UNIV_INTERN
void
btr_scrub_complete_space(btr_scrub_t* scrub_data);
#endif
......@@ -93,11 +93,6 @@ struct fil_space_rotate_state_t
space */
bool starting; /*!< initial write of IV */
bool flushing; /*!< space is being flushed at end of rotate */
struct {
bool is_active; /*!< is scrubbing active in this space */
time_t last_scrub_completed; /*!< when was last scrub
completed */
} scrubbing;
};
#ifndef UNIV_INNOCHECKSUM
......@@ -226,18 +221,6 @@ struct fil_crypt_stat_t {
ulint estimated_iops;
};
/** Status info about scrubbing */
struct fil_space_scrub_status_t {
ulint space; /*!< tablespace id */
bool compressed; /*!< is space compressed */
time_t last_scrub_completed; /*!< when was last scrub completed */
bool scrubbing; /*!< is scrubbing ongoing */
time_t current_scrub_started; /*!< when started current scrubbing */
ulint current_scrub_active_threads; /*!< current scrub active threads */
ulint current_scrub_page_number; /*!< current scrub page no */
ulint current_scrub_max_page_number; /*!< current scrub max page no */
};
/*********************************************************************
Init space crypt */
UNIV_INTERN
......@@ -449,18 +432,6 @@ void
fil_crypt_total_stat(
fil_crypt_stat_t *stat);
/**
Get scrub status for a space (used by information_schema)
@param[in] space Tablespace
@param[out] status Scrub status
return 0 if data found */
UNIV_INTERN
void
fil_space_get_scrub_status(
const fil_space_t* space,
fil_space_scrub_status_t* status);
#include "fil0crypt.ic"
#endif /* !UNIV_INNOCHECKSUM */
......
......@@ -454,6 +454,7 @@ extern ulong srv_replication_delay;
extern my_bool innodb_encrypt_temporary_tables;
extern my_bool srv_immediate_scrub_data_uncompressed;
/*-------------------------------------------*/
/** Modes of operation */
......@@ -958,13 +959,6 @@ struct export_var_t{
ulint innodb_encryption_rotation_estimated_iops;
int64_t innodb_encryption_key_requests;
int64_t innodb_key_rotation_list_length;
ulint innodb_scrub_page_reorganizations;
ulint innodb_scrub_page_splits;
ulint innodb_scrub_page_split_failures_underflow;
ulint innodb_scrub_page_split_failures_out_of_filespace;
ulint innodb_scrub_page_split_failures_missing_index;
ulint innodb_scrub_page_split_failures_unknown;
};
/** Thread slot in the thread table. */
......
......@@ -72,7 +72,6 @@ Created 10/8/1995 Heikki Tuuri
#include "fil0fil.h"
#include "fil0crypt.h"
#include "fil0pagecompress.h"
#include "btr0scrub.h"
#include <my_service_manager.h>
......@@ -403,6 +402,8 @@ my_bool srv_force_primary_key;
/** Key version to encrypt the temporary tablespace */
my_bool innodb_encrypt_temporary_tables;
my_bool srv_immediate_scrub_data_uncompressed;
/* Array of English strings describing the current state of an
i/o handler thread */
......@@ -1113,11 +1114,9 @@ srv_export_innodb_status(void)
/*==========================*/
{
fil_crypt_stat_t crypt_stat;
btr_scrub_stat_t scrub_stat;
if (!srv_read_only_mode) {
fil_crypt_total_stat(&crypt_stat);
btr_scrub_total_stat(&scrub_stat);
}
#ifdef BTR_CUR_HASH_ADAPT
......@@ -1346,19 +1345,6 @@ srv_export_innodb_status(void)
srv_stats.n_key_requests;
export_vars.innodb_key_rotation_list_length =
srv_stats.key_rotation_list_length;
export_vars.innodb_scrub_page_reorganizations =
scrub_stat.page_reorganizations;
export_vars.innodb_scrub_page_splits =
scrub_stat.page_splits;
export_vars.innodb_scrub_page_split_failures_underflow =
scrub_stat.page_split_failures_underflow;
export_vars.innodb_scrub_page_split_failures_out_of_filespace =
scrub_stat.page_split_failures_out_of_filespace;
export_vars.innodb_scrub_page_split_failures_missing_index =
scrub_stat.page_split_failures_missing_index;
export_vars.innodb_scrub_page_split_failures_unknown =
scrub_stat.page_split_failures_unknown;
}
mutex_exit(&srv_innodb_monitor_mutex);
......
......@@ -100,7 +100,6 @@ Created 2/16/1996 Heikki Tuuri
#include "os0event.h"
#include "zlib.h"
#include "ut0crc32.h"
#include "btr0scrub.h"
/** Log sequence number at shutdown */
lsn_t srv_shutdown_lsn;
......@@ -2028,7 +2027,6 @@ dberr_t srv_start(bool create_new_db)
will flush dirty pages and that might need e.g.
fil_crypt_threads_event. */
fil_system_enter();
btr_scrub_init();
fil_crypt_threads_init();
fil_system_exit();
......@@ -2136,7 +2134,6 @@ void innodb_shutdown()
fts_optimize_shutdown(); dict_stats_shutdown(); */
fil_crypt_threads_cleanup();
btr_scrub_cleanup();
btr_defragment_shutdown();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment