Below is the list of changes that have just been committed into a local
5.0-hp repository of vtkachenko. When vtkachenko does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1935 05/08/08 22:33:13 vtkachenko@stripped +16 -0
Merge melody.mysql.com:/users/vtkachenko/bk/HP/mysql-5.0.11-release
into melody.mysql.com:/users/vtkachenko/bk/HP/mysql-5.0-hp
sql/sql_show.cc
1.253 05/08/08 22:33:10 vtkachenko@stripped +0 -0
Auto merged
sql/sql_parse.cc
1.443 05/08/08 22:33:10 vtkachenko@stripped +0 -0
Auto merged
sql/set_var.cc
1.124 05/08/08 22:33:09 vtkachenko@stripped +0 -0
Auto merged
sql/mysqld.cc
1.469 05/08/08 22:33:09 vtkachenko@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.309 05/08/08 22:33:08 vtkachenko@stripped +0 -0
Auto merged
sql/ha_myisam.cc
1.157 05/08/08 22:33:08 vtkachenko@stripped +0 -0
Auto merged
sql/ha_innodb.h
1.101 05/08/08 22:33:08 vtkachenko@stripped +0 -0
Auto merged
sql/ha_innodb.cc
1.220 05/08/08 22:33:08 vtkachenko@stripped +0 -0
Auto merged
mysys/my_init.c
1.41 05/08/08 22:33:07 vtkachenko@stripped +0 -0
Auto merged
libmysql/Makefile.shared
1.66 05/08/08 22:33:07 vtkachenko@stripped +0 -0
Auto merged
innobase/sync/sync0sync.c
1.37 05/08/08 22:33:07 vtkachenko@stripped +0 -0
Auto merged
innobase/srv/srv0start.c
1.84 05/08/08 22:33:07 vtkachenko@stripped +0 -0
Auto merged
innobase/srv/srv0srv.c
1.94 05/08/08 22:33:07 vtkachenko@stripped +0 -0
Auto merged
innobase/buf/buf0buf.c
1.51 05/08/08 22:33:07 vtkachenko@stripped +0 -0
Auto merged
include/my_sys.h
1.163 05/08/08 22:33:06 vtkachenko@stripped +0 -0
Auto merged
configure.in
1.321 05/08/08 22:33:06 vtkachenko@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: vtkachenko
# Host: melody.mysql.com
# Root: /users/vtkachenko/bk/HP/mysql-5.0-hp/RESYNC
--- 1.320/configure.in 2005-07-22 17:49:12 +02:00
+++ 1.321/configure.in 2005-08-08 22:33:06 +02:00
@@ -6,7 +6,7 @@
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# Don't forget to also update the NDB lines below.
-AM_INIT_AUTOMAKE(mysql, 5.0.10-beta)
+AM_INIT_AUTOMAKE(mysql, 5.0.11-beta)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@@ -17,7 +17,7 @@
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
-NDB_VERSION_BUILD=10
+NDB_VERSION_BUILD=11
NDB_VERSION_STATUS="beta"
# Set all version vars based on $VERSION. How do we do this more elegant ?
--- 1.162/include/my_sys.h 2005-07-22 17:49:13 +02:00
+++ 1.163/include/my_sys.h 2005-08-08 22:33:06 +02:00
@@ -218,7 +218,7 @@
#endif /* #ifndef errno */
extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
extern char *home_dir; /* Home directory for user */
-extern char *my_progname; /* program-name (printed in errors) */
+extern const char *my_progname; /* program-name (printed in errors) */
extern char NEAR curr_dir[]; /* Current directory for user */
extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
--- 1.40/mysys/my_init.c 2005-05-12 20:12:09 +02:00
+++ 1.41/mysys/my_init.c 2005-08-08 22:33:07 +02:00
@@ -99,7 +99,7 @@
#endif
{
DBUG_ENTER("my_init");
- DBUG_PROCESS(my_progname ? my_progname : (char*) "unknown");
+ DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
if (!home_dir)
{ /* Don't initialize twice */
my_win_init();
--- 1.156/sql/ha_myisam.cc 2005-07-22 17:49:16 +02:00
+++ 1.157/sql/ha_myisam.cc 2005-08-08 22:33:08 +02:00
@@ -50,16 +50,19 @@
"MyISAM",
0, /* slot */
0, /* savepoint size. */
- 0, /* close_connection */
- 0, /* savepoint */
- 0, /* rollback to savepoint */
- 0, /* release savepoint */
- 0, /* commit */
- 0, /* rollback */
- 0, /* prepare */
- 0, /* recover */
- 0, /* commit_by_xid */
- 0, /* rollback_by_xid */
+ NULL, /* close_connection */
+ NULL, /* savepoint */
+ NULL, /* rollback to savepoint */
+ NULL, /* release savepoint */
+ NULL, /* commit */
+ NULL, /* rollback */
+ NULL, /* prepare */
+ NULL, /* recover */
+ NULL, /* commit_by_xid */
+ NULL, /* rollback_by_xid */
+ NULL, /* create_cursor_read_view */
+ NULL, /* set_cursor_read_view */
+ NULL, /* close_cursor_read_view */
/*
MyISAM doesn't support transactions and doesn't have
transaction-dependent context: cursors can survive a commit.
--- 1.308/sql/mysql_priv.h 2005-07-22 17:49:17 +02:00
+++ 1.309/sql/mysql_priv.h 2005-08-08 22:33:08 +02:00
@@ -526,6 +526,7 @@
{
unsigned int client_long_flag:1;
unsigned int client_protocol_41:1;
+ unsigned int more_results_exists:1;
uint character_set_client_num;
uint character_set_results_num;
uint collation_connection_num;
@@ -824,8 +825,6 @@
#ifdef TIMED_MUTEX
bool timed_mutex_show_status(THD *thd, bool flush);
#endif
-
-
/* information schema */
extern LEX_STRING information_schema_name;
LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
@@ -953,8 +952,16 @@
const char *table_name);
void remove_db_from_cache(const char *db);
void flush_tables();
+bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
+
+/* bits for last argument to remove_table_from_cache() */
+#define RTFC_NO_FLAG 0x0000
+#define RTFC_OWNED_BY_THD_FLAG 0x0001
+#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
+#define RTFC_CHECK_KILLED_FLAG 0x0004
bool remove_table_from_cache(THD *thd, const char *db, const char *table,
- bool return_if_owned_by_thd);
+ uint flags);
+
bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
void copy_field_from_tmp_record(Field *field,int offset);
bool fill_record(THD *thd, Field **field, List<Item> &values,
@@ -1185,6 +1192,7 @@
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
extern const char* any_db;
extern struct my_option my_long_options[];
+extern const LEX_STRING view_type;
/* optional things, have_* variables */
@@ -1217,7 +1225,7 @@
void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
void mysql_lock_abort(THD *thd, TABLE *table);
-void mysql_lock_abort_for_thread(THD *thd, TABLE *table);
+bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
bool lock_global_read_lock(THD *thd);
void unlock_global_read_lock(THD *thd);
@@ -1243,10 +1251,13 @@
void unireg_init(ulong options);
void unireg_end(void);
bool mysql_create_frm(THD *thd, my_string file_name,
+ const char *db, const char *table,
HA_CREATE_INFO *create_info,
List<create_field> &create_field,
uint key_count,KEY *key_info,handler *db_type);
-int rea_create_table(THD *thd, my_string file_name,HA_CREATE_INFO *create_info,
+int rea_create_table(THD *thd, my_string file_name,
+ const char *db, const char *table,
+ HA_CREATE_INFO *create_info,
List<create_field> &create_field,
uint key_count,KEY *key_info);
int format_number(uint inputflag,uint max_length,my_string pos,uint length,
@@ -1264,7 +1275,7 @@
ulong convert_month_to_period(ulong month);
void get_date_from_daynr(long daynr,uint *year, uint *month,
uint *day);
-my_time_t TIME_to_timestamp(THD *thd, const TIME *t, bool *not_exist);
+my_time_t TIME_to_timestamp(THD *thd, const TIME *t, my_bool *not_exist);
bool str_to_time_with_warn(const char *str,uint length,TIME *l_time);
timestamp_type str_to_datetime_with_warn(const char *str, uint length,
TIME *l_time, uint flags);
@@ -1313,7 +1324,8 @@
const char *newname);
ulong next_io_size(ulong pos);
void append_unescaped(String *res, const char *pos, uint length);
-int create_frm(THD *thd, char *name,uint reclength,uchar *fileinfo,
+int create_frm(THD *thd, char *name, const char *db, const char *table,
+ uint reclength,uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys);
void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
int rename_file_ext(const char * from,const char * to,const char * ext);
--- 1.468/sql/mysqld.cc 2005-07-22 17:49:18 +02:00
+++ 1.469/sql/mysqld.cc 2005-08-08 22:33:09 +02:00
@@ -220,21 +220,58 @@
/* Constants */
const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"};
-static const char *sql_mode_names[] =
+static const char *sql_mode_names[]=
{
"REAL_AS_FLOAT", "PIPES_AS_CONCAT", "ANSI_QUOTES", "IGNORE_SPACE",
"?", "ONLY_FULL_GROUP_BY", "NO_UNSIGNED_SUBTRACTION",
"NO_DIR_IN_CREATE",
"POSTGRESQL", "ORACLE", "MSSQL", "DB2", "MAXDB", "NO_KEY_OPTIONS",
"NO_TABLE_OPTIONS", "NO_FIELD_OPTIONS", "MYSQL323", "MYSQL40", "ANSI",
- "NO_AUTO_VALUE_ON_ZERO", "NO_BACKSLASH_ESCAPES", "STRICT_TRANS_TABLES", "STRICT_ALL_TABLES",
- "NO_ZERO_IN_DATE", "NO_ZERO_DATE", "ALLOW_INVALID_DATES", "ERROR_FOR_DIVISION_BY_ZERO",
+ "NO_AUTO_VALUE_ON_ZERO", "NO_BACKSLASH_ESCAPES", "STRICT_TRANS_TABLES",
+ "STRICT_ALL_TABLES",
+ "NO_ZERO_IN_DATE", "NO_ZERO_DATE", "ALLOW_INVALID_DATES",
+ "ERROR_FOR_DIVISION_BY_ZERO",
"TRADITIONAL", "NO_AUTO_CREATE_USER", "HIGH_NOT_PRECEDENCE",
"NO_ENGINE_SUBSTITUTION",
NullS
};
+static const unsigned int sql_mode_names_len[]=
+{
+ /*REAL_AS_FLOAT*/ 13,
+ /*PIPES_AS_CONCAT*/ 15,
+ /*ANSI_QUOTES*/ 11,
+ /*IGNORE_SPACE*/ 12,
+ /*?*/ 1,
+ /*ONLY_FULL_GROUP_BY*/ 18,
+ /*NO_UNSIGNED_SUBTRACTION*/ 23,
+ /*NO_DIR_IN_CREATE*/ 16,
+ /*POSTGRESQL*/ 10,
+ /*ORACLE*/ 6,
+ /*MSSQL*/ 5,
+ /*DB2*/ 3,
+ /*MAXDB*/ 5,
+ /*NO_KEY_OPTIONS*/ 14,
+ /*NO_TABLE_OPTIONS*/ 16,
+ /*NO_FIELD_OPTIONS*/ 16,
+ /*MYSQL323*/ 8,
+ /*MYSQL40*/ 7,
+ /*ANSI*/ 4,
+ /*NO_AUTO_VALUE_ON_ZERO*/ 21,
+ /*NO_BACKSLASH_ESCAPES*/ 20,
+ /*STRICT_TRANS_TABLES*/ 19,
+ /*STRICT_ALL_TABLES*/ 17,
+ /*NO_ZERO_IN_DATE*/ 15,
+ /*NO_ZERO_DATE*/ 12,
+ /*ALLOW_INVALID_DATES*/ 19,
+ /*ERROR_FOR_DIVISION_BY_ZERO*/ 26,
+ /*TRADITIONAL*/ 11,
+ /*NO_AUTO_CREATE_USER*/ 19,
+ /*HIGH_NOT_PRECEDENCE*/ 19,
+ /*NO_ENGINE_SUBSTITUTION*/ 22
+};
TYPELIB sql_mode_typelib= { array_elements(sql_mode_names)-1,"",
- sql_mode_names, NULL };
+ sql_mode_names,
+ (unsigned int *)sql_mode_names_len };
static const char *tc_heuristic_recover_names[]=
{
"COMMIT", "ROLLBACK", NullS
@@ -2320,6 +2357,19 @@
DBUG_RETURN(0);
}
+
+static void *my_str_malloc_mysqld(size_t size)
+{
+ return my_malloc(size, MYF(MY_FAE));
+}
+
+
+static void my_str_free_mysqld(void *ptr)
+{
+ my_free((gptr)ptr, MYF(MY_FAE));
+}
+
+
#ifdef __WIN__
struct utsname
@@ -2601,6 +2651,50 @@
if (my_dbopt_init())
return 1;
+ /*
+ Ensure that lower_case_table_names is set on system where we have case
+ insensitive names. If this is not done the users MyISAM tables will
+ get corrupted if accesses with names of different case.
+ */
+ DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names));
+ if (!lower_case_table_names &&
+ (lower_case_file_system=
+ (test_if_case_insensitive(mysql_real_data_home) == 1)))
+ {
+ if (lower_case_table_names_used)
+ {
+ if (global_system_variables.log_warnings)
+ sql_print_warning("\
+You have forced lower_case_table_names to 0 through a command-line \
+option, even though your file system '%s' is case insensitive. This means \
+that you can corrupt a MyISAM table by accessing it with different cases. \
+You should consider changing lower_case_table_names to 1 or 2",
+ mysql_real_data_home);
+ }
+ else
+ {
+ if (global_system_variables.log_warnings)
+ sql_print_warning("Setting lower_case_table_names=2 because file system for %s is case insensitive", mysql_real_data_home);
+ lower_case_table_names= 2;
+ }
+ }
+ else if (lower_case_table_names == 2 &&
+ !(lower_case_file_system=
+ (test_if_case_insensitive(mysql_real_data_home) == 1)))
+ {
+ if (global_system_variables.log_warnings)
+ sql_print_warning("lower_case_table_names was set to 2, even though your "
+ "the file system '%s' is case sensitive. Now setting "
+ "lower_case_table_names to 0 to avoid future problems.",
+ mysql_real_data_home);
+ lower_case_table_names= 0;
+ }
+
+ /* Reset table_alias_charset, now that lower_case_table_names is set. */
+ table_alias_charset= (lower_case_table_names ?
+ files_charset_info :
+ &my_charset_bin);
+
return 0;
}
@@ -3078,50 +3172,6 @@
(void) thr_setconcurrency(concurrency); // 10 by default
- /*
- Ensure that lower_case_table_names is set on system where we have case
- insensitive names. If this is not done the users MyISAM tables will
- get corrupted if accesses with names of different case.
- */
- DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names));
- if (!lower_case_table_names &&
- (lower_case_file_system=
- (test_if_case_insensitive(mysql_real_data_home) == 1)))
- {
- if (lower_case_table_names_used)
- {
- if (global_system_variables.log_warnings)
- sql_print_warning("\
-You have forced lower_case_table_names to 0 through a command-line \
-option, even though your file system '%s' is case insensitive. This means \
-that you can corrupt a MyISAM table by accessing it with different cases. \
-You should consider changing lower_case_table_names to 1 or 2",
- mysql_real_data_home);
- }
- else
- {
- if (global_system_variables.log_warnings)
- sql_print_warning("Setting lower_case_table_names=2 because file system for %s is case insensitive", mysql_real_data_home);
- lower_case_table_names= 2;
- }
- }
- else if (lower_case_table_names == 2 &&
- !(lower_case_file_system=
- (test_if_case_insensitive(mysql_real_data_home) == 1)))
- {
- if (global_system_variables.log_warnings)
- sql_print_warning("lower_case_table_names was set to 2, even though your "
- "the file system '%s' is case sensitive. Now setting "
- "lower_case_table_names to 0 to avoid future problems.",
- mysql_real_data_home);
- lower_case_table_names= 0;
- }
-
- /* Reset table_alias_charset, now that lower_case_table_names is set. */
- table_alias_charset= (lower_case_table_names ?
- files_charset_info :
- &my_charset_bin);
-
select_thread=pthread_self();
select_thread_in_use=1;
init_ssl();
@@ -3177,10 +3227,16 @@
#endif
/*
+ Initialize my_str_malloc() and my_str_free()
+ */
+ my_str_malloc= &my_str_malloc_mysqld;
+ my_str_free= &my_str_free_mysqld;
+
+ /*
init signals & alarm
After this we can't quit by a simple unireg_abort
*/
- error_handler_hook = my_message_sql;
+ error_handler_hook= my_message_sql;
start_signal_handler(); // Creates pidfile
if (acl_init((THD *)0, opt_noacl) ||
my_tz_init((THD *)0, default_tz_name, opt_bootstrap))
--- 1.442/sql/sql_parse.cc 2005-07-22 17:49:20 +02:00
+++ 1.443/sql/sql_parse.cc 2005-08-08 22:33:10 +02:00
@@ -27,6 +27,7 @@
#include "sp_head.h"
#include "sp.h"
+#include "sp_cache.h"
#ifdef HAVE_OPENSSL
/*
@@ -124,7 +125,7 @@
{
int error=0;
DBUG_ENTER("end_active_trans");
- if (unlikely(thd->transaction.in_sub_stmt))
+ if (unlikely(thd->in_sub_stmt))
{
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(1);
@@ -147,11 +148,7 @@
static bool begin_trans(THD *thd)
{
int error=0;
- /*
- QQ: May be it is better to simply prohibit COMMIT and ROLLBACK in
- stored routines as SQL2003 suggests?
- */
- if (unlikely(thd->transaction.in_sub_stmt))
+ if (unlikely(thd->in_sub_stmt))
{
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
return 1;
@@ -193,7 +190,7 @@
const char *host,
USER_RESOURCES *mqh)
{
- int return_val=0;
+ int return_val= 0;
uint temp_len, user_len;
char temp_user[USERNAME_LENGTH+HOSTNAME_LENGTH+2];
struct user_conn *uc;
@@ -201,7 +198,7 @@
DBUG_ASSERT(user != 0);
DBUG_ASSERT(host != 0);
- user_len=strlen(user);
+ user_len= strlen(user);
temp_len= (strmov(strmov(temp_user, user)+1, host) - temp_user)+1;
(void) pthread_mutex_lock(&LOCK_user_conn);
if (!(uc = (struct user_conn *) hash_search(&hash_user_connections,
@@ -213,21 +210,21 @@
MYF(MY_WME)))))
{
net_send_error(thd, 0, NullS); // Out of memory
- return_val=1;
+ return_val= 1;
goto end;
}
uc->user=(char*) (uc+1);
memcpy(uc->user,temp_user,temp_len+1);
uc->host= uc->user + user_len + 1;
- uc->len = temp_len;
+ uc->len= temp_len;
uc->connections= uc->questions= uc->updates= uc->conn_per_hour= 0;
- uc->user_resources=*mqh;
- uc->intime=thd->thr_create_time;
+ uc->user_resources= *mqh;
+ uc->intime= thd->thr_create_time;
if (my_hash_insert(&hash_user_connections, (byte*) uc))
{
my_free((char*) uc,0);
net_send_error(thd, 0, NullS); // Out of memory
- return_val=1;
+ return_val= 1;
goto end;
}
}
@@ -1340,11 +1337,7 @@
int res= 0;
DBUG_ENTER("end_trans");
- /*
- QQ: May be it is better to simply prohibit COMMIT and ROLLBACK in
- stored routines as SQL2003 suggests?
- */
- if (unlikely(thd->transaction.in_sub_stmt))
+ if (unlikely(thd->in_sub_stmt))
{
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(1);
@@ -3672,6 +3665,7 @@
if (!(res = mysql_create_function(thd, &lex->udf)))
send_ok(thd);
#else
+ net_printf_error(thd, ER_CANT_OPEN_LIBRARY, lex->udf.dl, 0, "feature disabled");
res= TRUE;
#endif
break;
@@ -4133,6 +4127,12 @@
delete lex->sphead;
lex->sphead= 0;
goto error;
+ case SP_BODY_TOO_LONG:
+ my_error(ER_TOO_LONG_BODY, MYF(0), name);
+ lex->unit.cleanup();
+ delete lex->sphead;
+ lex->sphead= 0;
+ goto error;
default:
my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name);
lex->unit.cleanup();
@@ -4155,9 +4155,8 @@
goto error;
/*
- By this moment all needed SPs should be in cache so no need
- to look into DB. Moreover we may be unable to do it becuase
- we may don't have read lock on mysql.proc
+ By this moment all needed SPs should be in cache so no need to look
+ into DB.
*/
if (!(sp= sp_find_procedure(thd, lex->spname, TRUE)))
{
@@ -4222,7 +4221,7 @@
select_limit= thd->variables.select_limit;
thd->variables.select_limit= HA_POS_ERROR;
- thd->row_count_func= 0;
+ thd->row_count_func= 0;
tmp_disable_binlog(thd); /* don't binlog the substatements */
res= sp->execute_procedure(thd, &lex->value_list);
reenable_binlog(thd);
@@ -5114,8 +5113,9 @@
if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >=
(long) (thread_stack - margin))
{
- sprintf(errbuff[0],ER(ER_STACK_OVERRUN),stack_used,thread_stack);
- my_message(ER_STACK_OVERRUN,errbuff[0],MYF(0));
+ sprintf(errbuff[0],ER(ER_STACK_OVERRUN_NEED_MORE),
+ stack_used,thread_stack,margin);
+ my_message(ER_STACK_OVERRUN_NEED_MORE,errbuff[0],MYF(0));
thd->fatal_error();
return 1;
}
@@ -5330,6 +5330,8 @@
THD *thd;
LEX *lex;
LEX_STRING tmp, null_lex_string;
+ Item *var;
+ char buff[MAX_SYS_VAR_LENGTH*2+4+8], *end;
DBUG_ENTER("create_select_for_variable");
thd= current_thd;
@@ -5339,8 +5341,14 @@
tmp.str= (char*) var_name;
tmp.length=strlen(var_name);
bzero((char*) &null_lex_string.str, sizeof(null_lex_string));
- add_item_to_list(thd, get_system_var(thd, OPT_SESSION, tmp,
- null_lex_string));
+ /*
+ We set the name of Item to @@session.var_name because that then is used
+ as the column name in the output.
+ */
+ var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string);
+ end= strxmov(buff, "@@session.", var_name, NullS);
+ var->set_name(buff, end-buff, system_charset_info);
+ add_item_to_list(thd, var);
DBUG_VOID_RETURN;
}
--- 1.252/sql/sql_show.cc 2005-07-22 17:49:20 +02:00
+++ 1.253/sql/sql_show.cc 2005-08-08 22:33:10 +02:00
@@ -3060,9 +3060,13 @@
const char *tname, LEX_STRING *trigger_name,
enum trg_event_type event,
enum trg_action_time_type timing,
- LEX_STRING *trigger_stmt)
+ LEX_STRING *trigger_stmt,
+ ulong sql_mode)
{
CHARSET_INFO *cs= system_charset_info;
+ byte *sql_mode_str;
+ ulong sql_mode_len;
+
restore_record(table, s->default_values);
table->field[1]->store(db, strlen(db), cs);
table->field[2]->store(trigger_name->str, trigger_name->length, cs);
@@ -3076,6 +3080,12 @@
trg_action_time_type_names[timing].length, cs);
table->field[14]->store("OLD", 3, cs);
table->field[15]->store("NEW", 3, cs);
+
+ sql_mode_str=
+ sys_var_thd_sql_mode::symbolic_mode_representation(thd,
+ sql_mode,
+ &sql_mode_len);
+ table->field[17]->store((const char*)sql_mode_str, sql_mode_len, cs);
return schema_table_store_record(thd, table);
}
@@ -3108,13 +3118,16 @@
{
LEX_STRING trigger_name;
LEX_STRING trigger_stmt;
+ ulong sql_mode;
if (triggers->get_trigger_info(thd, (enum trg_event_type) event,
(enum trg_action_time_type)timing,
- &trigger_name, &trigger_stmt))
+ &trigger_name, &trigger_stmt,
+ &sql_mode))
continue;
if (store_trigger(thd, table, base_name, file_name, &trigger_name,
(enum trg_event_type) event,
- (enum trg_action_time_type) timing, &trigger_stmt))
+ (enum trg_action_time_type) timing, &trigger_stmt,
+ sql_mode))
DBUG_RETURN(1);
}
}
@@ -3620,9 +3633,8 @@
if (table_list->schema_table_reformed) // show command
{
SELECT_LEX *sel= lex->current_select;
- uint i= 0;
Item *item;
- Field_translator *transl;
+ Field_translator *transl, *org_transl;
if (table_list->field_translation)
{
@@ -3643,16 +3655,17 @@
{
DBUG_RETURN(1);
}
- while ((item= it++))
+ for (org_transl= transl; (item= it++); transl++)
{
- char *name= item->name;
- transl[i].item= item;
- if (!item->fixed && item->fix_fields(thd, &transl[i].item))
+ transl->item= item;
+ transl->name= item->name;
+ if (!item->fixed && item->fix_fields(thd, &transl->item))
+ {
DBUG_RETURN(1);
- transl[i++].name= name;
+ }
}
- table_list->field_translation= transl;
- table_list->field_translation_end= transl + sel->item_list.elements;
+ table_list->field_translation= org_transl;
+ table_list->field_translation_end= transl;
}
DBUG_RETURN(0);
@@ -4026,6 +4039,7 @@
{"ACTION_REFERENCE_OLD_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0},
{"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0},
{"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Created"},
+ {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, "sql_mode"},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
@@ -4080,7 +4094,7 @@
fill_open_tables, make_old_format, 0, -1, -1, 1},
{"STATUS", variables_fields_info, create_schema_table, fill_status,
make_old_format, 0, -1, -1, 1},
- {"TRIGGERS", triggers_fields_info, create_schema_table,
+ {"TRIGGERS", triggers_fields_info, create_schema_table,
get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0},
{"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
make_old_format, 0, -1, -1, 1},
--- 1.50/innobase/buf/buf0buf.c 2005-06-23 11:12:55 +02:00
+++ 1.51/innobase/buf/buf0buf.c 2005-08-08 22:33:07 +02:00
@@ -1776,6 +1776,15 @@
buf_flush_free_margin();
frame = block->frame;
+
+ /* Reset to zero the file flush lsn field in the page; if the first
+ page of an ibdata file is 'created' in this function into the buffer
+ pool then we lose the original contents of the file flush lsn stamp.
+ Then InnoDB could in a crash recovery print a big, false, corruption
+ warning if the stamp contains an lsn bigger than the ib_logfile lsn. */
+
+ memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
+
#ifdef UNIV_DEBUG
buf_dbg_counter++;
--- 1.93/innobase/srv/srv0srv.c 2005-07-12 19:38:02 +02:00
+++ 1.94/innobase/srv/srv0srv.c 2005-08-08 22:33:07 +02:00
@@ -1727,6 +1727,10 @@
fprintf(file, "%ld queries inside InnoDB, %lu queries in queue\n",
(long) srv_conc_n_threads,
(ulong) srv_conc_n_waiting_threads);
+
+ fprintf(file, "%lu read views open inside InnoDB\n",
+ UT_LIST_GET_LEN(trx_sys->view_list));
+
n_reserved = fil_space_get_n_reserved_extents(0);
if (n_reserved > 0) {
fprintf(file,
--- 1.83/innobase/srv/srv0start.c 2005-06-23 11:12:58 +02:00
+++ 1.84/innobase/srv/srv0start.c 2005-08-08 22:33:07 +02:00
@@ -1833,6 +1833,16 @@
srv_free();
os_sync_free();
+ /* Check that all read views are closed except read view owned
+ by a purge. */
+
+ if (UT_LIST_GET_LEN(trx_sys->view_list) > 1) {
+ fprintf(stderr,
+"InnoDB: Error: all read views were not closed before shutdown:\n"
+"InnoDB: %lu read views open \n",
+ UT_LIST_GET_LEN(trx_sys->view_list) - 1);
+ }
+
/* 5. Free all allocated memory and the os_fast_mutex created in
ut0mem.c */
--- 1.36/innobase/sync/sync0sync.c 2005-06-23 11:12:58 +02:00
+++ 1.37/innobase/sync/sync0sync.c 2005-08-08 22:33:07 +02:00
@@ -141,6 +141,12 @@
/* Mutex protecting sync_thread_level_arrays */
mutex_t sync_thread_mutex;
+/* Global list of database mutexes (not OS mutexes) created. */
+ut_list_base_node_t mutex_list;
+
+/* Mutex protecting the mutex_list variable */
+mutex_t mutex_list_mutex;
+
/* Latching order checks start when this is set TRUE */
ibool sync_order_checks_on = FALSE;
--- 1.219/sql/ha_innodb.cc 2005-07-22 17:49:15 +02:00
+++ 1.220/sql/ha_innodb.cc 2005-08-08 22:33:08 +02:00
@@ -220,13 +220,10 @@
innobase_xa_recover, /* recover */
innobase_commit_by_xid, /* commit_by_xid */
innobase_rollback_by_xid, /* rollback_by_xid */
- /*
- For now when one opens a cursor, MySQL does not create an own
- InnoDB consistent read view for it, and uses the view of the
- currently active transaction. Therefore, cursors can not
- survive COMMIT or ROLLBACK statements, which free this view.
- */
- HTON_CLOSE_CURSORS_AT_COMMIT
+ innobase_create_cursor_view,
+ innobase_set_cursor_view,
+ innobase_close_cursor_view,
+ HTON_NO_FLAGS
};
/*********************************************************************
@@ -545,7 +542,7 @@
}
/*****************************************************************
-Relases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd().
+Releases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd().
NOTE that /mysql/innobase/lock/lock0lock.c must contain the prototype for this
function! */
extern "C"
@@ -1745,7 +1742,7 @@
/* Commits the mini-transaction */
mtr_commit(&mtr);
- /* Syncronous flush of the log buffer to disk */
+ /* Synchronous flush of the log buffer to disk */
log_buffer_flush_to_disk();
}
#endif
@@ -2177,15 +2174,34 @@
/*********************************************************************
Frees a possible InnoDB trx object associated with the current THD. */
-
-static int
+static
+int
innobase_close_connection(
/*======================*/
/* out: 0 or error number */
THD* thd) /* in: handle to the MySQL thread of the user
whose resources should be free'd */
{
- trx_free_for_mysql((trx_t*)thd->ha_data[innobase_hton.slot]);
+ trx_t* trx;
+
+ trx = (trx_t*)thd->ha_data[innobase_hton.slot];
+
+ ut_a(trx);
+
+ if (trx->conc_state != TRX_NOT_STARTED) {
+ ut_print_timestamp(stderr);
+
+ fprintf(stderr,
+" InnoDB: Warning: MySQL is closing a connection"
+"InnoDB: that has an active InnoDB transaction. We roll back that\n"
+"InnoDB: transaction. %lu row modifications to roll back.\n",
+ (ulong)trx->undo_no.low);
+ }
+
+ innobase_rollback_trx(trx);
+
+ trx_free_for_mysql(trx);
+
return(0);
}
@@ -2879,7 +2895,7 @@
/* All indexes on BLOB and TEXT are column prefix
indexes, and we may need to truncate the data to be
- stored in the kay value: */
+ stored in the key value: */
if (blob_len > key_part->length) {
blob_len = key_part->length;
@@ -5924,7 +5940,7 @@
innobase_release_stat_resources(trx);
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
- && trx->read_view) {
+ && trx->global_read_view) {
/* At low transaction isolation levels we let
each consistent read set its own snapshot */
@@ -6145,7 +6161,7 @@
}
} else {
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
- && trx->read_view) {
+ && trx->global_read_view) {
/* At low transaction isolation levels we let
each consistent read set its own snapshot */
@@ -7307,7 +7323,7 @@
innobase_rollback_by_xid(
/*=====================*/
/* out: 0 or error number */
- XID *xid) /* in: X/Open XA transaction idenfification */
+ XID *xid) /* in: X/Open XA transaction identification */
{
trx_t* trx;
@@ -7318,6 +7334,50 @@
} else {
return(XAER_NOTA);
}
+}
+
+/***********************************************************************
+Create a consistent view for a cursor based on current transaction
+which is created if the corresponding MySQL thread still lacks one.
+This consistent view is then used inside of MySQL when accessing records
+using a cursor. */
+
+void*
+innobase_create_cursor_view(void)
+/*=============================*/
+ /* out: Pointer to cursor view or NULL */
+{
+ return(read_cursor_view_create_for_mysql(
+ check_trx_exists(current_thd)));
+}
+
+/***********************************************************************
+Close the given consistent cursor view of a transaction and restore
+global read view to a transaction read view. Transaction is created if the
+corresponding MySQL thread still lacks one. */
+
+void
+innobase_close_cursor_view(
+/*=======================*/
+ void* curview)/* in: Consistent read view to be closed */
+{
+ read_cursor_view_close_for_mysql(check_trx_exists(current_thd),
+ (cursor_view_t*) curview);
+}
+
+/***********************************************************************
+Set the given consistent cursor view to a transaction which is created
+if the corresponding MySQL thread still lacks one. If the given
+consistent cursor view is NULL global read view of a transaction is
+restored to a transaction read view. */
+
+void
+innobase_set_cursor_view(
+/*=====================*/
+ void* curview)/* in: Consistent cursor view to be set */
+{
+ read_cursor_set_for_mysql(check_trx_exists(current_thd),
+ (cursor_view_t*) curview);
}
#endif /* HAVE_INNOBASE_DB */
--- 1.100/sql/ha_innodb.h 2005-07-22 17:49:16 +02:00
+++ 1.101/sql/ha_innodb.h 2005-08-08 22:33:08 +02:00
@@ -304,7 +304,7 @@
int innobase_rollback_by_xid(
/* out: 0 or error number */
- XID *xid); /* in : X/Open XA Transaction Idenfification */
+ XID *xid); /* in : X/Open XA Transaction Identification */
int innobase_xa_end(THD *thd);
@@ -312,3 +312,35 @@
int innobase_repl_report_sent_binlog(THD *thd, char *log_file_name,
my_off_t end_offset);
+
+/***********************************************************************
+Create a consistent view for a cursor based on current transaction
+which is created if the corresponding MySQL thread still lacks one.
+This consistent view is then used inside of MySQL when accessing records
+using a cursor. */
+
+void*
+innobase_create_cursor_view(void);
+/*=============================*/
+ /* out: Pointer to cursor view or NULL */
+
+/***********************************************************************
+Close the given consistent cursor view of a transaction and restore
+global read view to a transaction read view. Transaction is created if the
+corresponding MySQL thread still lacks one. */
+
+void
+innobase_close_cursor_view(
+/*=======================*/
+ void* curview); /* in: Consistent read view to be closed */
+
+/***********************************************************************
+Set the given consistent cursor view to a transaction which is created
+if the corresponding MySQL thread still lacks one. If the given
+consistent cursor view is NULL global read view of a transaction is
+restored to a transaction read view. */
+
+void
+innobase_set_cursor_view(
+/*=====================*/
+ void* curview); /* in: Consistent read view to be closed */
--- 1.123/sql/set_var.cc 2005-07-22 17:49:19 +02:00
+++ 1.124/sql/set_var.cc 2005-08-08 22:33:09 +02:00
@@ -1433,6 +1433,12 @@
if ((ulong) tmp > max_system_variables.*offset)
tmp= max_system_variables.*offset;
+#if SIZEOF_LONG == 4
+ /* Avoid overflows on 32 bit systems */
+ if (tmp > (ulonglong) ~(ulong) 0)
+ tmp= ((ulonglong) ~(ulong) 0);
+#endif
+
if (option_limits)
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
if (var->type == OPT_GLOBAL)
@@ -1686,7 +1692,7 @@
pthread_mutex_lock(&LOCK_global_system_variables);
value= *(uint*) value_ptr(thd, var_type, base);
pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_uint((int32) value);
+ return new Item_uint((ulonglong) value);
}
case SHOW_LONG:
{
@@ -1694,7 +1700,7 @@
pthread_mutex_lock(&LOCK_global_system_variables);
value= *(ulong*) value_ptr(thd, var_type, base);
pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_uint((int32) value);
+ return new Item_uint((ulonglong) value);
}
case SHOW_LONGLONG:
{
@@ -3203,27 +3209,50 @@
Functions to handle sql_mode
****************************************************************************/
-byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type,
- LEX_STRING *base)
+/*
+ Make string representation of mode
+
+ SYNOPSIS
+ thd in thread handler
+ val in sql_mode value
+ len out pointer on length of string
+
+ RETURN
+ pointer to string with sql_mode representation
+*/
+
+byte *sys_var_thd_sql_mode::symbolic_mode_representation(THD *thd, ulong val,
+ ulong *len)
{
- ulong val;
char buff[256];
String tmp(buff, sizeof(buff), &my_charset_latin1);
+ ulong length;
tmp.length(0);
- val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
- thd->variables.*offset);
for (uint i= 0; val; val>>= 1, i++)
{
if (val & 1)
{
- tmp.append(enum_names->type_names[i]);
+ tmp.append(sql_mode_typelib.type_names[i],
+ sql_mode_typelib.type_lengths[i]);
tmp.append(',');
}
}
- if (tmp.length())
- tmp.length(tmp.length() - 1);
- return (byte*) thd->strmake(tmp.ptr(), tmp.length());
+
+ if ((length= tmp.length()))
+ length--;
+ *len= length;
+ return (byte*) thd->strmake(tmp.ptr(), length);
+}
+
+
+byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type,
+ LEX_STRING *base)
+{
+ ulong val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
+ thd->variables.*offset);
+ ulong length_unused;
+ return symbolic_mode_representation(thd, val, &length_unused);
}
@@ -3234,6 +3263,7 @@
else
thd->variables.*offset= global_system_variables.*offset;
}
+
void fix_sql_mode_var(THD *thd, enum_var_type type)
{
--- 1.65/libmysql/Makefile.shared 2005-07-22 17:49:13 +02:00
+++ 1.66/libmysql/Makefile.shared 2005-08-08 22:33:07 +02:00
@@ -46,7 +46,7 @@
ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \
- ctype-uca.lo xml.lo my_strtoll10.lo
+ ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo
mystringsextra= strto.c
dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
| Thread |
|---|
| • bk commit into 5.0-hp tree (vtkachenko:1.1935) | Vadim Tkachenko | 8 Aug |