From 458f07519c830ddc46d082246dad0ad7cb93f71c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 May 2004 16:42:29 +0400 Subject: [PATCH] Fix for Bug#3754 "SET GLOBAL myisam_max_sort_file_size doesn't work as expected": precision-losing conversion removed from sys_var_thd_ulonglong. mysql-test/r/variables.result: Test case for Bug#3754 mysql-test/t/variables.test: Test case for Bug#3754 sql/set_var.cc: Fix for Bug#3754: precision-losing conversion removed from sys_var_thd_ulonglong. --- mysql-test/r/variables.result | 4 ++++ mysql-test/t/variables.test | 8 +++++++- sql/set_var.cc | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index b4a607cb174..f84364089bc 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -377,3 +377,7 @@ select 1; 1 select @@session.key_buffer_size; Variable 'key_buffer_size' is a GLOBAL variable +set global myisam_max_sort_file_size=4294967296; +show global variables like 'myisam_max_sort_file_size'; +Variable_name Value +myisam_max_sort_file_size 4294967296 diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index ec86a763023..e59667d6af4 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -268,4 +268,10 @@ select @@xxxxxxxxxx; select 1; --error 1238 -select @@session.key_buffer_size; \ No newline at end of file +select @@session.key_buffer_size; + +# Bug#3754 SET GLOBAL myisam_max_sort_file_size doesn't work as +# expected: check that there is no overflow when 64-bit unsigned +# variables are set +set global myisam_max_sort_file_size=4294967296; +show global variables like 'myisam_max_sort_file_size'; diff --git a/sql/set_var.cc b/sql/set_var.cc index eb94ad2ebf6..1657d0d0bcb 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -965,11 +965,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) { ulonglong tmp= var->value->val_int(); - if ((ulonglong) tmp > max_system_variables.*offset) + if (tmp > max_system_variables.*offset) tmp= max_system_variables.*offset; if (option_limits) - tmp= (ulong) getopt_ull_limit_value(tmp, option_limits); + tmp= getopt_ull_limit_value(tmp, option_limits); if (var->type == OPT_GLOBAL) { /* Lock is needed to make things safe on 32 bit systems */