Commit bdf18f43 authored by unknown's avatar unknown

Merge mysql.com:/home/jimw/my/mysql-5.0-7955

into  mysql.com:/home/jimw/my/mysql-5.1-clean


sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/bdb.result:
  Resolve conflict
mysql-test/t/bdb.test:
  Resolve conflict
sql/share/errmsg.txt:
  Resolve conflict
parents 1b587ced d68354d5
...@@ -1963,3 +1963,22 @@ commit; ...@@ -1963,3 +1963,22 @@ commit;
alter table t1 add primary key(a); alter table t1 add primary key(a);
drop table t1; drop table t1;
End of 5.0 tests End of 5.0 tests
create table t1 (a int) engine=bdb;
set session transaction isolation level repeatable read;
set transaction isolation level serializable;
begin;
select @@tx_isolation;
@@tx_isolation
SERIALIZABLE
insert into t1 values (1);
set transaction isolation level read committed;
ERROR 25001: Transaction isolation level can't be changed while a transaction is in progress
rollback;
begin;
select @@tx_isolation;
@@tx_isolation
REPEATABLE-READ
insert into t1 values (1);
rollback;
drop table t1;
End of 5.1 tests
...@@ -1046,3 +1046,24 @@ alter table t1 add primary key(a); ...@@ -1046,3 +1046,24 @@ alter table t1 add primary key(a);
drop table t1; drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests
#
# Bug #7955: SET TRANSACTION ISIOLATION LEVEL lives longer than next
# transaciton
#
create table t1 (a int) engine=bdb;
set session transaction isolation level repeatable read;
set transaction isolation level serializable;
begin;
select @@tx_isolation;
insert into t1 values (1);
--error ER_CANT_CHANGE_TX_ISOLATION
set transaction isolation level read committed;
rollback;
begin;
select @@tx_isolation;
insert into t1 values (1);
rollback;
drop table t1;
--echo End of 5.1 tests
...@@ -142,6 +142,7 @@ static bool set_log_update(THD *thd, set_var *var); ...@@ -142,6 +142,7 @@ static bool set_log_update(THD *thd, set_var *var);
static int check_pseudo_thread_id(THD *thd, set_var *var); static int check_pseudo_thread_id(THD *thd, set_var *var);
static bool set_log_bin(THD *thd, set_var *var); static bool set_log_bin(THD *thd, set_var *var);
static void fix_low_priority_updates(THD *thd, enum_var_type type); static void fix_low_priority_updates(THD *thd, enum_var_type type);
static int check_tx_isolation(THD *thd, set_var *var);
static void fix_tx_isolation(THD *thd, enum_var_type type); static void fix_tx_isolation(THD *thd, enum_var_type type);
static int check_completion_type(THD *thd, set_var *var); static int check_completion_type(THD *thd, set_var *var);
static void fix_completion_type(THD *thd, enum_var_type type); static void fix_completion_type(THD *thd, enum_var_type type);
...@@ -449,7 +450,8 @@ sys_var_long_ptr sys_thread_cache_size("thread_cache_size", ...@@ -449,7 +450,8 @@ sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
sys_var_thd_enum sys_tx_isolation("tx_isolation", sys_var_thd_enum sys_tx_isolation("tx_isolation",
&SV::tx_isolation, &SV::tx_isolation,
&tx_isolation_typelib, &tx_isolation_typelib,
fix_tx_isolation); fix_tx_isolation,
check_tx_isolation);
sys_var_thd_ulong sys_tmp_table_size("tmp_table_size", sys_var_thd_ulong sys_tmp_table_size("tmp_table_size",
&SV::tmp_table_size); &SV::tmp_table_size);
sys_var_bool_ptr sys_timed_mutexes("timed_mutexes", sys_var_bool_ptr sys_timed_mutexes("timed_mutexes",
...@@ -1126,11 +1128,24 @@ static void fix_max_join_size(THD *thd, enum_var_type type) ...@@ -1126,11 +1128,24 @@ static void fix_max_join_size(THD *thd, enum_var_type type)
} }
/*
Can't change the 'next' tx_isolation while we are already in
a transaction
*/
static int check_tx_isolation(THD *thd, set_var *var)
{
if (var->type == OPT_DEFAULT && (thd->server_status & SERVER_STATUS_IN_TRANS))
{
my_error(ER_CANT_CHANGE_TX_ISOLATION, MYF(0));
return 1;
}
return 0;
}
/* /*
If one doesn't use the SESSION modifier, the isolation level If one doesn't use the SESSION modifier, the isolation level
is only active for the next command is only active for the next command
*/ */
static void fix_tx_isolation(THD *thd, enum_var_type type) static void fix_tx_isolation(THD *thd, enum_var_type type)
{ {
if (type == OPT_SESSION) if (type == OPT_SESSION)
......
...@@ -334,19 +334,31 @@ class sys_var_thd_enum :public sys_var_thd ...@@ -334,19 +334,31 @@ class sys_var_thd_enum :public sys_var_thd
protected: protected:
ulong SV::*offset; ulong SV::*offset;
TYPELIB *enum_names; TYPELIB *enum_names;
sys_check_func check_func;
public: public:
sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg, sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib) TYPELIB *typelib)
:sys_var_thd(name_arg), offset(offset_arg), enum_names(typelib) :sys_var_thd(name_arg), offset(offset_arg), enum_names(typelib),
check_func(0)
{} {}
sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg, sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib, TYPELIB *typelib,
sys_after_update_func func) sys_after_update_func func)
:sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib) :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)
{} {}
bool check(THD *thd, set_var *var) bool check(THD *thd, set_var *var)
{ {
return check_enum(thd, var, enum_names); int ret= 0;
if (check_func)
ret= (*check_func)(thd, var);
return ret ? ret : check_enum(thd, var, enum_names);
} }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
......
...@@ -5808,3 +5808,5 @@ ER_TABLE_NEEDS_UPGRADE ...@@ -5808,3 +5808,5 @@ ER_TABLE_NEEDS_UPGRADE
eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!" eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!"
ER_ILLEGAL_HA_CREATE_OPTION ER_ILLEGAL_HA_CREATE_OPTION
eng "Table storage engine '%-.64s' does not support the create option '%.64s'" eng "Table storage engine '%-.64s' does not support the create option '%.64s'"
ER_CANT_CHANGE_TX_ISOLATION 25001
eng "Transaction isolation level can't be changed while a transaction is in progress"
...@@ -9785,8 +9785,7 @@ sys_option_value: ...@@ -9785,8 +9785,7 @@ sys_option_value:
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
{ {
LEX *lex=Lex; LEX *lex=Lex;
if ($1) lex->option_type= $1;
lex->option_type= $1;
lex->var_list.push_back(new set_var(lex->option_type, lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("tx_isolation"), find_sys_var("tx_isolation"),
&null_lex_str, &null_lex_str,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment