From ca0c96fc8925d36ea0c5121520bf7d8f12ad90a5 Mon Sep 17 00:00:00 2001
From: Monty <monty@mariadb.org>
Date: Thu, 22 Mar 2018 20:03:54 +0200
Subject: 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.
---
 mysql-test/r/variables.result | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'mysql-test/r/variables.result')

diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index b621fc13ee4..a01c8f48a4d 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -748,10 +748,10 @@ Warnings:
 Warning	1292	Truncated incorrect table_open_cache value: '-1'
 SHOW VARIABLES LIKE 'table_open_cache';
 Variable_name	Value
-table_open_cache	1
+table_open_cache	10
 SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
 VARIABLE_NAME	VARIABLE_VALUE
-TABLE_OPEN_CACHE	1
+TABLE_OPEN_CACHE	10
 SET GLOBAL table_open_cache=DEFAULT;
 set character_set_results=NULL;
 select ifnull(@@character_set_results,"really null");
-- 
cgit v1.2.1


From 8ff897265a32898dd533c8da504937872ffa3935 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= <vicentiu@mariadb.org>
Date: Mon, 9 Apr 2018 16:49:41 +0300
Subject: Update test cases post MDEV-10286

Table_open_cache gets adjusted on server startup to prevent an out of
file descriptor error. However this means that when we reset its value
to default, it does not get re-adjusted. This leads to the mtr
consistency check to fail with different server status at the end of the
test case as opposed to when it started.

To fix the problem, do not make use of the DEFAULT keyword to set the
variable back, instead save the value before any modifications and
restore it from there.
---
 mysql-test/r/variables.result | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'mysql-test/r/variables.result')

diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index a01c8f48a4d..df0d16237ac 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -568,6 +568,7 @@ set sql_safe_updates=1;
 set sql_select_limit=1;
 set sql_select_limit=default;
 set sql_warnings=1;
+set @save_table_open_cache=@@table_open_cache;
 set global table_open_cache=100;
 set default_storage_engine=myisam;
 set global thread_cache_size=100;
@@ -752,7 +753,7 @@ table_open_cache	10
 SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
 VARIABLE_NAME	VARIABLE_VALUE
 TABLE_OPEN_CACHE	10
-SET GLOBAL table_open_cache=DEFAULT;
+SET GLOBAL table_open_cache=@save_table_open_cache;
 set character_set_results=NULL;
 select ifnull(@@character_set_results,"really null");
 ifnull(@@character_set_results,"really null")
-- 
cgit v1.2.1