Commit 8ffbb825 authored by Daniel Black's avatar Daniel Black Committed by Sergey Vojtovich

increase upper value of max_prepared_stmt_count to UINT32_MAX

The upper 1M limit for max_prepared_stmt_count was set over 10 years
ago. It doesn't suite current hardware and a sysbench oltp_read_write
test with 512 threads will hit this limit.
parent 10f6b700
...@@ -3,4 +3,4 @@ MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d ...@@ -3,4 +3,4 @@ MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
MySQL error code 1408 (ER_STARTUP): %s: ready for connections. MySQL error code 1408 (ER_STARTUP): %s: ready for connections.
Version: '%s' socket: '%s' port: %d %s Version: '%s' socket: '%s' port: %d %s
MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Table upgrade required. Please do "REPAIR TABLE `%-.32s`" or dump/reload to fix it! MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Table upgrade required. Please do "REPAIR TABLE `%-.32s`" or dump/reload to fix it!
MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %lu) MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u)
...@@ -820,7 +820,7 @@ Warnings: ...@@ -820,7 +820,7 @@ Warnings:
Warning 1292 Truncated incorrect max_prepared_stmt_count value: '10000000000000000' Warning 1292 Truncated incorrect max_prepared_stmt_count value: '10000000000000000'
select @@max_prepared_stmt_count; select @@max_prepared_stmt_count;
@@max_prepared_stmt_count @@max_prepared_stmt_count
1048576 4294967295
set global max_prepared_stmt_count=default; set global max_prepared_stmt_count=default;
select @@max_prepared_stmt_count; select @@max_prepared_stmt_count;
@@max_prepared_stmt_count @@max_prepared_stmt_count
......
...@@ -46,40 +46,40 @@ Warnings: ...@@ -46,40 +46,40 @@ Warnings:
Warning 1292 Truncated incorrect max_prepared_stmt_count value: '100000000000' Warning 1292 Truncated incorrect max_prepared_stmt_count value: '100000000000'
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count @@global.max_prepared_stmt_count
1048576 4294967295
SET @@global.max_prepared_stmt_count = 10000.01; SET @@global.max_prepared_stmt_count = 10000.01;
ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count' ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count'
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count @@global.max_prepared_stmt_count
1048576 4294967295
SET @@global.max_prepared_stmt_count = -1024; SET @@global.max_prepared_stmt_count = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_prepared_stmt_count value: '-1024' Warning 1292 Truncated incorrect max_prepared_stmt_count value: '-1024'
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count @@global.max_prepared_stmt_count
0 0
SET @@global.max_prepared_stmt_count = 1048577; SET @@global.max_prepared_stmt_count = 4294967296;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_prepared_stmt_count value: '1048577' Warning 1292 Truncated incorrect max_prepared_stmt_count value: '4294967296'
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count @@global.max_prepared_stmt_count
1048576 4294967295
SET @@global.max_prepared_stmt_count = 104857612; SET @@global.max_prepared_stmt_count = 4294967295*1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_prepared_stmt_count value: '104857612' Warning 1292 Truncated incorrect max_prepared_stmt_count value: '4398046510080'
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count @@global.max_prepared_stmt_count
1048576 4294967295
SET @@global.max_prepared_stmt_count = ON; SET @@global.max_prepared_stmt_count = ON;
ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count' ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count'
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count @@global.max_prepared_stmt_count
1048576 4294967295
SET @@global.max_prepared_stmt_count = 'test'; SET @@global.max_prepared_stmt_count = 'test';
ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count' ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count'
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count @@global.max_prepared_stmt_count
1048576 4294967295
'#-------------------FN_DYNVARS_081_05----------------------------#' '#-------------------FN_DYNVARS_081_05----------------------------#'
SET @@session.max_prepared_stmt_count = 4096; SET @@session.max_prepared_stmt_count = 4096;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
......
...@@ -92,9 +92,9 @@ SET @@global.max_prepared_stmt_count = 10000.01; ...@@ -92,9 +92,9 @@ SET @@global.max_prepared_stmt_count = 10000.01;
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
SET @@global.max_prepared_stmt_count = -1024; SET @@global.max_prepared_stmt_count = -1024;
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
SET @@global.max_prepared_stmt_count = 1048577; SET @@global.max_prepared_stmt_count = 4294967296;
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
SET @@global.max_prepared_stmt_count = 104857612; SET @@global.max_prepared_stmt_count = 4294967295*1024;
SELECT @@global.max_prepared_stmt_count; SELECT @@global.max_prepared_stmt_count;
--Error ER_WRONG_TYPE_FOR_VAR --Error ER_WRONG_TYPE_FOR_VAR
......
...@@ -532,7 +532,7 @@ bool max_user_connections_checking=0; ...@@ -532,7 +532,7 @@ bool max_user_connections_checking=0;
Limit of the total number of prepared statements in the server. Limit of the total number of prepared statements in the server.
Is necessary to protect the server against out-of-memory attacks. Is necessary to protect the server against out-of-memory attacks.
*/ */
ulong max_prepared_stmt_count; uint max_prepared_stmt_count;
/** /**
Current total number of prepared statements in the server. This number Current total number of prepared statements in the server. This number
is exact, and therefore may not be equal to the difference between is exact, and therefore may not be equal to the difference between
...@@ -543,7 +543,7 @@ ulong max_prepared_stmt_count; ...@@ -543,7 +543,7 @@ ulong max_prepared_stmt_count;
two different connections, this counts as two distinct prepared two different connections, this counts as two distinct prepared
statements. statements.
*/ */
ulong prepared_stmt_count=0; uint prepared_stmt_count=0;
ulong thread_id=1L,current_pid; ulong thread_id=1L,current_pid;
ulong slow_launch_threads = 0; ulong slow_launch_threads = 0;
uint sync_binlog_period= 0, sync_relaylog_period= 0, uint sync_binlog_period= 0, sync_relaylog_period= 0,
......
...@@ -178,7 +178,7 @@ extern ulong slave_trans_retries; ...@@ -178,7 +178,7 @@ extern ulong slave_trans_retries;
extern uint slave_net_timeout; extern uint slave_net_timeout;
extern int max_user_connections; extern int max_user_connections;
extern ulong what_to_log,flush_time; extern ulong what_to_log,flush_time;
extern ulong max_prepared_stmt_count, prepared_stmt_count; extern uint max_prepared_stmt_count, prepared_stmt_count;
extern ulong open_files_limit; extern ulong open_files_limit;
extern ulonglong binlog_cache_size, binlog_stmt_cache_size; extern ulonglong binlog_cache_size, binlog_stmt_cache_size;
extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size; extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
......
...@@ -5577,8 +5577,8 @@ ER_SP_NO_AGGREGATE 42000 ...@@ -5577,8 +5577,8 @@ ER_SP_NO_AGGREGATE 42000
eng "AGGREGATE is not supported for stored functions" eng "AGGREGATE is not supported for stored functions"
ger "AGGREGATE wird bei gespeicherten Funktionen nicht unterstützt" ger "AGGREGATE wird bei gespeicherten Funktionen nicht unterstützt"
ER_MAX_PREPARED_STMT_COUNT_REACHED 42000 ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)" eng "Can't create more than max_prepared_stmt_count statements (current value: %u)"
ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %lu)" ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %u)"
ER_VIEW_RECURSIVE ER_VIEW_RECURSIVE
eng "`%-.192s`.`%-.192s` contains view recursion" eng "`%-.192s`.`%-.192s` contains view recursion"
ger "`%-.192s`.`%-.192s` enthält View-Rekursion" ger "`%-.192s`.`%-.192s` enthält View-Rekursion"
......
...@@ -1932,11 +1932,11 @@ static Sys_var_ulong Sys_max_long_data_size( ...@@ -1932,11 +1932,11 @@ static Sys_var_ulong Sys_max_long_data_size(
BLOCK_SIZE(1)); BLOCK_SIZE(1));
static PolyLock_mutex PLock_prepared_stmt_count(&LOCK_prepared_stmt_count); static PolyLock_mutex PLock_prepared_stmt_count(&LOCK_prepared_stmt_count);
static Sys_var_ulong Sys_max_prepared_stmt_count( static Sys_var_uint Sys_max_prepared_stmt_count(
"max_prepared_stmt_count", "max_prepared_stmt_count",
"Maximum number of prepared statements in the server", "Maximum number of prepared statements in the server",
GLOBAL_VAR(max_prepared_stmt_count), CMD_LINE(REQUIRED_ARG), GLOBAL_VAR(max_prepared_stmt_count), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1024*1024), DEFAULT(16382), BLOCK_SIZE(1), VALID_RANGE(0, UINT_MAX32), DEFAULT(16382), BLOCK_SIZE(1),
&PLock_prepared_stmt_count); &PLock_prepared_stmt_count);
static Sys_var_ulong Sys_max_sort_length( static Sys_var_ulong Sys_max_sort_length(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment