Skip to content

Commit ca0c96f

Browse files
committed
Adjust table_open_cache to avoid getting error 24 (too many open files)
MDEV--15609 engines/funcs.crash_manytables_number crashes with error 24 (too many open files) MDEV-10286 Adjustment of table_open_cache according to system limits does not work when open-files-limit option is provided Fixed by adjusting tc_size downwards if there is not enough file descriptors to use. Other changes: - Ensure that there is 30 (was 10) extra file descriptors for other usage - Decrease TABLE_OPEN_CACHE_MIN to 200 as it's better to have a smaller table cache than getting error 24 - Increase minimum of max_connections and table_open_cache from 1 to 10 as 1 is not usable for any real application, only for testing.
1 parent 4d83b01 commit ca0c96f

29 files changed

+193
-85
lines changed

mysql-test/mysql-test-run.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4458,6 +4458,7 @@ ($$)
44584458
qr|SSL error: Failed to set ciphers to use|,
44594459
qr/Plugin 'InnoDB' will be forced to shutdown/,
44604460
qr|Could not increase number of max_open_files to more than|,
4461+
qr|Changed limits: max_open_files|,
44614462
qr/InnoDB: Error table encrypted but encryption service not available.*/,
44624463
qr/InnoDB: Could not find a valid tablespace file for*/,
44634464
qr/InnoDB: Tablespace open failed for*/,

mysql-test/r/connect.result

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ drop table t1;
147147
CREATE USER mysqltest_u1@localhost;
148148
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
149149

150-
SET GLOBAL max_connections = 3;
150+
SET GLOBAL max_connections = 10;
151151
SET GLOBAL event_scheduler = ON;
152152

153153
# -- Waiting for Event Scheduler to start...
@@ -191,6 +191,13 @@ event_scheduler
191191
mysqltest_u1
192192
mysqltest_u1
193193
mysqltest_u1
194+
mysqltest_u1
195+
mysqltest_u1
196+
mysqltest_u1
197+
mysqltest_u1
198+
mysqltest_u1
199+
mysqltest_u1
200+
mysqltest_u1
194201
root
195202

196203
# -- Resetting variables...

mysql-test/r/mdev375.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SET GLOBAL log_warnings=4;
2-
SET GLOBAL max_connections=2;
2+
SET GLOBAL max_connections=10;
33
SELECT 1;
44
1
55
1

mysql-test/r/myisam.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,9 +1906,9 @@ DROP TABLE t1;
19061906
#
19071907
# BUG#48438 - crash with error in unioned query against merge table and view...
19081908
#
1909-
SET GLOBAL table_open_cache=3;
1909+
SET GLOBAL table_open_cache=10;
19101910
CREATE TABLE t1(a INT);
1911-
SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE;
1911+
SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4, t1 AS a5, t1 AS a6, t1 AS a7, t1 AS a8, t1 AS a9, t1 AS a10, t1 AS a11 FOR UPDATE;
19121912
1
19131913
SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
19141914
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';

mysql-test/r/mysqld--help,win.rdiff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@
121121
sync-relay-log 10000
122122
sync-relay-log-info 10000
123123
sysdate-is-now FALSE
124-
-table-cache 431
124+
-table-cache 421
125125
+table-cache 2000
126126
table-definition-cache 400
127-
-table-open-cache 431
127+
-table-open-cache 421
128128
+table-open-cache 2000
129129
tc-heuristic-recover OFF
130130
thread-cache-size 0

mysql-test/r/mysqld--help.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,9 +1438,9 @@ sync-master-info 10000
14381438
sync-relay-log 10000
14391439
sync-relay-log-info 10000
14401440
sysdate-is-now FALSE
1441-
table-cache 431
1441+
table-cache 421
14421442
table-definition-cache 400
1443-
table-open-cache 431
1443+
table-open-cache 421
14441444
tc-heuristic-recover OFF
14451445
thread-cache-size 0
14461446
thread-pool-idle-timeout 60

mysql-test/r/sp.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7946,7 +7946,7 @@ CLOSE cur1;
79467946
end|
79477947
set @tmp_toc= @@table_open_cache;
79487948
set @tmp_tdc= @@table_definition_cache;
7949-
set global table_open_cache=1;
7949+
set global table_open_cache=10;
79507950
set global table_definition_cache=1;
79517951
Warnings:
79527952
Warning 1292 Truncated incorrect table_definition_cache value: '1'

mysql-test/r/variables.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,10 @@ Warnings:
748748
Warning 1292 Truncated incorrect table_open_cache value: '-1'
749749
SHOW VARIABLES LIKE 'table_open_cache';
750750
Variable_name Value
751-
table_open_cache 1
751+
table_open_cache 10
752752
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
753753
VARIABLE_NAME VARIABLE_VALUE
754-
TABLE_OPEN_CACHE 1
754+
TABLE_OPEN_CACHE 10
755755
SET GLOBAL table_open_cache=DEFAULT;
756756
set character_set_results=NULL;
757757
select ifnull(@@character_set_results,"really null");

mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ COUNT_UNKNOWN_ERRORS 0
525525
FIRST_ERROR_SEEN set
526526
LAST_ERROR_SEEN set
527527
set global max_user_connections = 0;
528-
set global max_connections = 3;
528+
set global max_connections = 10;
529529
flush user_resources;
530530
select "Con4a is alive";
531531
Con4a is alive

mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ COUNT_UNKNOWN_ERRORS 0
525525
FIRST_ERROR_SEEN set
526526
LAST_ERROR_SEEN set
527527
set global max_user_connections = 0;
528-
set global max_connections = 3;
528+
set global max_connections = 10;
529529
flush user_resources;
530530
select "Con4a is alive";
531531
Con4a is alive

0 commit comments

Comments
 (0)