2002-07-23 17:31:22 +02:00
|
|
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
/* Classes to support the SET command */
|
|
|
|
|
2005-05-04 15:05:56 +02:00
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
2002-07-23 17:31:22 +02:00
|
|
|
#pragma interface /* gcc class implementation */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
Variables that are changable runtime are declared using the
|
|
|
|
following classes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
class sys_var;
|
|
|
|
class set_var;
|
|
|
|
typedef struct system_variables SV;
|
2003-01-16 01:04:50 +01:00
|
|
|
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib;
|
2002-07-23 17:31:22 +02:00
|
|
|
|
2004-02-16 18:53:00 +01:00
|
|
|
typedef int (*sys_check_func)(THD *, set_var *);
|
2002-07-23 17:31:22 +02:00
|
|
|
typedef bool (*sys_update_func)(THD *, set_var *);
|
|
|
|
typedef void (*sys_after_update_func)(THD *,enum_var_type);
|
|
|
|
typedef void (*sys_set_default_func)(THD *, enum_var_type);
|
2002-10-02 12:33:08 +02:00
|
|
|
typedef byte *(*sys_value_ptr_func)(THD *thd);
|
2002-07-23 17:31:22 +02:00
|
|
|
|
|
|
|
class sys_var
|
|
|
|
{
|
|
|
|
public:
|
2005-11-06 01:36:40 +01:00
|
|
|
static sys_var *first;
|
|
|
|
static uint sys_vars;
|
|
|
|
sys_var *next;
|
2002-07-23 17:31:22 +02:00
|
|
|
struct my_option *option_limits; /* Updated by by set_var_init() */
|
|
|
|
uint name_length; /* Updated by by set_var_init() */
|
|
|
|
const char *name;
|
dbug changes:
1. dbug state is now local to a thread
2. new macros: DBUG_EXPLAIN, DBUG_EXPLAIN_INITIAL,
DBUG_SET, DBUG_SET_INITIAL, DBUG_EVALUATE, DBUG_EVALUATE_IF
3. macros are do{}while(0) wrapped
4. incremental modifications to the dbug state (e.g. "+d,info:-t")
5. dbug code cleanup, style fixes
6. _db_on_ and DEBUGGER_ON/OFF removed
7. rest of MySQL code fixed because of 3 (missing ;) and 6
8. dbug manual updated
9. server variable @@debug (global and local) to control dbug from SQL!
a. -#T to print timestamps in the log
BitKeeper/deleted/.del-readme.prof~2f3bae1550a0038d:
Delete: dbug/readme.prof
client/mysqlslap.c:
typo fixed
configure.in:
test for sleep() too
dbug/dbug.c:
thread local dbug settings
DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL
style changes to be more in line with MySQL code
cleanup (many mallocs removed)
incremental modification of dbug state (e.g. DBUG_PUSH("+t:-d,info"))
DBUG_SET, _db_explain_
-#T
dbug/monty.doc:
obsolete and duplicate docs removed
dbug/user.r:
new features documented
include/my_dbug.h:
correct do{}while wrapping
thread local dbug settings
DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL
DBUG_EVALUATE,DBUG_EVALUATE_IF
libmysql/libmysql.c:
remove _db_on_ and DEBUGGER_ON/OFF
mysys/my_init.c:
missed DBUG_RETURN
mysys/my_thr_init.c:
bugfix - transaction id's are unsigned
mysys/testhash.c:
remove _db_on_ and DEBUGGER_ON/OFF
sql/ha_myisammrg.cc:
missed ;
sql/ha_ndbcluster.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
sql/ha_ndbcluster_binlog.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
sql/item_cmpfunc.cc:
missed ;
sql/lock.cc:
missed DBUG_RETURN
sql/log_event.cc:
missed ;
sql/mysqld.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
DBUG_SET_INITIAL
sql/opt_range.cc:
remove _db_on_ and DEBUGGER_ON/OFF
sql/set_var.cc:
class sys_var_thd_dbug and "debug" server variable
sql/set_var.h:
class sys_var_thd_dbug and "debug" server variable
sql/slave.cc:
missed ;
sql/sql_cache.cc:
missed ;
sql/sql_plugin.cc:
missed ;
sql/sql_select.cc:
remove _db_on_ and DEBUGGER_ON/OFF
storage/heap/hp_test2.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/ft_eval.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/ft_test1.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_open.c:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
storage/myisam/mi_test1.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_test2.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_test3.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/ndb/src/ndbapi/DictCache.cpp:
missed ;
storage/ndb/src/ndbapi/NdbTransaction.cpp:
missed ;
tests/mysql_client_test.c:
remove _db_on_ and DEBUGGER_ON/OFF
2006-02-14 22:36:11 +01:00
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_after_update_func after_update;
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
bool no_support_one_shot;
|
2006-04-19 19:12:24 +02:00
|
|
|
sys_var(const char *name_arg,sys_after_update_func func= NULL)
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
:name(name_arg), after_update(func)
|
|
|
|
, no_support_one_shot(1)
|
2005-11-06 01:36:40 +01:00
|
|
|
{ add_sys_var(); }
|
2002-07-23 17:31:22 +02:00
|
|
|
virtual ~sys_var() {}
|
2005-11-06 01:36:40 +01:00
|
|
|
void add_sys_var()
|
|
|
|
{
|
|
|
|
next= first;
|
|
|
|
first= this;
|
|
|
|
sys_vars++;
|
|
|
|
}
|
2003-10-24 16:28:32 +02:00
|
|
|
virtual bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
|
2003-01-16 01:04:50 +01:00
|
|
|
bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
|
2002-07-23 17:31:22 +02:00
|
|
|
virtual bool update(THD *thd, set_var *var)=0;
|
|
|
|
virtual void set_default(THD *thd, enum_var_type type) {}
|
|
|
|
virtual SHOW_TYPE type() { return SHOW_UNDEF; }
|
2003-07-06 18:09:57 +02:00
|
|
|
virtual byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return 0; }
|
2002-07-23 17:31:22 +02:00
|
|
|
virtual bool check_type(enum_var_type type)
|
|
|
|
{ return type != OPT_GLOBAL; } /* Error if not GLOBAL */
|
|
|
|
virtual bool check_update_type(Item_result type)
|
|
|
|
{ return type != INT_RESULT; } /* Assume INT */
|
|
|
|
virtual bool check_default(enum_var_type type)
|
|
|
|
{ return option_limits == 0; }
|
2003-07-06 18:09:57 +02:00
|
|
|
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
virtual bool is_struct() { return 0; }
|
2005-05-13 13:18:27 +02:00
|
|
|
virtual bool is_readonly() const { return 0; }
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
A fix and a test case for Bug#16365 "Prepared Statements: DoS with
too many open statements". The patch adds a new global variable
@@max_prepared_stmt_count. This variable limits the total number
of prepared statements in the server. The default value of
@@max_prepared_stmt_count is 16382. 16382 small statements
(a select against 3 tables with GROUP, ORDER and LIMIT) consume
100MB of RAM. Once this limit has been reached, the server will
refuse to prepare a new statement and return ER_UNKNOWN_ERROR
(unfortunately, we can't add new errors to 4.1 without breaking 5.0). The limit is changeable after startup
and can accept any value from 0 to 1 million. In case
the new value of the limit is less than the current
statement count, no new statements can be added, while the old
still can be used. Additionally, the current count of prepared
statements is now available through a global read-only variable
@@prepared_stmt_count.
mysql-test/r/ps.result:
Test results fixed (a test case for Bug#16365)
mysql-test/t/ps.test:
A test case for Bug#16365 "Prepared Statements: DoS with too many
open statements". Also fix statement leaks in other tests.
sql/mysql_priv.h:
Add declarations for new global variables.
sql/mysqld.cc:
Add definitions of max_prepared_stmt_count, prepared_stmt_count.
sql/set_var.cc:
Implement support for @@prepared_stmt_count and
@@max_prepared_stmt_count. Currently these variables are queried
without acquiring LOCK_prepared_stmt_count due to limitations of
the set_var/sys_var class design. Updates are, however, protected
with a lock.
sql/set_var.h:
New declarations to add support for @@max_prepared_stmt_count.
Implement a new class, where the lock to be used when updating
a variable is a parameter.
sql/sql_class.cc:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_class.h:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_prepare.cc:
Statement_map::insert will now send a message in case of an
error.
2006-04-07 21:37:06 +02:00
|
|
|
/*
|
|
|
|
A base class for all variables that require its access to
|
|
|
|
be guarded with a mutex.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class sys_var_global: public sys_var
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
pthread_mutex_t *guard;
|
|
|
|
public:
|
|
|
|
sys_var_global(const char *name_arg, sys_after_update_func after_update_arg,
|
|
|
|
pthread_mutex_t *guard_arg)
|
|
|
|
:sys_var(name_arg, after_update_arg), guard(guard_arg) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
A global-only ulong variable that requires its access to be
|
|
|
|
protected with a mutex.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class sys_var_long_ptr_global: public sys_var_global
|
2002-07-23 17:31:22 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ulong *value;
|
A fix and a test case for Bug#16365 "Prepared Statements: DoS with
too many open statements". The patch adds a new global variable
@@max_prepared_stmt_count. This variable limits the total number
of prepared statements in the server. The default value of
@@max_prepared_stmt_count is 16382. 16382 small statements
(a select against 3 tables with GROUP, ORDER and LIMIT) consume
100MB of RAM. Once this limit has been reached, the server will
refuse to prepare a new statement and return ER_UNKNOWN_ERROR
(unfortunately, we can't add new errors to 4.1 without breaking 5.0). The limit is changeable after startup
and can accept any value from 0 to 1 million. In case
the new value of the limit is less than the current
statement count, no new statements can be added, while the old
still can be used. Additionally, the current count of prepared
statements is now available through a global read-only variable
@@prepared_stmt_count.
mysql-test/r/ps.result:
Test results fixed (a test case for Bug#16365)
mysql-test/t/ps.test:
A test case for Bug#16365 "Prepared Statements: DoS with too many
open statements". Also fix statement leaks in other tests.
sql/mysql_priv.h:
Add declarations for new global variables.
sql/mysqld.cc:
Add definitions of max_prepared_stmt_count, prepared_stmt_count.
sql/set_var.cc:
Implement support for @@prepared_stmt_count and
@@max_prepared_stmt_count. Currently these variables are queried
without acquiring LOCK_prepared_stmt_count due to limitations of
the set_var/sys_var class design. Updates are, however, protected
with a lock.
sql/set_var.h:
New declarations to add support for @@max_prepared_stmt_count.
Implement a new class, where the lock to be used when updating
a variable is a parameter.
sql/sql_class.cc:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_class.h:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_prepare.cc:
Statement_map::insert will now send a message in case of an
error.
2006-04-07 21:37:06 +02:00
|
|
|
sys_var_long_ptr_global(const char *name_arg, ulong *value_ptr,
|
|
|
|
pthread_mutex_t *guard_arg,
|
|
|
|
sys_after_update_func after_update_arg= NULL)
|
|
|
|
:sys_var_global(name_arg, after_update_arg, guard_arg), value(value_ptr) {}
|
2005-02-17 12:04:04 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return (byte*) value; }
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
A fix and a test case for Bug#16365 "Prepared Statements: DoS with
too many open statements". The patch adds a new global variable
@@max_prepared_stmt_count. This variable limits the total number
of prepared statements in the server. The default value of
@@max_prepared_stmt_count is 16382. 16382 small statements
(a select against 3 tables with GROUP, ORDER and LIMIT) consume
100MB of RAM. Once this limit has been reached, the server will
refuse to prepare a new statement and return ER_UNKNOWN_ERROR
(unfortunately, we can't add new errors to 4.1 without breaking 5.0). The limit is changeable after startup
and can accept any value from 0 to 1 million. In case
the new value of the limit is less than the current
statement count, no new statements can be added, while the old
still can be used. Additionally, the current count of prepared
statements is now available through a global read-only variable
@@prepared_stmt_count.
mysql-test/r/ps.result:
Test results fixed (a test case for Bug#16365)
mysql-test/t/ps.test:
A test case for Bug#16365 "Prepared Statements: DoS with too many
open statements". Also fix statement leaks in other tests.
sql/mysql_priv.h:
Add declarations for new global variables.
sql/mysqld.cc:
Add definitions of max_prepared_stmt_count, prepared_stmt_count.
sql/set_var.cc:
Implement support for @@prepared_stmt_count and
@@max_prepared_stmt_count. Currently these variables are queried
without acquiring LOCK_prepared_stmt_count due to limitations of
the set_var/sys_var class design. Updates are, however, protected
with a lock.
sql/set_var.h:
New declarations to add support for @@max_prepared_stmt_count.
Implement a new class, where the lock to be used when updating
a variable is a parameter.
sql/sql_class.cc:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_class.h:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_prepare.cc:
Statement_map::insert will now send a message in case of an
error.
2006-04-07 21:37:06 +02:00
|
|
|
/*
|
|
|
|
A global ulong variable that is protected by LOCK_global_system_variables
|
|
|
|
*/
|
|
|
|
|
|
|
|
class sys_var_long_ptr :public sys_var_long_ptr_global
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
|
|
|
|
sys_after_update_func after_update_arg= NULL);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-12-05 15:38:49 +01:00
|
|
|
class sys_var_ulonglong_ptr :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ulonglong *value;
|
|
|
|
sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr)
|
|
|
|
:sys_var(name_arg),value(value_ptr) {}
|
|
|
|
sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr,
|
|
|
|
sys_after_update_func func)
|
|
|
|
:sys_var(name_arg,func), value(value_ptr) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return (byte*) value; }
|
2002-12-05 15:38:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_bool_ptr :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
my_bool *value;
|
|
|
|
sys_var_bool_ptr(const char *name_arg, my_bool *value_arg)
|
|
|
|
:sys_var(name_arg),value(value_arg)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_enum(thd, var, &bool_typelib);
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_MY_BOOL; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return (byte*) value; }
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_str :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
char *value; // Pointer to allocated string
|
SCRUM:
Task 499 'init_connect, init_slave options'
mysql-test/mysql-test-run.sh:
Task 499 'init_connect, init_slave options'
This change needs because mysql-test-run cuts string variable on first space
sql/mysql_priv.h:
Task 499 'init_connect, init_slave options'
sql/mysqld.cc:
Task 499 'init_connect, init_slave options'
sql/protocol.cc:
Task 499 'init_connect, init_slave options'
sql/set_var.cc:
Task 499 'init_connect, init_slave options'
sql/set_var.h:
Task 499 'init_connect, init_slave options'
sql/slave.cc:
Task 499 'init_connect, init_slave options'
sql/sql_class.cc:
Task 499 'init_connect, init_slave options'
sql/sql_class.h:
Task 499 'init_connect, init_slave options'
sql/sql_parse.cc:
Task 499 'init_connect, init_slave options'
sql/sql_show.cc:
Task 499 'init_connect, init_slave options'
2003-07-18 11:11:01 +02:00
|
|
|
uint value_length;
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_check_func check_func;
|
|
|
|
sys_update_func update_func;
|
|
|
|
sys_set_default_func set_default_func;
|
|
|
|
sys_var_str(const char *name_arg,
|
|
|
|
sys_check_func check_func_arg,
|
|
|
|
sys_update_func update_func_arg,
|
2004-03-20 14:36:00 +01:00
|
|
|
sys_set_default_func set_default_func_arg,
|
|
|
|
char *value_arg)
|
2004-03-22 14:43:13 +01:00
|
|
|
:sys_var(name_arg), value(value_arg), check_func(check_func_arg),
|
2002-07-23 17:31:22 +02:00
|
|
|
update_func(update_func_arg),set_default_func(set_default_func_arg)
|
|
|
|
{}
|
2004-02-16 18:53:00 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return (*update_func)(thd, var);
|
|
|
|
}
|
|
|
|
void set_default(THD *thd, enum_var_type type)
|
|
|
|
{
|
2002-08-08 02:12:02 +02:00
|
|
|
(*set_default_func)(thd, type);
|
2002-07-23 17:31:22 +02:00
|
|
|
}
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return (byte*) value; }
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return type != STRING_RESULT; /* Only accept strings */
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-03-06 09:43:35 +01:00
|
|
|
class sys_var_const_str :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
char *value; // Pointer to const value
|
|
|
|
sys_var_const_str(const char *name_arg, const char *value_arg)
|
A fix and a test case for Bug#16365 "Prepared Statements: DoS with
too many open statements". The patch adds a new global variable
@@max_prepared_stmt_count. This variable limits the total number
of prepared statements in the server. The default value of
@@max_prepared_stmt_count is 16382. 16382 small statements
(a select against 3 tables with GROUP, ORDER and LIMIT) consume
100MB of RAM. Once this limit has been reached, the server will
refuse to prepare a new statement and return ER_UNKNOWN_ERROR
(unfortunately, we can't add new errors to 4.1 without breaking 5.0). The limit is changeable after startup
and can accept any value from 0 to 1 million. In case
the new value of the limit is less than the current
statement count, no new statements can be added, while the old
still can be used. Additionally, the current count of prepared
statements is now available through a global read-only variable
@@prepared_stmt_count.
mysql-test/r/ps.result:
Test results fixed (a test case for Bug#16365)
mysql-test/t/ps.test:
A test case for Bug#16365 "Prepared Statements: DoS with too many
open statements". Also fix statement leaks in other tests.
sql/mysql_priv.h:
Add declarations for new global variables.
sql/mysqld.cc:
Add definitions of max_prepared_stmt_count, prepared_stmt_count.
sql/set_var.cc:
Implement support for @@prepared_stmt_count and
@@max_prepared_stmt_count. Currently these variables are queried
without acquiring LOCK_prepared_stmt_count due to limitations of
the set_var/sys_var class design. Updates are, however, protected
with a lock.
sql/set_var.h:
New declarations to add support for @@max_prepared_stmt_count.
Implement a new class, where the lock to be used when updating
a variable is a parameter.
sql/sql_class.cc:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_class.h:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_prepare.cc:
Statement_map::insert will now send a message in case of an
error.
2006-04-07 21:37:06 +02:00
|
|
|
:sys_var(name_arg),value((char*) value_arg)
|
2004-03-06 09:43:35 +01:00
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2004-03-17 09:30:40 +01:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{
|
|
|
|
return (byte*) value;
|
|
|
|
}
|
2004-03-06 09:43:35 +01:00
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 1; }
|
2005-09-07 12:38:09 +02:00
|
|
|
bool is_readonly() const { return 1; }
|
2004-03-06 09:43:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Bug #1039: tmpdir and datadir not available via @@ system variable syntax
Bug #19606: ssl variables are not displayed in show variables
Bug #19616: log_queries_not_using_indexes is not listed in show variables
Make basedir, datadir, tmpdir, log_queries_not_using_indexes, ssl_ca,
ssl_capath, ssl_cert, ssl_cipher, and ssl_key all available both from
SHOW VARIABLES and as @@variables.
As a side-effect of this change, log_queries_not_using_indexes can
be changed at runtime (but only globally, not per-connection).
include/sslopt-longopts.h:
Put options in alphabetical order
include/sslopt-vars.h:
Allow define of SSL_VARS_NOT_STATIC to prevent variables from not being
made static.
mysql-test/r/variables.result:
Add new results
mysql-test/t/variables.test:
Add new regression tests
sql/mysql_priv.h:
Add extern for opt_log_queries_not_using_indexes
sql/mysqld.cc:
Handle opt_log_queries_not_using_indexes as extern, and define
SSL_VARS_NO_STATIC so they can be accessed outside of mysqld.cc
sql/set_var.cc:
Handle basedir, datadir, tmpdir, log_queries_not_using_indexes, and
various ssl settings so that they are accessible as server variables
and listed in SHOW VARIABLES.
sql/set_var.h:
Add new sys_var_constr_str_ptr class, for when we have a system variable
that is only set via the command-line that is a pointer to a string.
2006-05-09 01:38:45 +02:00
|
|
|
class sys_var_const_str_ptr :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
char **value; // Pointer to const value
|
|
|
|
sys_var_const_str_ptr(const char *name_arg, char **value_arg)
|
|
|
|
:sys_var(name_arg),value(value_arg)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{
|
|
|
|
return (byte*) *value;
|
|
|
|
}
|
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 1; }
|
|
|
|
bool is_readonly() const { return 1; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-08-13 01:18:39 +02:00
|
|
|
class sys_var_enum :public sys_var
|
|
|
|
{
|
2006-06-19 15:30:55 +02:00
|
|
|
uint *value;
|
2002-08-13 01:18:39 +02:00
|
|
|
TYPELIB *enum_names;
|
|
|
|
public:
|
|
|
|
sys_var_enum(const char *name_arg, uint *value_arg,
|
|
|
|
TYPELIB *typelib, sys_after_update_func func)
|
|
|
|
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_enum(thd, var, enum_names);
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-08-13 01:18:39 +02:00
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_thd :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
A fix and a test case for Bug#16365 "Prepared Statements: DoS with
too many open statements". The patch adds a new global variable
@@max_prepared_stmt_count. This variable limits the total number
of prepared statements in the server. The default value of
@@max_prepared_stmt_count is 16382. 16382 small statements
(a select against 3 tables with GROUP, ORDER and LIMIT) consume
100MB of RAM. Once this limit has been reached, the server will
refuse to prepare a new statement and return ER_UNKNOWN_ERROR
(unfortunately, we can't add new errors to 4.1 without breaking 5.0). The limit is changeable after startup
and can accept any value from 0 to 1 million. In case
the new value of the limit is less than the current
statement count, no new statements can be added, while the old
still can be used. Additionally, the current count of prepared
statements is now available through a global read-only variable
@@prepared_stmt_count.
mysql-test/r/ps.result:
Test results fixed (a test case for Bug#16365)
mysql-test/t/ps.test:
A test case for Bug#16365 "Prepared Statements: DoS with too many
open statements". Also fix statement leaks in other tests.
sql/mysql_priv.h:
Add declarations for new global variables.
sql/mysqld.cc:
Add definitions of max_prepared_stmt_count, prepared_stmt_count.
sql/set_var.cc:
Implement support for @@prepared_stmt_count and
@@max_prepared_stmt_count. Currently these variables are queried
without acquiring LOCK_prepared_stmt_count due to limitations of
the set_var/sys_var class design. Updates are, however, protected
with a lock.
sql/set_var.h:
New declarations to add support for @@max_prepared_stmt_count.
Implement a new class, where the lock to be used when updating
a variable is a parameter.
sql/sql_class.cc:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_class.h:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_prepare.cc:
Statement_map::insert will now send a message in case of an
error.
2006-04-07 21:37:06 +02:00
|
|
|
sys_var_thd(const char *name_arg, sys_after_update_func func= NULL)
|
2002-07-23 17:31:22 +02:00
|
|
|
:sys_var(name_arg,func)
|
|
|
|
{}
|
|
|
|
bool check_type(enum_var_type type) { return 0; }
|
|
|
|
bool check_default(enum_var_type type)
|
|
|
|
{
|
|
|
|
return type == OPT_GLOBAL && !option_limits;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_thd_ulong :public sys_var_thd
|
|
|
|
{
|
2004-03-27 01:07:09 +01:00
|
|
|
sys_check_func check_func;
|
2002-07-23 17:31:22 +02:00
|
|
|
public:
|
|
|
|
ulong SV::*offset;
|
|
|
|
sys_var_thd_ulong(const char *name_arg, ulong SV::*offset_arg)
|
2004-03-27 01:07:09 +01:00
|
|
|
:sys_var_thd(name_arg), check_func(0), offset(offset_arg)
|
2002-07-23 17:31:22 +02:00
|
|
|
{}
|
|
|
|
sys_var_thd_ulong(const char *name_arg, ulong SV::*offset_arg,
|
2004-03-27 01:07:09 +01:00
|
|
|
sys_check_func c_func, sys_after_update_func au_func)
|
|
|
|
:sys_var_thd(name_arg,au_func), check_func(c_func), offset(offset_arg)
|
2002-07-23 17:31:22 +02:00
|
|
|
{}
|
2004-03-27 01:07:09 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-12-20 13:58:27 +01:00
|
|
|
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; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-12-20 13:58:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_thd_ulonglong :public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ulonglong SV::*offset;
|
2003-05-13 18:34:51 +02:00
|
|
|
bool only_global;
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg)
|
|
|
|
:sys_var_thd(name_arg), offset(offset_arg)
|
|
|
|
{}
|
2002-11-11 16:28:58 +01:00
|
|
|
sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg,
|
2003-05-13 18:34:51 +02:00
|
|
|
sys_after_update_func func, bool only_global_arg)
|
|
|
|
:sys_var_thd(name_arg, func), offset(offset_arg),
|
|
|
|
only_global(only_global_arg)
|
2002-11-11 16:28:58 +01:00
|
|
|
{}
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2003-05-13 18:34:51 +02:00
|
|
|
bool check_default(enum_var_type type)
|
|
|
|
{
|
|
|
|
return type == OPT_GLOBAL && !option_limits;
|
|
|
|
}
|
|
|
|
bool check_type(enum_var_type type)
|
|
|
|
{
|
|
|
|
return (only_global && type != OPT_GLOBAL);
|
|
|
|
}
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_thd_bool :public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
my_bool SV::*offset;
|
|
|
|
sys_var_thd_bool(const char *name_arg, my_bool SV::*offset_arg)
|
|
|
|
:sys_var_thd(name_arg), offset(offset_arg)
|
|
|
|
{}
|
|
|
|
sys_var_thd_bool(const char *name_arg, my_bool 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_MY_BOOL; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_enum(thd, var, &bool_typelib);
|
|
|
|
}
|
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_thd_enum :public sys_var_thd
|
|
|
|
{
|
2003-01-16 01:04:50 +01:00
|
|
|
protected:
|
2002-07-23 17:31:22 +02:00
|
|
|
ulong SV::*offset;
|
|
|
|
TYPELIB *enum_names;
|
2005-11-03 01:38:23 +01:00
|
|
|
sys_check_func check_func;
|
2002-07-23 17:31:22 +02:00
|
|
|
public:
|
|
|
|
sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
|
|
|
|
TYPELIB *typelib)
|
2005-11-03 01:38:23 +01:00
|
|
|
:sys_var_thd(name_arg), offset(offset_arg), enum_names(typelib),
|
|
|
|
check_func(0)
|
2002-07-23 17:31:22 +02:00
|
|
|
{}
|
|
|
|
sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
|
|
|
|
TYPELIB *typelib,
|
|
|
|
sys_after_update_func func)
|
2005-11-03 01:38:23 +01:00
|
|
|
:sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib),
|
|
|
|
check_func(0)
|
|
|
|
{}
|
|
|
|
sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
|
|
|
|
TYPELIB *typelib, sys_after_update_func func,
|
|
|
|
sys_check_func check)
|
|
|
|
:sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib),
|
|
|
|
check_func(check)
|
2002-07-23 17:31:22 +02:00
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
2005-11-03 01:38:23 +01:00
|
|
|
int ret= 0;
|
|
|
|
if (check_func)
|
|
|
|
ret= (*check_func)(thd, var);
|
|
|
|
return ret ? ret : check_enum(thd, var, enum_names);
|
2002-07-23 17:31:22 +02:00
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-06-04 17:28:51 +02:00
|
|
|
extern void fix_sql_mode_var(THD *thd, enum_var_type type);
|
|
|
|
|
2003-01-16 01:04:50 +01:00
|
|
|
class sys_var_thd_sql_mode :public sys_var_thd_enum
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_thd_sql_mode(const char *name_arg, ulong SV::*offset_arg)
|
2003-06-04 17:28:51 +02:00
|
|
|
:sys_var_thd_enum(name_arg, offset_arg, &sql_mode_typelib,
|
|
|
|
fix_sql_mode_var)
|
2003-01-16 01:04:50 +01:00
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_set(thd, var, enum_names);
|
|
|
|
}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2005-07-28 21:39:11 +02:00
|
|
|
static byte *symbolic_mode_representation(THD *thd, ulong sql_mode,
|
|
|
|
ulong *length);
|
2003-01-16 01:04:50 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-12-17 23:52:03 +01:00
|
|
|
class sys_var_thd_storage_engine :public sys_var_thd
|
2003-12-02 21:23:13 +01:00
|
|
|
{
|
|
|
|
protected:
|
2005-12-21 19:18:40 +01:00
|
|
|
handlerton *SV::*offset;
|
2003-12-02 21:23:13 +01:00
|
|
|
public:
|
2005-12-21 19:18:40 +01:00
|
|
|
sys_var_thd_storage_engine(const char *name_arg, handlerton *SV::*offset_arg)
|
2003-12-02 21:23:13 +01:00
|
|
|
:sys_var_thd(name_arg), offset(offset_arg)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return type != STRING_RESULT; /* Only accept strings */
|
|
|
|
}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
};
|
|
|
|
|
2003-12-17 23:52:03 +01:00
|
|
|
class sys_var_thd_table_type :public sys_var_thd_storage_engine
|
|
|
|
{
|
|
|
|
public:
|
2005-12-21 19:18:40 +01:00
|
|
|
sys_var_thd_table_type(const char *name_arg, handlerton *SV::*offset_arg)
|
2003-12-17 23:52:03 +01:00
|
|
|
:sys_var_thd_storage_engine(name_arg, offset_arg)
|
|
|
|
{}
|
|
|
|
void warn_deprecated(THD *thd);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
};
|
2003-12-02 21:23:13 +01:00
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_thd_bit :public sys_var_thd
|
|
|
|
{
|
2004-03-27 01:07:09 +01:00
|
|
|
sys_check_func check_func;
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_update_func update_func;
|
|
|
|
public:
|
|
|
|
ulong bit_flag;
|
|
|
|
bool reverse;
|
dbug changes:
1. dbug state is now local to a thread
2. new macros: DBUG_EXPLAIN, DBUG_EXPLAIN_INITIAL,
DBUG_SET, DBUG_SET_INITIAL, DBUG_EVALUATE, DBUG_EVALUATE_IF
3. macros are do{}while(0) wrapped
4. incremental modifications to the dbug state (e.g. "+d,info:-t")
5. dbug code cleanup, style fixes
6. _db_on_ and DEBUGGER_ON/OFF removed
7. rest of MySQL code fixed because of 3 (missing ;) and 6
8. dbug manual updated
9. server variable @@debug (global and local) to control dbug from SQL!
a. -#T to print timestamps in the log
BitKeeper/deleted/.del-readme.prof~2f3bae1550a0038d:
Delete: dbug/readme.prof
client/mysqlslap.c:
typo fixed
configure.in:
test for sleep() too
dbug/dbug.c:
thread local dbug settings
DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL
style changes to be more in line with MySQL code
cleanup (many mallocs removed)
incremental modification of dbug state (e.g. DBUG_PUSH("+t:-d,info"))
DBUG_SET, _db_explain_
-#T
dbug/monty.doc:
obsolete and duplicate docs removed
dbug/user.r:
new features documented
include/my_dbug.h:
correct do{}while wrapping
thread local dbug settings
DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL
DBUG_EVALUATE,DBUG_EVALUATE_IF
libmysql/libmysql.c:
remove _db_on_ and DEBUGGER_ON/OFF
mysys/my_init.c:
missed DBUG_RETURN
mysys/my_thr_init.c:
bugfix - transaction id's are unsigned
mysys/testhash.c:
remove _db_on_ and DEBUGGER_ON/OFF
sql/ha_myisammrg.cc:
missed ;
sql/ha_ndbcluster.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
sql/ha_ndbcluster_binlog.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
sql/item_cmpfunc.cc:
missed ;
sql/lock.cc:
missed DBUG_RETURN
sql/log_event.cc:
missed ;
sql/mysqld.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
DBUG_SET_INITIAL
sql/opt_range.cc:
remove _db_on_ and DEBUGGER_ON/OFF
sql/set_var.cc:
class sys_var_thd_dbug and "debug" server variable
sql/set_var.h:
class sys_var_thd_dbug and "debug" server variable
sql/slave.cc:
missed ;
sql/sql_cache.cc:
missed ;
sql/sql_plugin.cc:
missed ;
sql/sql_select.cc:
remove _db_on_ and DEBUGGER_ON/OFF
storage/heap/hp_test2.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/ft_eval.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/ft_test1.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_open.c:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
storage/myisam/mi_test1.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_test2.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_test3.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/ndb/src/ndbapi/DictCache.cpp:
missed ;
storage/ndb/src/ndbapi/NdbTransaction.cpp:
missed ;
tests/mysql_client_test.c:
remove _db_on_ and DEBUGGER_ON/OFF
2006-02-14 22:36:11 +01:00
|
|
|
sys_var_thd_bit(const char *name_arg,
|
2004-03-27 01:07:09 +01:00
|
|
|
sys_check_func c_func, sys_update_func u_func,
|
|
|
|
ulong bit, bool reverse_arg=0)
|
|
|
|
:sys_var_thd(name_arg), check_func(c_func), update_func(u_func),
|
|
|
|
bit_flag(bit), reverse(reverse_arg)
|
2002-07-23 17:31:22 +02:00
|
|
|
{}
|
2004-03-27 01:07:09 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
SHOW_TYPE type() { return SHOW_MY_BOOL; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
dbug changes:
1. dbug state is now local to a thread
2. new macros: DBUG_EXPLAIN, DBUG_EXPLAIN_INITIAL,
DBUG_SET, DBUG_SET_INITIAL, DBUG_EVALUATE, DBUG_EVALUATE_IF
3. macros are do{}while(0) wrapped
4. incremental modifications to the dbug state (e.g. "+d,info:-t")
5. dbug code cleanup, style fixes
6. _db_on_ and DEBUGGER_ON/OFF removed
7. rest of MySQL code fixed because of 3 (missing ;) and 6
8. dbug manual updated
9. server variable @@debug (global and local) to control dbug from SQL!
a. -#T to print timestamps in the log
BitKeeper/deleted/.del-readme.prof~2f3bae1550a0038d:
Delete: dbug/readme.prof
client/mysqlslap.c:
typo fixed
configure.in:
test for sleep() too
dbug/dbug.c:
thread local dbug settings
DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL
style changes to be more in line with MySQL code
cleanup (many mallocs removed)
incremental modification of dbug state (e.g. DBUG_PUSH("+t:-d,info"))
DBUG_SET, _db_explain_
-#T
dbug/monty.doc:
obsolete and duplicate docs removed
dbug/user.r:
new features documented
include/my_dbug.h:
correct do{}while wrapping
thread local dbug settings
DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL
DBUG_EVALUATE,DBUG_EVALUATE_IF
libmysql/libmysql.c:
remove _db_on_ and DEBUGGER_ON/OFF
mysys/my_init.c:
missed DBUG_RETURN
mysys/my_thr_init.c:
bugfix - transaction id's are unsigned
mysys/testhash.c:
remove _db_on_ and DEBUGGER_ON/OFF
sql/ha_myisammrg.cc:
missed ;
sql/ha_ndbcluster.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
sql/ha_ndbcluster_binlog.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
sql/item_cmpfunc.cc:
missed ;
sql/lock.cc:
missed DBUG_RETURN
sql/log_event.cc:
missed ;
sql/mysqld.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
DBUG_SET_INITIAL
sql/opt_range.cc:
remove _db_on_ and DEBUGGER_ON/OFF
sql/set_var.cc:
class sys_var_thd_dbug and "debug" server variable
sql/set_var.h:
class sys_var_thd_dbug and "debug" server variable
sql/slave.cc:
missed ;
sql/sql_cache.cc:
missed ;
sql/sql_plugin.cc:
missed ;
sql/sql_select.cc:
remove _db_on_ and DEBUGGER_ON/OFF
storage/heap/hp_test2.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/ft_eval.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/ft_test1.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_open.c:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
storage/myisam/mi_test1.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_test2.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_test3.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/ndb/src/ndbapi/DictCache.cpp:
missed ;
storage/ndb/src/ndbapi/NdbTransaction.cpp:
missed ;
tests/mysql_client_test.c:
remove _db_on_ and DEBUGGER_ON/OFF
2006-02-14 22:36:11 +01:00
|
|
|
class sys_var_thd_dbug :public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_thd_dbug(const char *name_arg) :sys_var_thd(name_arg) {}
|
|
|
|
bool check_update_type(Item_result type) { return type != STRING_RESULT; }
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
bool update(THD *thd, set_var *var);
|
2006-02-15 00:14:37 +01:00
|
|
|
void set_default(THD *thd, enum_var_type type) { DBUG_POP(); }
|
dbug changes:
1. dbug state is now local to a thread
2. new macros: DBUG_EXPLAIN, DBUG_EXPLAIN_INITIAL,
DBUG_SET, DBUG_SET_INITIAL, DBUG_EVALUATE, DBUG_EVALUATE_IF
3. macros are do{}while(0) wrapped
4. incremental modifications to the dbug state (e.g. "+d,info:-t")
5. dbug code cleanup, style fixes
6. _db_on_ and DEBUGGER_ON/OFF removed
7. rest of MySQL code fixed because of 3 (missing ;) and 6
8. dbug manual updated
9. server variable @@debug (global and local) to control dbug from SQL!
a. -#T to print timestamps in the log
BitKeeper/deleted/.del-readme.prof~2f3bae1550a0038d:
Delete: dbug/readme.prof
client/mysqlslap.c:
typo fixed
configure.in:
test for sleep() too
dbug/dbug.c:
thread local dbug settings
DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL
style changes to be more in line with MySQL code
cleanup (many mallocs removed)
incremental modification of dbug state (e.g. DBUG_PUSH("+t:-d,info"))
DBUG_SET, _db_explain_
-#T
dbug/monty.doc:
obsolete and duplicate docs removed
dbug/user.r:
new features documented
include/my_dbug.h:
correct do{}while wrapping
thread local dbug settings
DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL
DBUG_EVALUATE,DBUG_EVALUATE_IF
libmysql/libmysql.c:
remove _db_on_ and DEBUGGER_ON/OFF
mysys/my_init.c:
missed DBUG_RETURN
mysys/my_thr_init.c:
bugfix - transaction id's are unsigned
mysys/testhash.c:
remove _db_on_ and DEBUGGER_ON/OFF
sql/ha_myisammrg.cc:
missed ;
sql/ha_ndbcluster.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
sql/ha_ndbcluster_binlog.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
sql/item_cmpfunc.cc:
missed ;
sql/lock.cc:
missed DBUG_RETURN
sql/log_event.cc:
missed ;
sql/mysqld.cc:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
DBUG_SET_INITIAL
sql/opt_range.cc:
remove _db_on_ and DEBUGGER_ON/OFF
sql/set_var.cc:
class sys_var_thd_dbug and "debug" server variable
sql/set_var.h:
class sys_var_thd_dbug and "debug" server variable
sql/slave.cc:
missed ;
sql/sql_cache.cc:
missed ;
sql/sql_plugin.cc:
missed ;
sql/sql_select.cc:
remove _db_on_ and DEBUGGER_ON/OFF
storage/heap/hp_test2.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/ft_eval.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/ft_test1.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_open.c:
remove _db_on_ and DEBUGGER_ON/OFF
missed ;
storage/myisam/mi_test1.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_test2.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/myisam/mi_test3.c:
remove _db_on_ and DEBUGGER_ON/OFF
storage/ndb/src/ndbapi/DictCache.cpp:
missed ;
storage/ndb/src/ndbapi/NdbTransaction.cpp:
missed ;
tests/mysql_client_test.c:
remove _db_on_ and DEBUGGER_ON/OFF
2006-02-14 22:36:11 +01:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
|
|
|
|
/* some variables that require special handling */
|
|
|
|
|
|
|
|
class sys_var_timestamp :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_timestamp(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
|
|
|
SHOW_TYPE type() { return SHOW_LONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_last_insert_id :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_last_insert_id(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_insert_id :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_insert_id(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-06-10 15:56:13 +02:00
|
|
|
#ifdef HAVE_REPLICATION
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_slave_skip_counter :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_slave_skip_counter(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
|
|
|
|
/*
|
|
|
|
We can't retrieve the value of this, so we don't have to define
|
|
|
|
type() or value_ptr()
|
|
|
|
*/
|
|
|
|
};
|
2004-06-10 15:56:13 +02:00
|
|
|
|
|
|
|
class sys_var_sync_binlog_period :public sys_var_long_ptr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_sync_binlog_period(const char *name_arg, ulong *value_ptr)
|
|
|
|
:sys_var_long_ptr(name_arg,value_ptr) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
};
|
2002-12-16 14:33:29 +01:00
|
|
|
#endif
|
2002-07-23 17:31:22 +02:00
|
|
|
|
2002-11-07 03:02:37 +01:00
|
|
|
class sys_var_rand_seed1 :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_rand_seed1(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_rand_seed2 :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_rand_seed2(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-04-07 13:10:27 +02:00
|
|
|
class sys_var_collation :public sys_var_thd
|
2003-02-26 13:37:41 +01:00
|
|
|
{
|
|
|
|
public:
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
sys_var_collation(const char *name_arg) :sys_var_thd(name_arg)
|
|
|
|
{
|
|
|
|
no_support_one_shot= 0;
|
|
|
|
}
|
2003-02-26 13:37:41 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2003-04-07 13:10:27 +02:00
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-02-26 13:37:41 +01:00
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
return ((type != STRING_RESULT) && (type != INT_RESULT));
|
2003-02-26 13:37:41 +01:00
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
2003-04-07 13:10:27 +02:00
|
|
|
virtual void set_default(THD *thd, enum_var_type type)= 0;
|
|
|
|
};
|
|
|
|
|
2003-05-21 14:44:12 +02:00
|
|
|
class sys_var_character_set :public sys_var_thd
|
2003-04-07 13:10:27 +02:00
|
|
|
{
|
|
|
|
public:
|
2003-05-30 10:56:02 +02:00
|
|
|
bool nullable;
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
sys_var_character_set(const char *name_arg) :
|
|
|
|
sys_var_thd(name_arg)
|
|
|
|
{
|
|
|
|
nullable= 0;
|
|
|
|
/*
|
|
|
|
In fact only almost all variables derived from sys_var_character_set
|
|
|
|
support ONE_SHOT; character_set_results doesn't. But that's good enough.
|
|
|
|
*/
|
|
|
|
no_support_one_shot= 0;
|
|
|
|
}
|
2003-05-21 14:44:12 +02:00
|
|
|
bool check(THD *thd, set_var *var);
|
2004-03-30 21:13:25 +02:00
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-05-21 14:44:12 +02:00
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
return ((type != STRING_RESULT) && (type != INT_RESULT));
|
2003-05-21 14:44:12 +02:00
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
2003-05-30 10:03:56 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2003-05-21 14:44:12 +02:00
|
|
|
virtual void set_default(THD *thd, enum_var_type type)= 0;
|
2003-05-30 10:03:56 +02:00
|
|
|
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
|
2003-05-21 14:44:12 +02:00
|
|
|
};
|
|
|
|
|
2006-01-18 09:55:38 +01:00
|
|
|
class sys_var_character_set_filesystem :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_filesystem(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
2003-05-21 14:44:12 +02:00
|
|
|
class sys_var_character_set_client :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_client(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
2003-04-07 13:10:27 +02:00
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2003-05-30 10:03:56 +02:00
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
2003-04-07 13:10:27 +02:00
|
|
|
};
|
|
|
|
|
2003-05-21 14:44:12 +02:00
|
|
|
class sys_var_character_set_results :public sys_var_character_set
|
2003-04-07 13:10:27 +02:00
|
|
|
{
|
|
|
|
public:
|
2003-05-21 14:44:12 +02:00
|
|
|
sys_var_character_set_results(const char *name_arg) :
|
2003-05-30 10:56:02 +02:00
|
|
|
sys_var_character_set(name_arg)
|
|
|
|
{ nullable= 1; }
|
2003-04-07 13:10:27 +02:00
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2003-05-30 10:03:56 +02:00
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_character_set_server :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_server(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_character_set_database :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_database(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
2003-02-26 13:37:41 +01:00
|
|
|
};
|
|
|
|
|
2003-05-30 10:24:24 +02:00
|
|
|
class sys_var_character_set_connection :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_connection(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
2003-05-21 14:44:12 +02:00
|
|
|
class sys_var_collation_connection :public sys_var_collation
|
2003-04-08 11:38:17 +02:00
|
|
|
{
|
|
|
|
public:
|
2003-05-21 14:44:12 +02:00
|
|
|
sys_var_collation_connection(const char *name_arg) :sys_var_collation(name_arg) {}
|
2003-04-08 11:38:17 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2003-04-08 11:38:17 +02:00
|
|
|
};
|
|
|
|
|
2003-09-15 13:31:04 +02:00
|
|
|
class sys_var_collation_server :public sys_var_collation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_collation_database :public sys_var_collation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
};
|
2003-07-06 18:09:57 +02:00
|
|
|
|
2003-11-18 12:47:27 +01:00
|
|
|
|
2003-10-02 05:20:17 +02:00
|
|
|
class sys_var_key_cache_param :public sys_var
|
2003-07-06 18:09:57 +02:00
|
|
|
{
|
2003-10-02 05:20:17 +02:00
|
|
|
protected:
|
2003-11-18 12:47:27 +01:00
|
|
|
size_t offset;
|
2003-07-06 18:09:57 +02:00
|
|
|
public:
|
2003-11-18 12:47:27 +01:00
|
|
|
sys_var_key_cache_param(const char *name_arg, size_t offset_arg)
|
|
|
|
:sys_var(name_arg), offset(offset_arg)
|
|
|
|
{}
|
2003-10-02 05:20:17 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2003-11-18 12:47:27 +01:00
|
|
|
bool check_default(enum_var_type type) { return 1; }
|
|
|
|
bool is_struct() { return 1; }
|
2003-10-02 05:20:17 +02:00
|
|
|
};
|
|
|
|
|
2003-11-18 12:47:27 +01:00
|
|
|
|
2003-10-02 05:20:17 +02:00
|
|
|
class sys_var_key_buffer_size :public sys_var_key_cache_param
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_key_buffer_size(const char *name_arg)
|
2003-11-20 21:06:25 +01:00
|
|
|
:sys_var_key_cache_param(name_arg, offsetof(KEY_CACHE, param_buff_size))
|
2003-11-18 12:47:27 +01:00
|
|
|
{}
|
2003-07-06 18:09:57 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-10-02 05:20:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-11-18 12:47:27 +01:00
|
|
|
class sys_var_key_cache_long :public sys_var_key_cache_param
|
2003-10-02 05:20:17 +02:00
|
|
|
{
|
|
|
|
public:
|
2003-11-18 12:47:27 +01:00
|
|
|
sys_var_key_cache_long(const char *name_arg, size_t offset_arg)
|
|
|
|
:sys_var_key_cache_param(name_arg, offset_arg)
|
|
|
|
{}
|
2003-10-02 05:20:17 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-11-03 13:01:59 +01:00
|
|
|
class sys_var_thd_date_time_format :public sys_var_thd
|
2003-10-20 10:24:18 +02:00
|
|
|
{
|
2003-11-03 13:01:59 +01:00
|
|
|
DATE_TIME_FORMAT *SV::*offset;
|
Fix for Bug#4030 "Client side conversion string -> date type doesn't
work (prepared statements)" and after-review fixes:
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- functions str_to_time and str_to_TIME moved to sql-common
- send_data_str now supports MYSQL_TYPE_TIME, MYSQL_TIME_DATE,
MYSQL_TIME_DATETIME types of user input buffers.
- few more comments in the client library
- a test case added.
VC++Files/libmysql/libmysql.dsp:
new file: my_time.c
VC++Files/libmysqld/libmysqld.dsp:
new file: my_time.c
VC++Files/sql/mysqld.dsp:
new file: my_time.c
include/Makefile.am:
- mysql_time.h added to the list of installed client library headers
include/mysql.h:
- declarations for MYSQL_TIME and enum_mysql_timestamp_type moved to
mysql_time.h, which is in shared use of client library and mysys.
libmysql/Makefile.shared:
- my_time.lo added to the list of libmysql objects
libmysql/libmysql.c:
Fix for bug#4030 "Client side conversion string -> date type doesn't work
(prepared statements)" and cleanup.
- added case labels for TIME/DATE/DATETIME types to send_data_str
- comments for read_binary_{date,time,datetime}, fetch_result_*, fetch_results.
libmysqld/Makefile.am:
- my_time.c added
sql-common/Makefile.am:
- my_time.c added to the list of files included into source distribution.
sql/Makefile.am:
my_time.c added to the list of mysqld sources.
sql/field.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item_timefunc.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/mysql_priv.h:
- added typedefs for TIME and timestamp_type
- removed declarations for str_to_time and str_to_TIME (now this functions
reside in mysys)
sql/mysqld.cc:
- log_10_int moved to mysys (it's used by str_to_TIME and str_to_time)
- enum values TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
sql/set_var.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/set_var.h:
- fixed timestamp_type usage to be compatible with typedef.
sql/sql_prepare.cc:
- TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
- embedded library implementation of set_param_{time,date,datetime} is
much simplier now, as MYSQL_TIME is the same as TIME.
sql/sql_yacc.yy:
- s/\<TIMESTAMP_/MYSQL_TIMESTAMP/gc
sql/structs.h:
- declarations for TIME and timestamp_type replaced with typedefs
- str_to_datetime arguments moved to mysys headers
sql/time.cc:
- str_to_time and str_to_TIME moved to mysys
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...} as these names are now
exported to client.
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- str_to_TIME_with_warn renamed accordingly
sql/tztime.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
tests/client_test.c:
- a test case for Bug#4030 "Client side conversion string -> date type
doesn't work (prepared statements)"
2004-06-24 17:08:36 +02:00
|
|
|
timestamp_type date_time_type;
|
2003-10-20 10:24:18 +02:00
|
|
|
public:
|
2003-11-03 13:01:59 +01:00
|
|
|
sys_var_thd_date_time_format(const char *name_arg,
|
|
|
|
DATE_TIME_FORMAT *SV::*offset_arg,
|
|
|
|
timestamp_type date_time_type_arg)
|
|
|
|
:sys_var_thd(name_arg), offset(offset_arg),
|
|
|
|
date_time_type(date_time_type_arg)
|
2003-10-20 10:24:18 +02:00
|
|
|
{}
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return type != STRING_RESULT; /* Only accept strings */
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
2003-11-03 13:01:59 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2003-10-20 10:24:18 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
2003-11-03 13:01:59 +01:00
|
|
|
void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value);
|
2003-10-20 10:24:18 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-06-19 15:30:55 +02:00
|
|
|
class sys_var_log_state :public sys_var_bool_ptr
|
|
|
|
{
|
|
|
|
uint log_type;
|
|
|
|
public:
|
|
|
|
sys_var_log_state(const char *name_arg, my_bool *value_arg, uint log_type_arg)
|
|
|
|
:sys_var_bool_ptr(name_arg, value_arg), log_type(log_type_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_log_output :public sys_var
|
|
|
|
{
|
2006-06-23 01:49:19 +02:00
|
|
|
ulong *value;
|
2006-06-19 15:30:55 +02:00
|
|
|
TYPELIB *enum_names;
|
|
|
|
public:
|
2006-06-23 01:49:19 +02:00
|
|
|
sys_var_log_output(const char *name_arg, ulong *value_arg,
|
2006-06-19 15:30:55 +02:00
|
|
|
TYPELIB *typelib, sys_after_update_func func)
|
|
|
|
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_set(thd, var, enum_names);
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
/* Variable that you can only read from */
|
|
|
|
|
|
|
|
class sys_var_readonly: public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum_var_type var_type;
|
|
|
|
SHOW_TYPE show_type;
|
|
|
|
sys_value_ptr_func value_ptr_func;
|
|
|
|
sys_var_readonly(const char *name_arg, enum_var_type type,
|
|
|
|
SHOW_TYPE show_type_arg,
|
|
|
|
sys_value_ptr_func value_ptr_func_arg)
|
|
|
|
:sys_var(name_arg), var_type(type),
|
|
|
|
show_type(show_type_arg), value_ptr_func(value_ptr_func_arg)
|
|
|
|
{}
|
|
|
|
bool update(THD *thd, set_var *var) { return 1; }
|
|
|
|
bool check_default(enum_var_type type) { return 1; }
|
|
|
|
bool check_type(enum_var_type type) { return type != var_type; }
|
|
|
|
bool check_update_type(Item_result type) { return 1; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
|
|
|
return (*value_ptr_func)(thd);
|
|
|
|
}
|
|
|
|
SHOW_TYPE type() { return show_type; }
|
2005-05-13 13:18:27 +02:00
|
|
|
bool is_readonly() const { return 1; }
|
2002-10-02 12:33:08 +02:00
|
|
|
};
|
|
|
|
|
2005-11-06 01:36:40 +01:00
|
|
|
|
|
|
|
class sys_var_have_variable: public sys_var
|
|
|
|
{
|
|
|
|
SHOW_COMP_OPTION *have_variable;
|
|
|
|
|
|
|
|
public:
|
|
|
|
sys_var_have_variable(const char *variable_name,
|
|
|
|
SHOW_COMP_OPTION *have_variable_arg):
|
|
|
|
sys_var(variable_name),
|
|
|
|
have_variable(have_variable_arg)
|
|
|
|
{ }
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{
|
|
|
|
return (byte*) show_comp_option_name[*have_variable];
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var) { return 1; }
|
|
|
|
bool check_default(enum_var_type type) { return 1; }
|
|
|
|
bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
|
|
|
|
bool check_update_type(Item_result type) { return 1; }
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
bool is_readonly() const { return 1; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
class sys_var_thd_time_zone :public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_thd_time_zone(const char *name_arg):
|
|
|
|
sys_var_thd(name_arg)
|
|
|
|
{
|
|
|
|
no_support_one_shot= 0;
|
|
|
|
}
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return type != STRING_RESULT; /* Only accept strings */
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
virtual void set_default(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
2004-12-29 18:30:37 +01:00
|
|
|
|
|
|
|
class sys_var_max_user_conn : public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_max_user_conn(const char *name_arg):
|
|
|
|
sys_var_thd(name_arg) {}
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_default(enum_var_type type)
|
|
|
|
{
|
|
|
|
return type != OPT_GLOBAL || !option_limits;
|
|
|
|
}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2005-01-19 22:54:01 +01:00
|
|
|
SHOW_TYPE type() { return SHOW_INT; }
|
2004-12-29 18:30:37 +01:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
};
|
|
|
|
|
2005-11-10 17:50:51 +01:00
|
|
|
class sys_var_trust_routine_creators :public sys_var_bool_ptr
|
|
|
|
{
|
|
|
|
/* We need a derived class only to have a warn_deprecated() */
|
|
|
|
public:
|
|
|
|
sys_var_trust_routine_creators(const char *name_arg, my_bool *value_arg) :
|
|
|
|
sys_var_bool_ptr(name_arg, value_arg) {};
|
|
|
|
void warn_deprecated(THD *thd);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
};
|
|
|
|
|
2005-12-06 16:15:29 +01:00
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
class sys_var_event_scheduler :public sys_var_long_ptr
|
2005-12-06 16:15:29 +01:00
|
|
|
{
|
|
|
|
/* We need a derived class only to have a warn_deprecated() */
|
|
|
|
public:
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
sys_var_event_scheduler(const char *name_arg) :
|
|
|
|
sys_var_long_ptr(name_arg, NULL, NULL) {};
|
2005-12-06 16:15:29 +01:00
|
|
|
bool update(THD *thd, set_var *var);
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2005-12-06 16:15:29 +01:00
|
|
|
};
|
|
|
|
|
2006-05-16 11:16:23 +02:00
|
|
|
#ifdef HAVE_ROW_BASED_REPLICATION
|
WL#2977 and WL#2712 global and session-level variable to set the binlog format (row/statement),
and new binlog format called "mixed" (which is statement-based except if only row-based is correct,
in this cset it means if UDF or UUID is used; more cases could be added in later 5.1 release):
SET GLOBAL|SESSION BINLOG_FORMAT=row|statement|mixed|default;
the global default is statement unless cluster is enabled (then it's row) as in 5.1-alpha.
It's not possible to use SET on this variable if a session is currently in row-based mode and has open temporary tables (because CREATE
TEMPORARY TABLE was not binlogged so temp table is not known on slave), or if NDB is enabled (because
NDB does not support such change on-the-fly, though it will later), of if in a stored function (see below).
The added tests test the possibility or impossibility to SET, their effects, and the mixed mode,
including in prepared statements and in stored procedures and functions.
Caveats:
a) The mixed mode will not work for stored functions: in mixed mode, a stored function will
always be binlogged as one call and in a statement-based way (e.g. INSERT VALUES(myfunc()) or SELECT myfunc()).
b) for the same reason, changing the thread's binlog format inside a stored function is
refused with an error message.
c) the same problems apply to triggers; implementing b) for triggers will be done later (will ask
Dmitri).
Additionally, as the binlog format is now changeable by each user for his session, I remove the implication
which was done at startup, where row-based automatically set log-bin-trust-routine-creators to 1
(not possible anymore as a user can now switch to stmt-based and do nasty things again), and automatically
set --innodb-locks-unsafe-for-binlog to 1 (was anyway theoretically incorrect as it disabled
phantom protection).
Plus fixes for compiler warnings.
mysql-test/r/rpl_row_4_bytes.result:
update
mysql-test/t/rpl_row_4_bytes.test:
don't influence next tests
sql/ha_archive.cc:
please pay attention to this structure when you change it...
sql/ha_berkeley.cc:
please pay attention to this structure when you change it...
sql/ha_blackhole.cc:
please pay attention to this structure when you change it...
sql/ha_federated.cc:
please pay attention to this structure when you change it...
sql/ha_heap.cc:
please pay attention to this structure when you change it...
sql/ha_innodb.cc:
please pay attention to this structure when you change it...
sql/ha_myisam.cc:
please pay attention to this structure when you change it...
sql/ha_myisammrg.cc:
please pay attention to this structure when you change it...
sql/ha_ndbcluster_binlog.cc:
no more global 'binlog_row_based'
sql/ha_partition.cc:
please pay attention to this structure when you change it...
sql/handler.cc:
please pay attention to this structure when you change it...
sql/handler.h:
it's good to initialize statically (to get no compiler warning) even if to a null value.
sql/item_func.cc:
UDFs require row-based if this is the "mixed" binlog format.
sql/item_strfunc.cc:
UUID() requires row-based binlogging if this is the "mixed" binlog format
sql/log.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/log.h:
the enum enum_binlog_format moves to log.h from mysqld.cc as we need it in several places.
sql/log_event.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/log_event.h:
this global variable not used anymore
sql/mysql_priv.h:
these global variables not used anymore
sql/mysqld.cc:
simplification in the handling of --binlog-format (but with no user-visible change), thanks to
the new global system variable.
RBR does not anymore turn on --log-bin-trust-function-creators and --innodb-locks-unsafe-for-binlog
as these are global options and RBR is now settable per session.
sql/partition_info.cc:
compiler warnings
sql/set_var.cc:
new class of thread's variable, to handle the binlog_format (like sys_var_thd_enum except
that is_readonly() is overriden for more checks before update).
compiler warnings (ok'd by Serg)
sql/set_var.h:
new class for the thread's binlog_format (see set_var.cc)
sql/share/errmsg.txt:
some messages for when one can't toggle from one binlog format to another
sql/sp_head.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_base.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_class.cc:
When a THD is initialized, we set its current_stmt_binlog_row_based
sql/sql_class.h:
new THD::variables.binlog_format (the value of the session variable set by SET
or inherited from the global value), and THD::current_stmt_binlog_row_based which tells if the
current statement does row-based or statement-based binlogging. Both members are needed
as the 2nd one cannot be derived only from the first one (the statement's type plays a role too),
and the 1st one is needed to reset the 2nd one.
sql/sql_delete.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_insert.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_load.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based.
sql/sql_parse.cc:
when we are done with a statement, we reset the current_stmt_binlog_row_based to the value
derived from THD::variables.binlog_format.
sql/sql_partition.cc:
compiler warning
sql/sql_show.cc:
compiler warning
sql/sql_table.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
tests/mysql_client_test.c:
compiler warning
mysql-test/r/ndb_binlog_basic2.result:
new result
mysql-test/r/rpl_switch_stm_row_mixed.result:
new result
mysql-test/t/ndb_binlog_basic2.test:
new test to verify that if cluster is enabled, can't change binlog format on the fly.
mysql-test/t/rpl_switch_stm_row_mixed.test:
test to see if one can switch between SBR, RBR, and "mixed" mode, and when one cannot,
and test to see if the switching, and the mixed mode, work properly (using UUID() to test,
as using UDFs is not possible in the testsuite for portability reasons).
2006-02-25 22:21:03 +01:00
|
|
|
extern void fix_binlog_format_after_update(THD *thd, enum_var_type type);
|
2006-05-16 11:16:23 +02:00
|
|
|
#endif
|
WL#2977 and WL#2712 global and session-level variable to set the binlog format (row/statement),
and new binlog format called "mixed" (which is statement-based except if only row-based is correct,
in this cset it means if UDF or UUID is used; more cases could be added in later 5.1 release):
SET GLOBAL|SESSION BINLOG_FORMAT=row|statement|mixed|default;
the global default is statement unless cluster is enabled (then it's row) as in 5.1-alpha.
It's not possible to use SET on this variable if a session is currently in row-based mode and has open temporary tables (because CREATE
TEMPORARY TABLE was not binlogged so temp table is not known on slave), or if NDB is enabled (because
NDB does not support such change on-the-fly, though it will later), of if in a stored function (see below).
The added tests test the possibility or impossibility to SET, their effects, and the mixed mode,
including in prepared statements and in stored procedures and functions.
Caveats:
a) The mixed mode will not work for stored functions: in mixed mode, a stored function will
always be binlogged as one call and in a statement-based way (e.g. INSERT VALUES(myfunc()) or SELECT myfunc()).
b) for the same reason, changing the thread's binlog format inside a stored function is
refused with an error message.
c) the same problems apply to triggers; implementing b) for triggers will be done later (will ask
Dmitri).
Additionally, as the binlog format is now changeable by each user for his session, I remove the implication
which was done at startup, where row-based automatically set log-bin-trust-routine-creators to 1
(not possible anymore as a user can now switch to stmt-based and do nasty things again), and automatically
set --innodb-locks-unsafe-for-binlog to 1 (was anyway theoretically incorrect as it disabled
phantom protection).
Plus fixes for compiler warnings.
mysql-test/r/rpl_row_4_bytes.result:
update
mysql-test/t/rpl_row_4_bytes.test:
don't influence next tests
sql/ha_archive.cc:
please pay attention to this structure when you change it...
sql/ha_berkeley.cc:
please pay attention to this structure when you change it...
sql/ha_blackhole.cc:
please pay attention to this structure when you change it...
sql/ha_federated.cc:
please pay attention to this structure when you change it...
sql/ha_heap.cc:
please pay attention to this structure when you change it...
sql/ha_innodb.cc:
please pay attention to this structure when you change it...
sql/ha_myisam.cc:
please pay attention to this structure when you change it...
sql/ha_myisammrg.cc:
please pay attention to this structure when you change it...
sql/ha_ndbcluster_binlog.cc:
no more global 'binlog_row_based'
sql/ha_partition.cc:
please pay attention to this structure when you change it...
sql/handler.cc:
please pay attention to this structure when you change it...
sql/handler.h:
it's good to initialize statically (to get no compiler warning) even if to a null value.
sql/item_func.cc:
UDFs require row-based if this is the "mixed" binlog format.
sql/item_strfunc.cc:
UUID() requires row-based binlogging if this is the "mixed" binlog format
sql/log.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/log.h:
the enum enum_binlog_format moves to log.h from mysqld.cc as we need it in several places.
sql/log_event.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/log_event.h:
this global variable not used anymore
sql/mysql_priv.h:
these global variables not used anymore
sql/mysqld.cc:
simplification in the handling of --binlog-format (but with no user-visible change), thanks to
the new global system variable.
RBR does not anymore turn on --log-bin-trust-function-creators and --innodb-locks-unsafe-for-binlog
as these are global options and RBR is now settable per session.
sql/partition_info.cc:
compiler warnings
sql/set_var.cc:
new class of thread's variable, to handle the binlog_format (like sys_var_thd_enum except
that is_readonly() is overriden for more checks before update).
compiler warnings (ok'd by Serg)
sql/set_var.h:
new class for the thread's binlog_format (see set_var.cc)
sql/share/errmsg.txt:
some messages for when one can't toggle from one binlog format to another
sql/sp_head.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_base.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_class.cc:
When a THD is initialized, we set its current_stmt_binlog_row_based
sql/sql_class.h:
new THD::variables.binlog_format (the value of the session variable set by SET
or inherited from the global value), and THD::current_stmt_binlog_row_based which tells if the
current statement does row-based or statement-based binlogging. Both members are needed
as the 2nd one cannot be derived only from the first one (the statement's type plays a role too),
and the 1st one is needed to reset the 2nd one.
sql/sql_delete.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_insert.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_load.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based.
sql/sql_parse.cc:
when we are done with a statement, we reset the current_stmt_binlog_row_based to the value
derived from THD::variables.binlog_format.
sql/sql_partition.cc:
compiler warning
sql/sql_show.cc:
compiler warning
sql/sql_table.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
tests/mysql_client_test.c:
compiler warning
mysql-test/r/ndb_binlog_basic2.result:
new result
mysql-test/r/rpl_switch_stm_row_mixed.result:
new result
mysql-test/t/ndb_binlog_basic2.test:
new test to verify that if cluster is enabled, can't change binlog format on the fly.
mysql-test/t/rpl_switch_stm_row_mixed.test:
test to see if one can switch between SBR, RBR, and "mixed" mode, and when one cannot,
and test to see if the switching, and the mixed mode, work properly (using UUID() to test,
as using UDFs is not possible in the testsuite for portability reasons).
2006-02-25 22:21:03 +01:00
|
|
|
|
|
|
|
class sys_var_thd_binlog_format :public sys_var_thd_enum
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_thd_binlog_format(const char *name_arg, ulong SV::*offset_arg)
|
|
|
|
:sys_var_thd_enum(name_arg, offset_arg,
|
2006-05-16 11:16:23 +02:00
|
|
|
&binlog_format_typelib
|
|
|
|
#ifdef HAVE_ROW_BASED_REPLICATION
|
|
|
|
, fix_binlog_format_after_update
|
|
|
|
#endif
|
|
|
|
)
|
WL#2977 and WL#2712 global and session-level variable to set the binlog format (row/statement),
and new binlog format called "mixed" (which is statement-based except if only row-based is correct,
in this cset it means if UDF or UUID is used; more cases could be added in later 5.1 release):
SET GLOBAL|SESSION BINLOG_FORMAT=row|statement|mixed|default;
the global default is statement unless cluster is enabled (then it's row) as in 5.1-alpha.
It's not possible to use SET on this variable if a session is currently in row-based mode and has open temporary tables (because CREATE
TEMPORARY TABLE was not binlogged so temp table is not known on slave), or if NDB is enabled (because
NDB does not support such change on-the-fly, though it will later), of if in a stored function (see below).
The added tests test the possibility or impossibility to SET, their effects, and the mixed mode,
including in prepared statements and in stored procedures and functions.
Caveats:
a) The mixed mode will not work for stored functions: in mixed mode, a stored function will
always be binlogged as one call and in a statement-based way (e.g. INSERT VALUES(myfunc()) or SELECT myfunc()).
b) for the same reason, changing the thread's binlog format inside a stored function is
refused with an error message.
c) the same problems apply to triggers; implementing b) for triggers will be done later (will ask
Dmitri).
Additionally, as the binlog format is now changeable by each user for his session, I remove the implication
which was done at startup, where row-based automatically set log-bin-trust-routine-creators to 1
(not possible anymore as a user can now switch to stmt-based and do nasty things again), and automatically
set --innodb-locks-unsafe-for-binlog to 1 (was anyway theoretically incorrect as it disabled
phantom protection).
Plus fixes for compiler warnings.
mysql-test/r/rpl_row_4_bytes.result:
update
mysql-test/t/rpl_row_4_bytes.test:
don't influence next tests
sql/ha_archive.cc:
please pay attention to this structure when you change it...
sql/ha_berkeley.cc:
please pay attention to this structure when you change it...
sql/ha_blackhole.cc:
please pay attention to this structure when you change it...
sql/ha_federated.cc:
please pay attention to this structure when you change it...
sql/ha_heap.cc:
please pay attention to this structure when you change it...
sql/ha_innodb.cc:
please pay attention to this structure when you change it...
sql/ha_myisam.cc:
please pay attention to this structure when you change it...
sql/ha_myisammrg.cc:
please pay attention to this structure when you change it...
sql/ha_ndbcluster_binlog.cc:
no more global 'binlog_row_based'
sql/ha_partition.cc:
please pay attention to this structure when you change it...
sql/handler.cc:
please pay attention to this structure when you change it...
sql/handler.h:
it's good to initialize statically (to get no compiler warning) even if to a null value.
sql/item_func.cc:
UDFs require row-based if this is the "mixed" binlog format.
sql/item_strfunc.cc:
UUID() requires row-based binlogging if this is the "mixed" binlog format
sql/log.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/log.h:
the enum enum_binlog_format moves to log.h from mysqld.cc as we need it in several places.
sql/log_event.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/log_event.h:
this global variable not used anymore
sql/mysql_priv.h:
these global variables not used anymore
sql/mysqld.cc:
simplification in the handling of --binlog-format (but with no user-visible change), thanks to
the new global system variable.
RBR does not anymore turn on --log-bin-trust-function-creators and --innodb-locks-unsafe-for-binlog
as these are global options and RBR is now settable per session.
sql/partition_info.cc:
compiler warnings
sql/set_var.cc:
new class of thread's variable, to handle the binlog_format (like sys_var_thd_enum except
that is_readonly() is overriden for more checks before update).
compiler warnings (ok'd by Serg)
sql/set_var.h:
new class for the thread's binlog_format (see set_var.cc)
sql/share/errmsg.txt:
some messages for when one can't toggle from one binlog format to another
sql/sp_head.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_base.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_class.cc:
When a THD is initialized, we set its current_stmt_binlog_row_based
sql/sql_class.h:
new THD::variables.binlog_format (the value of the session variable set by SET
or inherited from the global value), and THD::current_stmt_binlog_row_based which tells if the
current statement does row-based or statement-based binlogging. Both members are needed
as the 2nd one cannot be derived only from the first one (the statement's type plays a role too),
and the 1st one is needed to reset the 2nd one.
sql/sql_delete.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_insert.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_load.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based.
sql/sql_parse.cc:
when we are done with a statement, we reset the current_stmt_binlog_row_based to the value
derived from THD::variables.binlog_format.
sql/sql_partition.cc:
compiler warning
sql/sql_show.cc:
compiler warning
sql/sql_table.cc:
binlog_row_based -> thd->current_stmt_binlog_row_based
tests/mysql_client_test.c:
compiler warning
mysql-test/r/ndb_binlog_basic2.result:
new result
mysql-test/r/rpl_switch_stm_row_mixed.result:
new result
mysql-test/t/ndb_binlog_basic2.test:
new test to verify that if cluster is enabled, can't change binlog format on the fly.
mysql-test/t/rpl_switch_stm_row_mixed.test:
test to see if one can switch between SBR, RBR, and "mixed" mode, and when one cannot,
and test to see if the switching, and the mixed mode, work properly (using UUID() to test,
as using UDFs is not possible in the testsuite for portability reasons).
2006-02-25 22:21:03 +01:00
|
|
|
{};
|
|
|
|
bool is_readonly() const;
|
|
|
|
};
|
2005-12-06 16:15:29 +01:00
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
/****************************************************************************
|
|
|
|
Classes for parsing of the SET command
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
class set_var_base :public Sql_alloc
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
set_var_base() {}
|
|
|
|
virtual ~set_var_base() {}
|
2002-09-22 17:02:39 +02:00
|
|
|
virtual int check(THD *thd)=0; /* To check privileges etc. */
|
|
|
|
virtual int update(THD *thd)=0; /* To set the value */
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
/* light check for PS */
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
virtual int light_check(THD *thd) { return check(thd); }
|
|
|
|
virtual bool no_support_one_shot() { return 1; }
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* MySQL internal variables, like query_cache_size */
|
|
|
|
|
|
|
|
class set_var :public set_var_base
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var *var;
|
|
|
|
Item *value;
|
|
|
|
enum_var_type type;
|
|
|
|
union
|
|
|
|
{
|
2003-02-26 13:37:41 +01:00
|
|
|
CHARSET_INFO *charset;
|
2002-07-23 17:31:22 +02:00
|
|
|
ulong ulong_value;
|
2003-10-24 16:28:32 +02:00
|
|
|
ulonglong ulonglong_value;
|
2005-12-21 19:18:40 +01:00
|
|
|
handlerton *hton;
|
2003-11-03 13:01:59 +01:00
|
|
|
DATE_TIME_FORMAT *date_time_format;
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
Time_zone *time_zone;
|
2002-07-23 17:31:22 +02:00
|
|
|
} save_result;
|
2003-08-18 23:08:08 +02:00
|
|
|
LEX_STRING base; /* for structs */
|
2002-07-23 17:31:22 +02:00
|
|
|
|
XA (not completely polished out yet)
include/my_pthread.h:
cleanup. don't use gcc extensions
innobase/include/trx0sys.ic:
Jan's fix for innobase_xa_prepare
innobase/read/read0read.c:
Jan's fix for innobase_xa_prepare
innobase/trx/trx0trx.c:
Jan's fix for innobase_xa_prepare
mysql-test/include/varchar.inc:
test fix
mysql-test/r/ctype_ucs.result:
new log event - all binlog positions are changed :(
mysql-test/r/drop_temp_table.result:
new log event - all binlog positions are changed :(
mysql-test/r/insert_select.result:
new log event - all binlog positions are changed :(
mysql-test/r/mix_innodb_myisam_binlog.result:
new log event - all binlog positions are changed :(
mysql-test/r/myisam.result:
test fix
mysql-test/r/rpl000015.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_change_master.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_charset.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_error_ignored_table.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_flush_log_loop.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_flush_tables.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_loaddata.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_loaddata_rule_m.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_loaddata_rule_s.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_log.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_log_pos.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_max_relay_size.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_relayrotate.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_replicate_do.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_reset_slave.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_rotate_logs.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_server_id1.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_server_id2.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_temporary.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_timezone.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_until.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_user_variables.result:
new log event - all binlog positions are changed :(
mysql-test/r/user_var.result:
new log event - all binlog positions are changed :(
mysql-test/t/ctype_ucs.test:
new log event - all binlog positions are changed :(
mysql-test/t/mix_innodb_myisam_binlog.test:
new log event - all binlog positions are changed :(
mysql-test/t/mysqlbinlog.test:
new log event - all binlog positions are changed :(
mysql-test/t/mysqlbinlog2.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_charset.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_error_ignored_table.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_loaddata_rule_m.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_loaddata_rule_s.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_log.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_log_pos.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_user_variables.test:
new log event - all binlog positions are changed :(
mysql-test/t/user_var.test:
new log event - all binlog positions are changed :(
mysys/hash.c:
typo fixed
sql/ha_berkeley.cc:
handlerton framework
sql/ha_berkeley.h:
handlerton framework
sql/ha_innodb.cc:
handlerton framework
sql/ha_innodb.h:
handlerton framework
sql/handler.cc:
new transaction handling, handlerton framework, two-phase commit, XA support
sql/handler.h:
new transaction handling, handlerton framework, two-phase commit, XA support
sql/lex.h:
XA commands
sql/log.cc:
new transaction handling, handlerton framework, two-phase commit,
XA support, tc-logging, TC_LOG_MMAP class
sql/log_event.cc:
Xid_log_event
sql/log_event.h:
Xid_log_event, LOG_EVENT_BINLOG_CLOSED_F flag
sql/mysql_priv.h:
wrapper for query_id++
sql/mysqld.cc:
new command-line options --log-tc, --log-tc-size, --tc-heuristic-recover,
new status variables Tc_log_page_size, Tc_log_max_pages_used, Tc_log_page_waits.
init/stop tc logging
sql/set_var.h:
warning fixed
sql/share/errmsg.txt:
XA error messages
sql/sp_head.cc:
s/query_id++/next_query_id()/
sql/sql_base.cc:
typo fixed. new transaction handling.
sql/sql_class.cc:
cleanup of THD.transaction
sql/sql_class.h:
TC_LOG classes, new status variables, new savepoint handling, XA support
sql/sql_insert.cc:
comments
sql/sql_lex.cc:
s/found_colon/found_semicolon/
sql/sql_lex.h:
SQLCOM_XA_xxx, XA related changes in Lex
sql/sql_parse.cc:
cleanup, XA commands, new savepoint handling
sql/sql_repl.cc:
two functions moved to log.cc
sql/sql_repl.h:
two functions moved to log.cc
sql/sql_trigger.cc:
s/lex.name_and_length/lex.ident/
sql/sql_yacc.yy:
XA commands, cleanup
2005-01-16 13:16:23 +01:00
|
|
|
set_var(enum_var_type type_arg, sys_var *var_arg, const LEX_STRING *base_name_arg,
|
2003-08-18 23:08:08 +02:00
|
|
|
Item *value_arg)
|
|
|
|
:var(var_arg), type(type_arg), base(*base_name_arg)
|
2002-07-23 17:31:22 +02:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
If the set value is a field, change it to a string to allow things like
|
|
|
|
SET table_type=MYISAM;
|
|
|
|
*/
|
|
|
|
if (value_arg && value_arg->type() == Item::FIELD_ITEM)
|
|
|
|
{
|
|
|
|
Item_field *item= (Item_field*) value_arg;
|
2005-06-13 12:41:15 +02:00
|
|
|
if (!(value=new Item_string(item->field_name,
|
|
|
|
(uint) strlen(item->field_name),
|
2003-08-05 09:52:37 +02:00
|
|
|
item->collation.collation)))
|
2002-07-23 17:31:22 +02:00
|
|
|
value=value_arg; /* Give error message later */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
value=value_arg;
|
|
|
|
}
|
2002-09-22 17:02:39 +02:00
|
|
|
int check(THD *thd);
|
|
|
|
int update(THD *thd);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
int light_check(THD *thd);
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
bool no_support_one_shot() { return var->no_support_one_shot; }
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* User variables like @my_own_variable */
|
|
|
|
|
|
|
|
class set_var_user: public set_var_base
|
|
|
|
{
|
|
|
|
Item_func_set_user_var *user_var_item;
|
|
|
|
public:
|
|
|
|
set_var_user(Item_func_set_user_var *item)
|
|
|
|
:user_var_item(item)
|
|
|
|
{}
|
2002-09-22 17:02:39 +02:00
|
|
|
int check(THD *thd);
|
|
|
|
int update(THD *thd);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
int light_check(THD *thd);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* For SET PASSWORD */
|
|
|
|
|
|
|
|
class set_var_password: public set_var_base
|
|
|
|
{
|
|
|
|
LEX_USER *user;
|
|
|
|
char *password;
|
|
|
|
public:
|
|
|
|
set_var_password(LEX_USER *user_arg,char *password_arg)
|
|
|
|
:user(user_arg), password(password_arg)
|
|
|
|
{}
|
2002-09-22 17:02:39 +02:00
|
|
|
int check(THD *thd);
|
|
|
|
int update(THD *thd);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-04-05 12:59:29 +02:00
|
|
|
/* For SET NAMES and SET CHARACTER SET */
|
|
|
|
|
2003-04-23 15:19:22 +02:00
|
|
|
class set_var_collation_client: public set_var_base
|
2003-04-05 12:59:29 +02:00
|
|
|
{
|
2003-05-21 14:44:12 +02:00
|
|
|
CHARSET_INFO *character_set_client;
|
|
|
|
CHARSET_INFO *character_set_results;
|
2003-04-23 15:19:22 +02:00
|
|
|
CHARSET_INFO *collation_connection;
|
2003-04-05 12:59:29 +02:00
|
|
|
public:
|
2003-04-23 15:19:22 +02:00
|
|
|
set_var_collation_client(CHARSET_INFO *client_coll_arg,
|
2003-04-22 09:27:35 +02:00
|
|
|
CHARSET_INFO *connection_coll_arg,
|
2003-04-08 11:38:17 +02:00
|
|
|
CHARSET_INFO *result_coll_arg)
|
2003-05-21 14:44:12 +02:00
|
|
|
:character_set_client(client_coll_arg),
|
|
|
|
character_set_results(result_coll_arg),
|
|
|
|
collation_connection(connection_coll_arg)
|
2003-04-05 12:59:29 +02:00
|
|
|
{}
|
|
|
|
int check(THD *thd);
|
|
|
|
int update(THD *thd);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-07-06 18:09:57 +02:00
|
|
|
/* Named lists (used for keycaches) */
|
|
|
|
|
|
|
|
class NAMED_LIST :public ilink
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
uint name_length;
|
|
|
|
public:
|
|
|
|
gptr data;
|
|
|
|
|
|
|
|
NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
|
2003-08-18 23:08:08 +02:00
|
|
|
uint name_length_arg, gptr data_arg)
|
|
|
|
:name_length(name_length_arg), data(data_arg)
|
|
|
|
{
|
2006-01-26 04:54:42 +01:00
|
|
|
name= my_strndup((byte*) name_arg, name_length, MYF(MY_WME));
|
2003-08-18 23:08:08 +02:00
|
|
|
links->push_back(this);
|
|
|
|
}
|
2003-07-06 18:09:57 +02:00
|
|
|
inline bool cmp(const char *name_cmp, uint length)
|
|
|
|
{
|
|
|
|
return length == name_length && !memcmp(name, name_cmp, length);
|
|
|
|
}
|
|
|
|
~NAMED_LIST()
|
|
|
|
{
|
|
|
|
my_free((char*) name, MYF(0));
|
|
|
|
}
|
2003-11-18 12:47:27 +01:00
|
|
|
friend bool process_key_caches(int (* func) (const char *name,
|
2003-11-20 21:06:25 +01:00
|
|
|
KEY_CACHE *));
|
2003-11-18 12:47:27 +01:00
|
|
|
friend void delete_elements(I_List<NAMED_LIST> *list,
|
|
|
|
void (*free_element)(const char*, gptr));
|
2003-07-06 18:09:57 +02:00
|
|
|
};
|
|
|
|
|
2003-07-09 16:24:43 +02:00
|
|
|
/* updated in sql_acl.cc */
|
|
|
|
|
2005-07-22 22:43:59 +02:00
|
|
|
extern sys_var_thd_bool sys_old_alter_table;
|
2003-07-09 16:24:43 +02:00
|
|
|
extern sys_var_thd_bool sys_old_passwords;
|
2003-11-18 12:47:27 +01:00
|
|
|
extern LEX_STRING default_key_cache_base;
|
2003-07-06 18:09:57 +02:00
|
|
|
|
2003-08-18 23:08:08 +02:00
|
|
|
/* For sql_yacc */
|
|
|
|
struct sys_var_with_base
|
|
|
|
{
|
|
|
|
sys_var *var;
|
|
|
|
LEX_STRING base_name;
|
|
|
|
};
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
/*
|
|
|
|
Prototypes for helper functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
void set_var_init();
|
|
|
|
void set_var_free();
|
|
|
|
sys_var *find_sys_var(const char *str, uint length=0);
|
2002-09-22 17:02:39 +02:00
|
|
|
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
bool not_all_support_one_shot(List<set_var_base> *var_list);
|
2002-08-13 01:18:39 +02:00
|
|
|
void fix_delay_key_write(THD *thd, enum_var_type type);
|
2003-06-04 17:28:51 +02:00
|
|
|
ulong fix_sql_mode(ulong sql_mode);
|
2005-09-07 12:38:09 +02:00
|
|
|
extern sys_var_const_str sys_charset_system;
|
SCRUM:
Task 499 'init_connect, init_slave options'
mysql-test/mysql-test-run.sh:
Task 499 'init_connect, init_slave options'
This change needs because mysql-test-run cuts string variable on first space
sql/mysql_priv.h:
Task 499 'init_connect, init_slave options'
sql/mysqld.cc:
Task 499 'init_connect, init_slave options'
sql/protocol.cc:
Task 499 'init_connect, init_slave options'
sql/set_var.cc:
Task 499 'init_connect, init_slave options'
sql/set_var.h:
Task 499 'init_connect, init_slave options'
sql/slave.cc:
Task 499 'init_connect, init_slave options'
sql/sql_class.cc:
Task 499 'init_connect, init_slave options'
sql/sql_class.h:
Task 499 'init_connect, init_slave options'
sql/sql_parse.cc:
Task 499 'init_connect, init_slave options'
sql/sql_show.cc:
Task 499 'init_connect, init_slave options'
2003-07-18 11:11:01 +02:00
|
|
|
extern sys_var_str sys_init_connect;
|
|
|
|
extern sys_var_str sys_init_slave;
|
2004-08-10 10:42:31 +02:00
|
|
|
extern sys_var_thd_time_zone sys_time_zone;
|
2005-09-13 17:16:12 +02:00
|
|
|
extern sys_var_thd_bit sys_autocommit;
|
2003-04-05 15:56:15 +02:00
|
|
|
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
|
2003-08-18 23:08:08 +02:00
|
|
|
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
|
|
|
|
NAMED_LIST **found);
|
2003-07-06 18:09:57 +02:00
|
|
|
|
2006-06-19 15:30:55 +02:00
|
|
|
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
|
|
|
|
|
2003-07-06 18:09:57 +02:00
|
|
|
/* key_cache functions */
|
2003-11-20 21:06:25 +01:00
|
|
|
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
|
|
|
|
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
|
|
|
|
void free_key_cache(const char *name, KEY_CACHE *key_cache);
|
|
|
|
bool process_key_caches(int (* func) (const char *name, KEY_CACHE *));
|
2003-11-20 02:11:33 +01:00
|
|
|
void delete_elements(I_List<NAMED_LIST> *list,
|
|
|
|
void (*free_element)(const char*, gptr));
|