mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
162 lines
3.9 KiB
Plaintext
162 lines
3.9 KiB
Plaintext
-- source include/have_innodb.inc
|
|
-- source include/not_embedded.inc
|
|
-- source include/have_example_key_management_plugin.inc
|
|
-- source include/not_windows.inc
|
|
|
|
let $MYSQLD_DATADIR=`select @@datadir`;
|
|
let ib1_IBD = $MYSQLD_DATADIR/ibdata1;
|
|
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
|
|
let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd;
|
|
let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd;
|
|
|
|
let $rowcount=500;
|
|
|
|
-- echo # make sure spaces are checked quickly
|
|
SET GLOBAL innodb_background_scrub_data_check_interval=1;
|
|
|
|
-- echo #
|
|
-- echo # Test delete of records
|
|
-- echo #
|
|
|
|
eval create table t1 (
|
|
a int auto_increment primary key,
|
|
b varchar(256),
|
|
c text) engine = innodb row_format=compressed;
|
|
|
|
let $numinserts = $rowcount;
|
|
-- echo # Populate table with rows
|
|
--disable_query_log
|
|
while ($numinserts)
|
|
{
|
|
dec $numinserts;
|
|
insert into t1(b,c) values ('bicycle', repeat('repairman', 1000));
|
|
}
|
|
--enable_query_log
|
|
|
|
delete from t1;
|
|
|
|
-- echo #
|
|
-- echo # Test delete+rollback+delete
|
|
-- echo #
|
|
|
|
eval create table t2 (
|
|
a int auto_increment primary key,
|
|
b varchar(256),
|
|
c text) engine = innodb row_format=compressed;
|
|
|
|
let $numinserts = $rowcount;
|
|
-- echo # Populate table with rows
|
|
--disable_query_log
|
|
while ($numinserts)
|
|
{
|
|
dec $numinserts;
|
|
insert into t2(b,c) values ('boondoggle', repeat('waste of time', 1000));
|
|
}
|
|
--enable_query_log
|
|
|
|
begin;
|
|
delete from t2;
|
|
rollback;
|
|
delete from t2;
|
|
|
|
-- echo #
|
|
-- echo # Test insert+rollback
|
|
-- echo #
|
|
|
|
eval create table t3 (
|
|
a int auto_increment primary key,
|
|
b varchar(256),
|
|
c text) engine = innodb row_format=compressed;
|
|
|
|
let $numinserts = $rowcount;
|
|
-- echo # Populate table with rows
|
|
begin;
|
|
--disable_query_log
|
|
while ($numinserts)
|
|
{
|
|
dec $numinserts;
|
|
insert into t3(b,c) values ('keso', repeat('kent', 1000));
|
|
}
|
|
--enable_query_log
|
|
|
|
rollback;
|
|
|
|
-- echo # start scrubbing threads
|
|
SET GLOBAL innodb_encryption_threads=5;
|
|
-- echo # Wait max 10 min for scrubbing of this table
|
|
let $cnt=600;
|
|
while ($cnt)
|
|
{
|
|
let $success=`SELECT COUNT(*) = 0
|
|
FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING
|
|
WHERE LAST_SCRUB_COMPLETED IS NULL AND ( NAME like 'test/%' OR SPACE = 0 )`;
|
|
|
|
if ($success)
|
|
{
|
|
let $cnt=0;
|
|
}
|
|
if (!$success)
|
|
{
|
|
real_sleep 1;
|
|
dec $cnt;
|
|
}
|
|
}
|
|
if (!$success)
|
|
{
|
|
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING;
|
|
SHOW STATUS LIKE 'innodb_%scrub%';
|
|
-- die Timeout waiting for background threads
|
|
}
|
|
-- echo # Success!
|
|
-- echo # stop scrubbing threads
|
|
SET GLOBAL innodb_encryption_threads=0;
|
|
|
|
--echo # Now there should be background scrubs
|
|
let $success=`select sum(variable_value) > 0
|
|
from information_schema.global_status
|
|
where variable_name in ('innodb_scrub_background_page_reorganizations',
|
|
'innodb_scrub_background_page_splits')`;
|
|
|
|
if (!$success) {
|
|
show status like 'innodb_scrub%';
|
|
}
|
|
|
|
-- echo # restart mysqld so that all pages are flushed (encryption off)
|
|
-- echo # so that grep will find stuff
|
|
-- source include/restart_mysqld.inc
|
|
-- echo # read all rows from table
|
|
-- disable_result_log
|
|
select * from t1;
|
|
select * from t2;
|
|
select * from t3;
|
|
-- enable_result_log
|
|
|
|
-- echo # grep -c bicycle t1.ibd
|
|
-- exec grep -c bicycle $t1_IBD || true
|
|
-- echo # grep -c bicycle ibdata1
|
|
-- exec grep -c bicycle $ib1_IBD || true
|
|
-- echo # grep -c repairman t1.ibd
|
|
-- exec grep -c repairman $t1_IBD || true
|
|
-- echo # grep -c repairman ibdata1
|
|
-- exec grep -c repairman $ib1_IBD || true
|
|
|
|
-- echo # grep -c boondoggle t2.ibd
|
|
-- exec grep -c boondoggle $t2_IBD || true
|
|
-- echo # grep -c boondoggle ibdata1
|
|
-- exec grep -c boondoggle $ib1_IBD || true
|
|
-- echo # grep -c waste t2.ibd
|
|
-- exec grep -c waste $t2_IBD || true
|
|
-- echo # grep -c waste ibdata1
|
|
-- exec grep -c waste $ib1_IBD || true
|
|
|
|
-- echo # grep -c keso t3.ibd
|
|
-- exec grep -c keso $t3_IBD || true
|
|
-- echo # grep -c keso ibdata1
|
|
-- exec grep -c keso $ib1_IBD || true
|
|
-- echo # grep -c kent t3.ibd
|
|
-- exec grep -c kent $t3_IBD || true
|
|
-- echo # grep -c kent ibdata1
|
|
-- exec grep -c kent $ib1_IBD || true
|
|
|
|
drop table t1, t2, t3;
|