Commit 791e9fb3 authored by unknown's avatar unknown

Changed thd variables max_join_size and select_limit to type ha_rows.

This fixed some optimization problems when using -DBIG_TABLES
Portabilty fixes for OpenUnix and HPUX
Added C and C++ version numbers to mysqlbug


Docs/mysqld_error.txt:
  Added new error message
acinclude.m4:
  Fix for configure problem on OpenUnix
configure.in:
  Fix for OpenUnix
  Added C and C++ versions to mysqlbug
mysql-test/r/variables.result:
  Update of max_join_size handling
mysql-test/t/variables.test:
  Update of max_join_size handling
mysys/Makefile.am:
  Removed duplicate row
mysys/my_alloc.c:
  Safety fixes (not fatal)
scripts/Makefile.am:
  Added C and C++ compiler versions to mysqlbug
scripts/mysqlbug.sh:
  Added C and C++ compiler versions to mysqlbug
sql/item_func.cc:
  Fixed that user variables that changes are not threated as constants.
sql/item_func.h:
  Fixed that user variables that changes are not threated as constants.
sql/mysqld.cc:
  Changed thd variables max_join_size and select_limit to type ha_rows
sql/repl_failsafe.cc:
  Removed not needed cast
sql/set_var.cc:
  Changed thd variables max_join_size and select_limit to type ha_rows
sql/set_var.h:
  Changed thd variables max_join_size and select_limit to type ha_rows
sql/slave.cc:
  Removed not needed cast
sql/sql_class.h:
  Changed thd variables max_join_size and select_limit to type ha_rows
sql/sql_parse.cc:
  Removed not needed cast
  Fixed security problem with mysql_drop_db()
sql/sql_show.cc:
  Changed thd variables max_join_size and select_limit to type ha_rows
sql/structs.h:
  Changed thd variables max_join_size and select_limit to type ha_rows
parent 172d5acb
...@@ -300,7 +300,7 @@ ...@@ -300,7 +300,7 @@
#define ER_NOT_ALLOWED_COMMAND 1148 #define ER_NOT_ALLOWED_COMMAND 1148
"The used command is not allowed with this MySQL version", "The used command is not allowed with this MySQL version",
#define ER_SYNTAX_ERROR 1149 #define ER_SYNTAX_ERROR 1149
"You have an error in your SQL syntax", "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use",
#define ER_DELAYED_CANT_CHANGE_LOCK 1150 #define ER_DELAYED_CANT_CHANGE_LOCK 1150
"Delayed insert thread couldn't get requested lock for table %-.64s", "Delayed insert thread couldn't get requested lock for table %-.64s",
#define ER_TOO_MANY_DELAYED_THREADS 1151 #define ER_TOO_MANY_DELAYED_THREADS 1151
...@@ -358,7 +358,7 @@ ...@@ -358,7 +358,7 @@
#define ER_CHECK_NO_SUCH_TABLE 1177 #define ER_CHECK_NO_SUCH_TABLE 1177
"Can't open table", "Can't open table",
#define ER_CHECK_NOT_IMPLEMENTED 1178 #define ER_CHECK_NOT_IMPLEMENTED 1178
"The handler for the table doesn't support check/repair", "The handler for the table doesn't support %s",
#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 #define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
"You are not allowed to execute this command in a transaction", "You are not allowed to execute this command in a transaction",
#define ER_ERROR_DURING_COMMIT 1180 #define ER_ERROR_DURING_COMMIT 1180
...@@ -454,4 +454,24 @@ ...@@ -454,4 +454,24 @@
#define ER_DUP_ARGUMENT 1225 #define ER_DUP_ARGUMENT 1225
"Option '%s' used twice in statement", "Option '%s' used twice in statement",
#define ER_USER_LIMIT_REACHED 1226 #define ER_USER_LIMIT_REACHED 1226
"User '%-64s' has exceeded the '%s' resource (current value: %ld)", "User '%-.64s' has exceeded the '%s' resource (current value: %ld)",
#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227
"Access denied. You need the %-.128s privilege for this operation",
#define ER_LOCAL_VARIABLE 1228
"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL",
#define ER_GLOBAL_VARIABLE 1229
"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL",
#define ER_NO_DEFAULT 1230
"Variable '%-.64s' doesn't have a default value",
#define ER_WRONG_VALUE_FOR_VAR 1231
"Variable '%-.64s' can't be set to the value of '%-.64s'",
#define ER_WRONG_TYPE_FOR_VAR 1232
"Wrong argument type to variable '%-.64s'",
#define ER_VAR_CANT_BE_READ 1233
"Variable '%-.64s' can only be set, not read",
#define ER_CANT_USE_OPTION_HERE 1234
"Wrong usage/placement of '%s'",
#define 1235
"This version of MySQL doesn't yet support '%s'",
#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
...@@ -1211,7 +1211,9 @@ changequote(, )dnl ...@@ -1211,7 +1211,9 @@ changequote(, )dnl
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
changequote([, ])dnl changequote([, ])dnl
if test "$GCC" = yes; then if test "$GCC" = yes; then
ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ case `$CC --version 2>/dev/null` in
2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;;
esac
fi fi
;; ;;
# IRIX 6.2 and later require cc -n32. # IRIX 6.2 and later require cc -n32.
...@@ -1326,7 +1328,7 @@ AC_DEFUN(MYSQL_SYS_LARGEFILE, ...@@ -1326,7 +1328,7 @@ AC_DEFUN(MYSQL_SYS_LARGEFILE,
# Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not # Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not
# include #stdlib.h as this breaks things on Solaris # include #stdlib.h as default as this breaks things on Solaris
# (Conflicts with pthreads and big file handling) # (Conflicts with pthreads and big file handling)
m4_define([_AC_PROG_CXX_EXIT_DECLARATION], m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
...@@ -1336,7 +1338,8 @@ m4_define([_AC_PROG_CXX_EXIT_DECLARATION], ...@@ -1336,7 +1338,8 @@ m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \ 'extern "C" void exit (int);' \
'void exit (int);' 'void exit (int);' \
'#include <stdlib.h>'
do do
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <stdlib.h> _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <stdlib.h>
$ac_declaration], $ac_declaration],
......
...@@ -135,13 +135,19 @@ if test $? -eq "0" ...@@ -135,13 +135,19 @@ if test $? -eq "0"
then then
AC_MSG_CHECKING("C Compiler version"); AC_MSG_CHECKING("C Compiler version");
AC_MSG_RESULT("$CC $CC_VERSION") AC_MSG_RESULT("$CC $CC_VERSION")
else
CC_VERSION=""
fi fi
CXX_VERSION=`$CXX --version` CXX_VERSION=`$CXX --version`
if test $? -eq "0" if test $? -eq "0"
then then
AC_MSG_CHECKING("C++ compiler version"); AC_MSG_CHECKING("C++ compiler version");
AC_MSG_RESULT("$CXX $CXX_VERSION") AC_MSG_RESULT("$CXX $CXX_VERSION")
else
CXX_VERSION=""
fi fi
AC_SUBST(CXX_VERSION)
AC_SUBST(CC_VERSION)
# Fix for sgi gcc / sgiCC which tries to emulate gcc # Fix for sgi gcc / sgiCC which tries to emulate gcc
if test "$CC" = "sgicc" if test "$CC" = "sgicc"
...@@ -1228,7 +1234,7 @@ then ...@@ -1228,7 +1234,7 @@ then
# CC="$CC -Kthread -DOpenUNIX8"; # CC="$CC -Kthread -DOpenUNIX8";
# CXX="$CXX -Kthread -DOpenUNIX8"; # CXX="$CXX -Kthread -DOpenUNIX8";
CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CXX="$CXX -Kthread -DUNIXWARE_7"; CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
fi fi
AC_MSG_RESULT("yes") AC_MSG_RESULT("yes")
else else
......
...@@ -50,7 +50,7 @@ Variable_name Value ...@@ -50,7 +50,7 @@ Variable_name Value
max_join_size 100 max_join_size 100
show global variables like 'max_join_size'; show global variables like 'max_join_size';
Variable_name Value Variable_name Value
max_join_size 4294967295 max_join_size HA_POS_ERROR
set GLOBAL max_join_size=2000; set GLOBAL max_join_size=2000;
show global variables like 'max_join_size'; show global variables like 'max_join_size';
Variable_name Value Variable_name Value
...@@ -62,7 +62,7 @@ max_join_size 2000 ...@@ -62,7 +62,7 @@ max_join_size 2000
set GLOBAL max_join_size=DEFAULT; set GLOBAL max_join_size=DEFAULT;
show global variables like 'max_join_size'; show global variables like 'max_join_size';
Variable_name Value Variable_name Value
max_join_size 4294967295 max_join_size HA_POS_ERROR
set @@max_join_size=1000, @@global.max_join_size=2000; set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size; select @@local.max_join_size, @@global.max_join_size;
@@session.max_join_size @@global.max_join_size @@session.max_join_size @@global.max_join_size
......
...@@ -34,12 +34,15 @@ drop table t1; ...@@ -34,12 +34,15 @@ drop table t1;
set max_join_size=100; set max_join_size=100;
show variables like 'max_join_size'; show variables like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size'; show global variables like 'max_join_size';
set GLOBAL max_join_size=2000; set GLOBAL max_join_size=2000;
show global variables like 'max_join_size'; show global variables like 'max_join_size';
set max_join_size=DEFAULT; set max_join_size=DEFAULT;
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show variables like 'max_join_size'; show variables like 'max_join_size';
set GLOBAL max_join_size=DEFAULT; set GLOBAL max_join_size=DEFAULT;
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size'; show global variables like 'max_join_size';
set @@max_join_size=1000, @@global.max_join_size=2000; set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size; select @@local.max_join_size, @@global.max_join_size;
......
...@@ -64,7 +64,6 @@ EXTRA_PROGRAMS = ...@@ -64,7 +64,6 @@ EXTRA_PROGRAMS =
DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
@DEFS@ @DEFS@
......
...@@ -25,12 +25,13 @@ ...@@ -25,12 +25,13 @@
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
uint pre_alloc_size __attribute__((unused))) uint pre_alloc_size __attribute__((unused)))
{ {
mem_root->free= mem_root->used= 0; mem_root->free= mem_root->used= mem_root->pre_alloc= 0;
mem_root->min_malloc= 32; mem_root->min_malloc= 32;
mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8;
mem_root->error_handler= 0; mem_root->error_handler= 0;
mem_root->block_num= 4; /* We shift this with >>2 */ mem_root->block_num= 4; /* We shift this with >>2 */
mem_root->first_block_usage= 0; mem_root->first_block_usage= 0;
#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG)) #if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
if (pre_alloc_size) if (pre_alloc_size)
{ {
...@@ -137,6 +138,7 @@ static inline void mark_blocks_free(MEM_ROOT* root) ...@@ -137,6 +138,7 @@ static inline void mark_blocks_free(MEM_ROOT* root)
/* Now everything is set; Indicate that nothing is used anymore */ /* Now everything is set; Indicate that nothing is used anymore */
root->used= 0; root->used= 0;
root->first_block_usage= 0;
} }
......
...@@ -100,6 +100,8 @@ SUFFIXES = .sh ...@@ -100,6 +100,8 @@ SUFFIXES = .sh
-e 's!@''CC''@!@CC@!'\ -e 's!@''CC''@!@CC@!'\
-e 's!@''CXX''@!@CXX@!'\ -e 's!@''CXX''@!@CXX@!'\
-e 's!@''GXX''@!@GXX@!'\ -e 's!@''GXX''@!@GXX@!'\
-e 's!@''CC_VERSION''@!@CC_VERSION@!'\
-e 's!@''CXX_VERSION''@!@CXX_VERSION@!'\
-e 's!@''PERL''@!@PERL@!' \ -e 's!@''PERL''@!@PERL@!' \
-e 's!@''ASFLAGS''@!@SAVE_ASFLAGS@!'\ -e 's!@''ASFLAGS''@!@SAVE_ASFLAGS@!'\
-e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\ -e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\
......
...@@ -231,6 +231,8 @@ ${ORGANIZATION- $ORGANIZATION_C} ...@@ -231,6 +231,8 @@ ${ORGANIZATION- $ORGANIZATION_C}
>Class: $CLASS_C >Class: $CLASS_C
>Release: mysql-${VERSION} ($COMPILATION_COMMENT) >Release: mysql-${VERSION} ($COMPILATION_COMMENT)
`test -n "$MYSQL_SERVER" && echo ">Server: $MYSQL_SERVER"` `test -n "$MYSQL_SERVER" && echo ">Server: $MYSQL_SERVER"`
>C compiler: @CC_VERSION@
>C++ compiler: @CXX_VERSION@
>Environment: >Environment:
$ENVIRONMENT_C $ENVIRONMENT_C
`test -n "$SYSTEM" && echo "System: $SYSTEM"` `test -n "$SYSTEM" && echo "System: $SYSTEM"`
......
...@@ -2038,11 +2038,14 @@ void Item_func_get_user_var::fix_length_and_dec() ...@@ -2038,11 +2038,14 @@ void Item_func_get_user_var::fix_length_and_dec()
maybe_null=1; maybe_null=1;
decimals=NOT_FIXED_DEC; decimals=NOT_FIXED_DEC;
max_length=MAX_BLOB_WIDTH; max_length=MAX_BLOB_WIDTH;
if ((var_entry= get_variable(&thd->user_vars, name, 0))) var_entry= get_variable(&thd->user_vars, name, 0);
const_var_flag= thd->query_id != var_entry->update_query_id;
} }
bool Item_func_get_user_var::const_item() const
{ return var_entry && current_thd->query_id != var_entry->update_query_id; }
enum Item_result Item_func_get_user_var::result_type() const enum Item_result Item_func_get_user_var::result_type() const
{ {
user_var_entry *entry; user_var_entry *entry;
......
...@@ -902,11 +902,10 @@ class Item_func_get_user_var :public Item_func ...@@ -902,11 +902,10 @@ class Item_func_get_user_var :public Item_func
{ {
LEX_STRING name; LEX_STRING name;
user_var_entry *var_entry; user_var_entry *var_entry;
bool const_var_flag;
public: public:
Item_func_get_user_var(LEX_STRING a): Item_func_get_user_var(LEX_STRING a):
Item_func(), name(a), const_var_flag(1) {} Item_func(), name(a) {}
user_var_entry *get_entry(); user_var_entry *get_entry();
double val(); double val();
longlong val_int(); longlong val_int();
...@@ -915,9 +914,9 @@ public: ...@@ -915,9 +914,9 @@ public:
void print(String *str); void print(String *str);
enum Item_result result_type() const; enum Item_result result_type() const;
const char *func_name() const { return "get_user_var"; } const char *func_name() const { return "get_user_var"; }
bool const_item() const { return const_var_flag; } bool const_item() const;
table_map used_tables() const table_map used_tables() const
{ return const_var_flag ? 0 : RAND_TABLE_BIT; } { return const_item() ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
......
...@@ -242,6 +242,12 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO; ...@@ -242,6 +242,12 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO;
#endif #endif
bool opt_large_files= sizeof(my_off_t) > 4; bool opt_large_files= sizeof(my_off_t) > 4;
#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
#define GET_HA_ROWS GET_ULL
#else
#define GET_HA_ROWS GET_ULONG
#endif
/* /*
Variables to store startup options Variables to store startup options
...@@ -3562,7 +3568,7 @@ struct my_option my_long_options[] = ...@@ -3562,7 +3568,7 @@ struct my_option my_long_options[] =
{"max_join_size", OPT_MAX_JOIN_SIZE, {"max_join_size", OPT_MAX_JOIN_SIZE,
"Joins that are probably going to read more than max_join_size records return an error.", "Joins that are probably going to read more than max_join_size records return an error.",
(gptr*) &global_system_variables.max_join_size, (gptr*) &global_system_variables.max_join_size,
(gptr*) &max_system_variables.max_join_size, 0, GET_ULONG, REQUIRED_ARG, (gptr*) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
~0L, 1, ~0L, 0, 1, 0}, ~0L, 1, ~0L, 0, 1, 0},
{"max_sort_length", OPT_MAX_SORT_LENGTH, {"max_sort_length", OPT_MAX_SORT_LENGTH,
"The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).",
...@@ -3949,10 +3955,10 @@ static void set_options(void) ...@@ -3949,10 +3955,10 @@ static void set_options(void)
/* Set default values for some variables */ /* Set default values for some variables */
global_system_variables.table_type=DB_TYPE_MYISAM; global_system_variables.table_type=DB_TYPE_MYISAM;
global_system_variables.tx_isolation=ISO_REPEATABLE_READ; global_system_variables.tx_isolation=ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulong) HA_POS_ERROR; global_system_variables.select_limit= HA_POS_ERROR;
max_system_variables.select_limit= (ulong) HA_POS_ERROR; max_system_variables.select_limit= HA_POS_ERROR;
global_system_variables.max_join_size= (ulong) HA_POS_ERROR; global_system_variables.max_join_size= HA_POS_ERROR;
max_system_variables.max_join_size= (ulong) HA_POS_ERROR; max_system_variables.max_join_size= HA_POS_ERROR;
#ifdef __WIN__ #ifdef __WIN__
/* Allow Win32 users to move MySQL anywhere */ /* Allow Win32 users to move MySQL anywhere */
......
...@@ -82,7 +82,7 @@ static int init_failsafe_rpl_thread(THD* thd) ...@@ -82,7 +82,7 @@ static int init_failsafe_rpl_thread(THD* thd)
#endif #endif
thd->mem_root.free=thd->mem_root.used=0; thd->mem_root.free=thd->mem_root.used=0;
if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS; thd->options|= OPTION_BIG_SELECTS;
thd->proc_info="Thread initialized"; thd->proc_info="Thread initialized";
......
...@@ -149,11 +149,11 @@ sys_var_long_ptr sys_max_delayed_threads("max_delayed_threads", ...@@ -149,11 +149,11 @@ sys_var_long_ptr sys_max_delayed_threads("max_delayed_threads",
&max_insert_delayed_threads); &max_insert_delayed_threads);
sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size", sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size",
&SV::max_heap_table_size); &SV::max_heap_table_size);
sys_var_thd_ulong sys_max_join_size("max_join_size", sys_var_thd_ha_rows sys_max_join_size("max_join_size",
&SV::max_join_size, &SV::max_join_size,
fix_max_join_size); fix_max_join_size);
#ifndef TO_BE_DELETED /* Alias for max_join_size */ #ifndef TO_BE_DELETED /* Alias for max_join_size */
sys_var_thd_ulong sys_sql_max_join_size("sql_max_join_size", sys_var_thd_ha_rows sys_sql_max_join_size("sql_max_join_size",
&SV::max_join_size, &SV::max_join_size,
fix_max_join_size); fix_max_join_size);
#endif #endif
...@@ -275,7 +275,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", ...@@ -275,7 +275,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks",
/* Local state variables */ /* Local state variables */
static sys_var_thd_ulong sys_select_limit("sql_select_limit", static sys_var_thd_ha_rows sys_select_limit("sql_select_limit",
&SV::select_limit); &SV::select_limit);
static sys_var_timestamp sys_timestamp("timestamp"); static sys_var_timestamp sys_timestamp("timestamp");
static sys_var_last_insert_id sys_last_insert_id("last_insert_id"); static sys_var_last_insert_id sys_last_insert_id("last_insert_id");
...@@ -576,7 +576,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type) ...@@ -576,7 +576,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type)
{ {
if (type != OPT_GLOBAL) if (type != OPT_GLOBAL)
{ {
if (thd->variables.max_join_size == (ulong) HA_POS_ERROR) if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS; thd->options|= OPTION_BIG_SELECTS;
else else
thd->options&= ~OPTION_BIG_SELECTS; thd->options&= ~OPTION_BIG_SELECTS;
...@@ -723,12 +723,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var) ...@@ -723,12 +723,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var)
if (option_limits) if (option_limits)
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits); tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
if (var->type == OPT_GLOBAL) if (var->type == OPT_GLOBAL)
{
/* Lock is needed to make things safe on 32 bit systems */
pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ulong) tmp; global_system_variables.*offset= (ulong) tmp;
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else else
thd->variables.*offset= (ulong) tmp; thd->variables.*offset= (ulong) tmp;
return 0; return 0;
...@@ -755,10 +750,60 @@ byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type) ...@@ -755,10 +750,60 @@ byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type)
} }
bool sys_var_thd_ha_rows::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();
/* Don't use bigger value than given with --maximum-variable-name=.. */
if ((ha_rows) tmp > max_system_variables.*offset)
tmp= max_system_variables.*offset;
if (option_limits)
tmp= (ha_rows) getopt_ull_limit_value(tmp, option_limits);
if (var->type == OPT_GLOBAL)
{
/* Lock is needed to make things safe on 32 bit systems */
pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ha_rows) tmp;
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else
thd->variables.*offset= (ha_rows) tmp;
return 0;
}
void sys_var_thd_ha_rows::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
{
/* We will not come here if option_limits is not set */
pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ha_rows) option_limits->def_value;
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else
thd->variables.*offset= global_system_variables.*offset;
}
byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
return (byte*) &(global_system_variables.*offset);
return (byte*) &(thd->variables.*offset);
}
bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
{ {
if (var->type == OPT_GLOBAL) if (var->type == OPT_GLOBAL)
{
/* Lock is needed to make things safe on 32 bit systems */
pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= var->value->val_int(); global_system_variables.*offset= var->value->val_int();
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else else
thd->variables.*offset= var->value->val_int(); thd->variables.*offset= var->value->val_int();
return 0; return 0;
...@@ -768,7 +813,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) ...@@ -768,7 +813,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type) void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type)
{ {
if (type == OPT_GLOBAL) if (type == OPT_GLOBAL)
{
pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ulong) option_limits->def_value; global_system_variables.*offset= (ulong) option_limits->def_value;
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else else
thd->variables.*offset= global_system_variables.*offset; thd->variables.*offset= global_system_variables.*offset;
} }
...@@ -871,6 +920,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type) ...@@ -871,6 +920,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type)
return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type)); return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type));
case SHOW_LONGLONG: case SHOW_LONGLONG:
return new Item_int(*(longlong*) value_ptr(thd, var_type)); return new Item_int(*(longlong*) value_ptr(thd, var_type));
case SHOW_HA_ROWS:
return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type));
case SHOW_MY_BOOL: case SHOW_MY_BOOL:
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1); return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1);
case SHOW_CHAR: case SHOW_CHAR:
......
...@@ -211,6 +211,24 @@ public: ...@@ -211,6 +211,24 @@ public:
}; };
class sys_var_thd_ha_rows :public sys_var_thd
{
public:
ha_rows SV::*offset;
sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg)
{}
sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg,
sys_after_update_func func)
:sys_var_thd(name_arg,func), offset(offset_arg)
{}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE type() { return SHOW_HA_ROWS; }
byte *value_ptr(THD *thd, enum_var_type type);
};
class sys_var_thd_ulonglong :public sys_var_thd class sys_var_thd_ulonglong :public sys_var_thd
{ {
public: public:
......
...@@ -1548,7 +1548,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) ...@@ -1548,7 +1548,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif #endif
if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS; thd->options |= OPTION_BIG_SELECTS;
if (thd_type == SLAVE_THD_SQL) if (thd_type == SLAVE_THD_SQL)
......
...@@ -284,13 +284,14 @@ struct system_variables ...@@ -284,13 +284,14 @@ struct system_variables
{ {
ulonglong myisam_max_extra_sort_file_size; ulonglong myisam_max_extra_sort_file_size;
ulonglong myisam_max_sort_file_size; ulonglong myisam_max_sort_file_size;
ha_rows select_limit;
ha_rows max_join_size;
ulong bulk_insert_buff_size; ulong bulk_insert_buff_size;
ulong join_buff_size; ulong join_buff_size;
ulong long_query_time; ulong long_query_time;
ulong max_allowed_packet; ulong max_allowed_packet;
ulong max_heap_table_size; ulong max_heap_table_size;
ulong max_sort_length; ulong max_sort_length;
ulong max_join_size;
ulong max_tmp_tables; ulong max_tmp_tables;
ulong myisam_sort_buff_size; ulong myisam_sort_buff_size;
ulong net_buffer_length; ulong net_buffer_length;
...@@ -302,7 +303,6 @@ struct system_variables ...@@ -302,7 +303,6 @@ struct system_variables
ulong query_cache_type; ulong query_cache_type;
ulong read_buff_size; ulong read_buff_size;
ulong read_rnd_buff_size; ulong read_rnd_buff_size;
ulong select_limit;
ulong sortbuff_size; ulong sortbuff_size;
ulong tmp_table_size; ulong tmp_table_size;
ulong tx_isolation; ulong tx_isolation;
......
...@@ -678,7 +678,7 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -678,7 +678,7 @@ pthread_handler_decl(handle_one_connection,arg)
goto end_thread; goto end_thread;
} }
if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS; thd->options |= OPTION_BIG_SELECTS;
if (thd->client_capabilities & CLIENT_COMPRESS) if (thd->client_capabilities & CLIENT_COMPRESS)
net->compress=1; // Use compression net->compress=1; // Use compression
...@@ -754,7 +754,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) ...@@ -754,7 +754,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
#endif #endif
if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS; thd->options |= OPTION_BIG_SELECTS;
thd->proc_info=0; thd->proc_info=0;
...@@ -1096,6 +1096,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1096,6 +1096,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
} }
if (lower_case_table_names) if (lower_case_table_names)
casedn_str(db); casedn_str(db);
if (check_access(thd,DROP_ACL,db,0,1))
break;
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION); send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION);
......
...@@ -1184,6 +1184,9 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, ...@@ -1184,6 +1184,9 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
case SHOW_LONGLONG: case SHOW_LONGLONG:
net_store_data(&packet2,(longlong) *(longlong*) value); net_store_data(&packet2,(longlong) *(longlong*) value);
break; break;
case SHOW_HA_ROWS:
net_store_data(&packet2,(longlong) *(ha_rows*) value);
break;
case SHOW_BOOL: case SHOW_BOOL:
net_store_data(&packet2,(ulong) *(bool*) value ? "ON" : "OFF"); net_store_data(&packet2,(ulong) *(bool*) value ? "ON" : "OFF");
break; break;
......
...@@ -129,7 +129,7 @@ enum SHOW_TYPE ...@@ -129,7 +129,7 @@ enum SHOW_TYPE
SHOW_UNDEF, SHOW_UNDEF,
SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_BOOL, SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_BOOL,
SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION,
SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS,
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD, SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD,
SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE, SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE,
......
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