summaryrefslogtreecommitdiff
path: root/storage/rocksdb/mysql-test/rocksdb/t/max_open_files.test
blob: c7c5e7b2ef33db622d23a2ab2ae59c2c8c9f9729 (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
--source include/have_rocksdb.inc

# Basic Sysbench run fails with basic MyROCKS install due to lack of open files

# test for over limit
CALL mtr.add_suppression("RocksDB: rocksdb_max_open_files should not be greater than the open_files_limit*");

--let $over_rocksdb_max_open_files=`SELECT @@global.open_files_limit + 100`
--let $under_rocksdb_max_open_files=`SELECT @@global.open_files_limit -1`
--let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/rocksdb.max_open_files.err
--let SEARCH_PATTERN=RocksDB: rocksdb_max_open_files should not be greater than the open_files_limit

--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $over_rocksdb_max_open_files over_rocksdb_max_open_files
--let $_mysqld_option=--log-error=$SEARCH_FILE --rocksdb_max_open_files=$over_rocksdb_max_open_files
--source include/restart_mysqld_with_option.inc
--source include/search_pattern_in_file.inc

SELECT FLOOR(@@global.open_files_limit / 2) = @@global.rocksdb_max_open_files;

# test for within limit
--let $_mysqld_option=--rocksdb_max_open_files=$under_rocksdb_max_open_files
--source include/restart_mysqld_with_option.inc

SELECT @@global.open_files_limit - 1 = @@global.rocksdb_max_open_files;

# test for minimal value
--let $_mysqld_option=--rocksdb_max_open_files=0
--source include/restart_mysqld_with_option.inc

SELECT @@global.rocksdb_max_open_files;

# verify that we can still do work with no descriptor cache
CREATE TABLE t1(a INT) ENGINE=ROCKSDB;
INSERT INTO t1 VALUES(0),(1),(2),(3),(4);
SET GLOBAL rocksdb_force_flush_memtable_and_lzero_now=1;
DROP TABLE t1;

# test for unlimited
--let $_mysqld_option=--rocksdb_max_open_files=-1
--source include/restart_mysqld_with_option.inc

SELECT @@global.rocksdb_max_open_files;

# test for auto-tune
--let $_mysqld_option=--rocksdb_max_open_files=-2
--source include/restart_mysqld_with_option.inc

SELECT FLOOR(@@global.open_files_limit / 2) = @@global.rocksdb_max_open_files;

# cleanup
--let _$mysqld_option=
--source include/restart_mysqld.inc
--remove_file $SEARCH_FILE