1--source include/have_rocksdb.inc
2
3# Basic Sysbench run fails with basic MyROCKS install due to lack of open files
4
5# test for over limit
6CALL mtr.add_suppression("RocksDB: rocksdb_max_open_files should not be greater than the open_files_limit*");
7
8--let $over_rocksdb_max_open_files=`SELECT @@global.open_files_limit + 100`
9--let $under_rocksdb_max_open_files=`SELECT @@global.open_files_limit -1`
10--let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/rocksdb.max_open_files.err
11--let SEARCH_PATTERN=RocksDB: rocksdb_max_open_files should not be greater than the open_files_limit
12
13--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $over_rocksdb_max_open_files over_rocksdb_max_open_files
14--let $_mysqld_option=--log-error=$SEARCH_FILE --rocksdb_max_open_files=$over_rocksdb_max_open_files
15--source include/restart_mysqld_with_option.inc
16--source include/search_pattern_in_file.inc
17
18SELECT FLOOR(@@global.open_files_limit / 2) = @@global.rocksdb_max_open_files;
19
20# test for within limit
21--let $_mysqld_option=--rocksdb_max_open_files=$under_rocksdb_max_open_files
22--source include/restart_mysqld_with_option.inc
23
24SELECT @@global.open_files_limit - 1 = @@global.rocksdb_max_open_files;
25
26# test for minimal value
27--let $_mysqld_option=--rocksdb_max_open_files=0
28--source include/restart_mysqld_with_option.inc
29
30SELECT @@global.rocksdb_max_open_files;
31
32# verify that we can still do work with no descriptor cache
33CREATE TABLE t1(a INT) ENGINE=ROCKSDB;
34INSERT INTO t1 VALUES(0),(1),(2),(3),(4);
35SET GLOBAL rocksdb_force_flush_memtable_and_lzero_now=1;
36DROP TABLE t1;
37
38# test for unlimited
39--let $_mysqld_option=--rocksdb_max_open_files=-1
40--source include/restart_mysqld_with_option.inc
41
42SELECT @@global.rocksdb_max_open_files;
43
44# test for auto-tune
45--let $_mysqld_option=--rocksdb_max_open_files=-2
46--source include/restart_mysqld_with_option.inc
47
48SELECT FLOOR(@@global.open_files_limit / 2) = @@global.rocksdb_max_open_files;
49
50# cleanup
51--let _$mysqld_option=
52--source include/restart_mysqld.inc
53--remove_file $SEARCH_FILE
54