Commit bdf18f43 authored by unknown's avatar unknown
Browse files

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
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1963,3 +1963,22 @@ commit;
alter table t1 add primary key(a);
drop table t1;
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
+21 −0
Original line number Diff line number Diff line
@@ -1046,3 +1046,24 @@ alter table t1 add primary key(a);
drop table t1;

--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
+17 −2
Original line number Diff line number Diff line
@@ -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 bool set_log_bin(THD *thd, set_var *var);
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 int check_completion_type(THD *thd, set_var *var);
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",
sys_var_thd_enum	sys_tx_isolation("tx_isolation",
					 &SV::tx_isolation,
					 &tx_isolation_typelib,
					 fix_tx_isolation);
					 fix_tx_isolation,
					 check_tx_isolation);
sys_var_thd_ulong	sys_tmp_table_size("tmp_table_size",
					   &SV::tmp_table_size);
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)
}


/*
  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
  is only active for the next command
*/

static void fix_tx_isolation(THD *thd, enum_var_type type)
{
  if (type == OPT_SESSION)
+15 −3
Original line number Diff line number Diff line
@@ -334,19 +334,31 @@ class sys_var_thd_enum :public sys_var_thd
protected:
  ulong SV::*offset;
  TYPELIB *enum_names;
  sys_check_func check_func;
public:
  sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
		   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,
		   TYPELIB *typelib,
		   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)
  {
    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);
  void set_default(THD *thd, enum_var_type type);
+2 −0
Original line number Diff line number Diff line
@@ -5808,3 +5808,5 @@ ER_TABLE_NEEDS_UPGRADE
         eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!"
ER_ILLEGAL_HA_CREATE_OPTION
        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"
Loading