summaryrefslogtreecommitdiff
path: root/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_rate_limiter_bytes_per_sec_basic.test
blob: 1daa9898c1ae69cf1ab73cfd9f73f410a6a4a984 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--source include/have_rocksdb.inc

# Attempt to set the value - this should generate a warning as we can't set it to or from 0
SET @@global.rocksdb_rate_limiter_bytes_per_sec = 10000;

# Now shut down and come back up with the rate limiter enabled and retest setting the variable

# Write file to make mysql-test-run.pl expect the "crash", but don't restart the
# server until it is told to
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" >$_expect_file_name

# Send shutdown to the connected server and give it 10 seconds to die before
# zapping it
shutdown_server;

# Attempt to restart the server with the rate limiter on
--exec echo "restart:--rocksdb_rate_limiter_bytes_per_sec=10000" >$_expect_file_name
--sleep 5

# Wait for reconnect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect

# The valid_values table lists the values that we want to make sure that the system will allow
# us to set for rocksdb_rate_limiter_bytes_per_sec
CREATE TABLE valid_values (value varchar(255)) ENGINE=myisam;
INSERT INTO valid_values VALUES(1), (1000), (1000000), (1000000000), (1000000000000);

# The invalid_values table lists the values that we don't want to allow for the variable
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam;
INSERT INTO invalid_values VALUES('\'aaa\''), (3.14);

# Test all the valid and invalid values
--let $sys_var=ROCKSDB_RATE_LIMITER_BYTES_PER_SEC
--let $session=0
--source include/rocksdb_sys_var.inc

DROP TABLE valid_values;
DROP TABLE invalid_values;

# Zero is an invalid value if the rate limiter is turned on, but it won't be rejected by the
# SET command but will generate a warning.

# Attempt to set the value to 0 - this should generate a warning as we can't set it to or from 0
SET @@global.rocksdb_rate_limiter_bytes_per_sec = 0;

# Attempt to set the value to -1 - this should first truncate to 0 and then generate a warning as
# we can't set it to or from 0
SET @@global.rocksdb_rate_limiter_bytes_per_sec = -1;

# Restart the server without the rate limiter
--exec echo "wait" >$_expect_file_name
shutdown_server;
--exec echo "restart" >$_expect_file_name
--sleep 5

# Wait for reconnect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect