Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson 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@stripped, 2007-03-01 14:53:32+01:00, msvensson@stripped +25 -0
Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.1
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
MERGE: 1.2427.7.33
BitKeeper/etc/ignore@stripped, 2007-03-01 14:41:22+01:00, msvensson@stripped +0 -0
auto-union
MERGE: 1.276.1.2
client/mysqltest.c@stripped, 2007-03-01 14:53:30+01:00, msvensson@stripped +1 -0
Manual merge
MERGE: 1.267.1.2
extra/comp_err.c@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.26.1.2
include/my_pthread.h@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.106.1.2
mysql-test/mysql-test-run.pl@stripped, 2007-03-01 14:53:30+01:00, msvensson@stripped +0 -2
Manual merge
MERGE: 1.270.1.3
mysql-test/r/innodb.result@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.185.1.1
mysql-test/r/mix2_myisam.result@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.4.1.1
mysql-test/r/mysqltest.result@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.52.1.1
mysql-test/r/type_blob.result@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.56.1.1
mysql-test/t/disabled.def@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.231.1.1
mysql-test/t/mysqltest.test@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.64.1.1
sql/Makefile.am@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.173.1.1
sql/item.cc@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.241.1.2
sql/item_cmpfunc.cc@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.243.2.1
sql/item_cmpfunc.h@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.148.2.1
sql/item_strfunc.cc@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.309.1.3
sql/log.cc@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.255.1.2
sql/mysql_priv.h@stripped, 2007-03-01 14:41:26+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.480.1.6
sql/mysqld.cc@stripped, 2007-03-01 14:53:30+01:00, msvensson@stripped +0 -0
Manual merge
MERGE: 1.618.1.6
sql/set_var.cc@stripped, 2007-03-01 14:41:27+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.215.1.2
sql/sql_class.cc@stripped, 2007-03-01 14:41:27+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.312.1.3
sql/sql_class.h@stripped, 2007-03-01 14:41:27+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.339.1.1
sql/sql_parse.cc@stripped, 2007-03-01 14:41:27+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.626.1.3
sql/sql_select.cc@stripped, 2007-03-01 14:41:27+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.491.1.1
sql/tztime.cc@stripped, 2007-03-01 14:41:27+01:00, msvensson@stripped +0 -0
Auto merged
MERGE: 1.47.1.1
# 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: msvensson
# Host: pilot.blaudden
# Root: /home/msvensson/mysql/mysql-5.1-maint/RESYNC
--- 1.29/extra/comp_err.c 2007-02-23 18:10:14 +01:00
+++ 1.30/extra/comp_err.c 2007-03-01 14:41:26 +01:00
@@ -41,7 +41,9 @@ static char *NAMEFILE= (char*) "mysqld_e
static char *STATEFILE= (char*) "sql_state.h";
static char *TXTFILE= (char*) "../sql/share/errmsg.txt";
static char *DATADIRECTORY= (char*) "../sql/share/";
+#ifndef DBUG_OFF
static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";
+#endif
/* Header for errmsg.sys files */
uchar file_head[]= { 254, 254, 2, 1 };
@@ -404,6 +406,8 @@ static int parse_input_file(const char *
int rcount= 0;
DBUG_ENTER("parse_input_file");
+ *top_error= 0;
+ *top_lang= 0;
if (!(file= my_fopen(file_name, O_RDONLY | O_SHARE, MYF(MY_WME))))
DBUG_RETURN(0);
--- 1.107/include/my_pthread.h 2007-02-21 16:26:28 +01:00
+++ 1.108/include/my_pthread.h 2007-03-01 14:41:26 +01:00
@@ -18,7 +18,6 @@
#ifndef _my_pthread_h
#define _my_pthread_h
-#include <errno.h>
#ifndef ETIME
#define ETIME ETIMEDOUT /* For FreeBSD */
#endif
@@ -85,6 +84,7 @@ typedef struct {
typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self
+#define pthread_self() win_pthread_self
#define pthread_handler_t EXTERNC void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *);
@@ -140,7 +140,6 @@ void pthread_exit(void *a); /* was #def
#define ETIMEDOUT 145 /* Win32 doesn't have this */
#define getpid() GetCurrentThreadId()
-#define pthread_self() win_pthread_self
#define HAVE_LOCALTIME_R 1
#define _REENTRANT 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
@@ -648,12 +647,14 @@ extern pthread_mutexattr_t my_errorcheck
#define MY_MUTEX_INIT_ERRCHK NULL
#endif
+typedef ulong my_thread_id;
+
extern my_bool my_thread_global_init(void);
extern void my_thread_global_end(void);
extern my_bool my_thread_init(void);
extern void my_thread_end(void);
extern const char *my_thread_name(void);
-extern long my_thread_id(void);
+extern my_thread_id my_thread_dbug_id(void);
extern int pthread_no_free(void *);
extern int pthread_dummy(int);
@@ -680,7 +681,7 @@ struct st_my_thread_var
pthread_mutex_t * volatile current_mutex;
pthread_cond_t * volatile current_cond;
pthread_t pthread_self;
- long id;
+ my_thread_id id;
int cmp_length;
int volatile abort;
my_bool init;
--- 1.176/sql/Makefile.am 2007-02-19 12:25:24 +01:00
+++ 1.177/sql/Makefile.am 2007-03-01 14:41:26 +01:00
@@ -64,10 +64,11 @@ noinst_HEADERS = item.h item_func.h item
tztime.h my_decimal.h\
sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
parse_file.h sql_view.h sql_trigger.h \
- sql_array.h sql_cursor.h events.h \
+ sql_array.h sql_cursor.h events.h scheduler.h \
event_db_repository.h event_queue.h \
- sql_plugin.h authors.h sql_partition.h event_data_objects.h \
- partition_info.h partition_element.h event_scheduler.h \
+ sql_plugin.h authors.h \
+ event_data_objects.h event_scheduler.h \
+ sql_partition.h partition_info.h partition_element.h \
contributors.h sql_servers.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \
@@ -79,7 +80,8 @@ mysqld_SOURCES = sql_lex.cc sql_handler.
lock.cc my_lock.c \
sql_string.cc sql_manager.cc sql_map.cc \
mysqld.cc password.c hash_filo.cc hostname.cc \
- set_var.cc sql_parse.cc sql_yacc.yy \
+ sql_connect.cc scheduler.cc sql_parse.cc \
+ set_var.cc sql_yacc.yy \
sql_base.cc table.cc sql_select.cc sql_insert.cc \
sql_prepare.cc sql_error.cc sql_locale.cc \
sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
--- 1.246/sql/item.cc 2007-02-26 14:47:46 +01:00
+++ 1.247/sql/item.cc 2007-03-01 14:41:26 +01:00
@@ -3800,7 +3800,18 @@ bool Item_field::fix_fields(THD *thd, It
use the field from the Item_field in the select list and leave
the Item_field instance in place.
*/
- set_field((*((Item_field**)res))->field);
+
+ Field *field= (*((Item_field**)res))->field;
+
+ if (field == NULL)
+ {
+ /* The column to which we link isn't valid. */
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), (*res)->name,
+ current_thd->where);
+ return(1);
+ }
+
+ set_field(field);
return 0;
}
else
--- 1.311/sql/item_strfunc.cc 2007-02-28 11:21:51 +01:00
+++ 1.312/sql/item_strfunc.cc 2007-03-01 14:41:26 +01:00
@@ -25,9 +25,6 @@
#include "mysql_priv.h"
#include <m_ctype.h>
-#ifdef HAVE_OPENSSL
-#include <openssl/des.h>
-#endif /* HAVE_OPENSSL */
#include "md5.h"
#include "sha1.h"
#include "my_aes.h"
@@ -1926,7 +1923,7 @@ String *Item_func_format::val_str(String
int diff;
DBUG_ASSERT(fixed == 1);
- dec= args[1]->val_int();
+ dec= (int) args[1]->val_int();
if (args[1]->null_value)
{
null_value=1;
--- 1.257/sql/log.cc 2007-02-20 16:29:54 +01:00
+++ 1.258/sql/log.cc 2007-03-01 14:41:26 +01:00
@@ -267,7 +267,7 @@ bool Log_to_csv_event_handler::open_log_
table->table_name_length= 8;
break;
default:
- DBUG_ASSERT(0);
+ assert(0); // Impossible
}
/*
@@ -1161,7 +1161,7 @@ void LOGGER::deactivate_log_handler(THD
log_thd= table_log_handler->general_log_thd;
break;
default:
- DBUG_ASSERT(0);
+ assert(0); // Impossible
}
if (!(*tmp_opt))
@@ -1310,7 +1310,7 @@ void Log_to_csv_event_handler::
table= &slow_log;
break;
default:
- DBUG_ASSERT(0);
+ assert(0); // Impossible
}
/*
@@ -1742,7 +1742,7 @@ void setup_windows_event_source()
/* Register EventMessageFile */
dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ,
- (PBYTE) szPath, strlen(szPath)+1);
+ (PBYTE) szPath, (DWORD) (strlen(szPath) + 1));
/* Register supported event types */
dwTypes= (EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |
@@ -3887,7 +3887,7 @@ void MYSQL_BIN_LOG::rotate_and_purge(uin
#ifdef HAVE_REPLICATION
if (expire_logs_days)
{
- long purge_time= time(0) - expire_logs_days*24*60*60;
+ long purge_time= (long) (time(0) - expire_logs_days*24*60*60);
if (purge_time >= 0)
purge_logs_before_date(purge_time);
}
--- 1.484/sql/mysql_priv.h 2007-02-16 15:23:07 +01:00
+++ 1.485/sql/mysql_priv.h 2007-03-01 14:41:26 +01:00
@@ -38,6 +38,7 @@
#include <queues.h>
#include "sql_bitmap.h"
#include "sql_array.h"
+#include "scheduler.h"
/* TODO convert all these three maps to Bitmap classes */
typedef ulonglong table_map; /* Used for table bits in join */
@@ -282,7 +283,6 @@ MY_LOCALE *my_locale_by_number(uint numb
#define TEST_MIT_THREAD 4
#define TEST_BLOCKING 8
#define TEST_KEEP_TMP_TABLES 16
-#define TEST_NO_THREADS 32 /* For debugging under Linux */
#define TEST_READCHECK 64 /* Force use of readcheck */
#define TEST_NO_EXTRA 128
#define TEST_CORE_ON_SIGNAL 256 /* Give core if signal */
@@ -787,6 +787,23 @@ uint build_table_path(char *buff, size_t
void write_bin_log(THD *thd, bool clear_error,
char const *query, ulong query_length);
+/* sql_connect.cc */
+int check_user(THD *thd, enum enum_server_command command,
+ const char *passwd, uint passwd_len, const char *db,
+ bool check_count);
+pthread_handler_t handle_one_connection(void *arg);
+bool init_new_connection_handler_thread();
+void reset_mqh(LEX_USER *lu, bool get_them);
+bool check_mqh(THD *thd, uint check_command);
+void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
+int check_for_max_user_connections(THD *thd, USER_CONN *uc);
+void decrease_user_connections(USER_CONN *uc);
+void thd_init_client_charset(THD *thd, uint cs_number);
+bool setup_connection_thread_globals(THD *thd);
+bool login_connection(THD *thd);
+void prepare_new_connection_state(THD* thd);
+void end_connection(THD *thd);
+
bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
@@ -822,10 +839,7 @@ bool multi_delete_set_locks_and_link_aux
void init_max_user_conn(void);
void init_update_queries(void);
void free_max_user_conn(void);
-pthread_handler_t handle_one_connection(void *arg);
pthread_handler_t handle_bootstrap(void *arg);
-void end_thread(THD *thd,bool put_in_cache);
-void flush_thread_cache();
bool mysql_execute_command(THD *thd);
bool do_command(THD *thd);
bool dispatch_command(enum enum_server_command command, THD *thd,
@@ -901,6 +915,8 @@ int setup_order(THD *thd, Item **ref_poi
int setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
List<Item> &fields, List<Item> &all_fields, ORDER *order,
bool *hidden_group_fields);
+bool fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
+ Item **ref_pointer_array);
bool handle_select(THD *thd, LEX *lex, select_result *result,
ulong setup_tables_done_option);
@@ -1495,6 +1511,11 @@ File open_binlog(IO_CACHE *log, const ch
extern void MYSQLerror(const char*);
void refresh_status(THD *thd);
my_bool mysql_rm_tmp_tables(void);
+void handle_connection_in_main_thread(THD *thd);
+void create_thread_to_handle_connection(THD *thd);
+void unlink_thd(THD *thd);
+bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
+void flush_thread_cache();
/* item_func.cc */
extern bool check_reserved_words(LEX_STRING *name);
@@ -1578,7 +1599,7 @@ extern ulong max_prepared_stmt_count, pr
extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit;
extern ulong max_binlog_size, max_relay_log_size;
extern ulong opt_binlog_rows_event_max_size;
-extern ulong rpl_recovery_rank, thread_cache_size;
+extern ulong rpl_recovery_rank, thread_cache_size, thread_pool_size;
extern ulong back_log;
extern ulong specialflag, current_pid;
extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter;
@@ -1664,6 +1685,9 @@ extern TABLE *unused_tables;
extern const char* any_db;
extern struct my_option my_long_options[];
extern const LEX_STRING view_type;
+extern scheduler_functions thread_scheduler;
+extern TYPELIB thread_handling_typelib;
+extern uint8 uc_update_queries[SQLCOM_END+1];
extern uint sql_command_flags[];
extern TYPELIB log_output_typelib;
--- 1.622/sql/mysqld.cc 2007-02-23 12:27:14 +01:00
+++ 1.623/sql/mysqld.cc 2007-03-01 14:53:30 +01:00
@@ -436,6 +436,7 @@ extern enum ndb_distribution opt_ndb_dis
my_bool opt_readonly, use_temp_pool, relay_log_purge;
my_bool opt_sync_frm, opt_allow_suspicious_udfs;
my_bool opt_secure_auth= 0;
+char* opt_secure_file_priv= 0;
my_bool opt_log_slow_admin_statements= 0;
my_bool lower_case_file_system= 0;
my_bool opt_large_pages= 0;
@@ -1243,6 +1244,7 @@ void clean_up(bool print_message)
#endif
x_free(opt_bin_logname);
x_free(opt_relay_logname);
+ x_free(opt_secure_file_priv);
bitmap_free(&temp_pool);
free_max_user_conn();
#ifdef HAVE_REPLICATION
@@ -2168,7 +2170,10 @@ static void check_data_home(const char *
extern "C" sig_handler handle_segfault(int sig)
{
+ time_t curr_time;
+ struct tm tm;
THD *thd=current_thd;
+
/*
Strictly speaking, one needs a mutex here
but since we have got SIGSEGV already, things are a mess
@@ -2182,11 +2187,17 @@ extern "C" sig_handler handle_segfault(i
}
segfaulted = 1;
+
+ curr_time= time(NULL);
+ localtime_r(&curr_time, &tm);
+
fprintf(stderr,"\
-mysqld got signal %d;\n\
+%02d%02d%02d %2d:%02d:%02d - mysqld got signal %d;\n\
This could be because you hit a bug. It is also possible that this binary\n\
or one of the libraries it was linked against is corrupt, improperly built,\n\
or misconfigured. This error can also be caused by malfunctioning hardware.\n",
+ tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec,
sig);
fprintf(stderr, "\
We will try our best to scrape up some info that will hopefully help diagnose\n\
@@ -2737,9 +2748,15 @@ static int init_common_variables(const c
*/
mysql_bin_log.init_pthread_objects();
- if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
- strmov(glob_hostname,"mysql");
- strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
+ if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
+ {
+ strmake(glob_hostname, STRING_WITH_LEN("localhost"));
+ sql_print_warning("gethostname failed, using '%s' as hostname",
+ glob_hostname);
+ strmake(pidfile_name, STRING_WITH_LEN("mysql"));
+ }
+ else
+ strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
/*
@@ -2836,10 +2853,33 @@ static int init_common_variables(const c
#ifdef USE_REGEX
my_regex_init(&my_charset_latin1);
#endif
- if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
- MY_CS_PRIMARY,
- MYF(MY_WME))))
- return 1;
+ /*
+ Process a comma-separated character set list and choose
+ the first available character set. This is mostly for
+ test purposes, to be able to start "mysqld" even if
+ the requested character set is not available (see bug#18743).
+ */
+ for (;;)
+ {
+ char *next_character_set_name= strchr(default_character_set_name, ',');
+ if (next_character_set_name)
+ *next_character_set_name++= '\0';
+ if (!(default_charset_info=
+ get_charset_by_csname(default_character_set_name,
+ MY_CS_PRIMARY, MYF(MY_WME))))
+ {
+ if (next_character_set_name)
+ {
+ default_character_set_name= next_character_set_name;
+ default_collation_name= 0; // Ignore collation
+ }
+ else
+ return 1; // Eof of the list
+ }
+ else
+ break;
+ }
+
if (default_collation_name)
{
CHARSET_INFO *default_collation;
@@ -3174,7 +3214,7 @@ static int init_server_components()
if (opt_error_log)
{
if (!log_error_file_ptr[0])
- fn_format(log_error_file, glob_hostname, mysql_data_home, ".err",
+ fn_format(log_error_file, pidfile_name, mysql_data_home, ".err",
MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */
else
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err",
@@ -4977,7 +5017,8 @@ enum options_mysqld
OPT_SLOW_LOG,
OPT_MERGE,
OPT_THREAD_HANDLING,
- OPT_INNODB_ROLLBACK_ON_TIMEOUT
+ OPT_INNODB_ROLLBACK_ON_TIMEOUT,
+ OPT_SECURE_FILE_PRIV
};
@@ -5678,6 +5719,10 @@ Can't be set to 1 if --log-slave-updates
{"secure-auth", OPT_SECURE_AUTH, "Disallow authentication for accounts that have old (pre-4.1) passwords.",
(gptr*) &opt_secure_auth, (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG,
my_bool(0), 0, 0, 0, 0, 0},
+ {"secure-file-priv", OPT_SECURE_FILE_PRIV,
+ "Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory",
+ (gptr*) &opt_secure_file_priv, (gptr*) &opt_secure_file_priv, 0,
+ GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Uniquely identifies the server instance in the community of replication partners.",
(gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
@@ -7054,6 +7099,7 @@ static void mysql_init_variables(void)
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0;
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name !
opt_secure_auth= 0;
+ opt_secure_file_priv= 0;
opt_bootstrap= opt_myisam_log= 0;
mqh_used= 0;
segfaulted= kill_in_progress= 0;
@@ -8097,6 +8143,16 @@ static void fix_paths(void)
exit(1);
}
#endif /* HAVE_REPLICATION */
+ /*
+ Convert the secure-file-priv option to system format, allowing
+ a quick strcmp to check if read or write is in an allowed dir
+ */
+ if (opt_secure_file_priv)
+ {
+ convert_dirname(buff, opt_secure_file_priv, NullS);
+ my_free(opt_secure_file_priv, MYF(0));
+ opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
+ }
}
--- 1.313/sql/sql_class.cc 2007-02-14 14:46:10 +01:00
+++ 1.314/sql/sql_class.cc 2007-03-01 14:41:27 +01:00
@@ -243,7 +243,7 @@ THD::THD()
time_after_lock=(time_t) 0;
current_linfo = 0;
slave_thread = 0;
- variables.pseudo_thread_id= 0;
+ thread_id= variables.pseudo_thread_id= 0;
one_shot_set= 0;
file_id = 0;
query_id= 0;
@@ -267,9 +267,6 @@ THD::THD()
cleanup_done= abort_on_warning= no_warnings_for_error= 0;
peer_port= 0; // For SHOW PROCESSLIST
transaction.m_pending_rows_event= 0;
-#ifdef __WIN__
- real_id = 0;
-#endif
#ifdef SIGNAL_WITH_VIO_CLOSE
active_vio = 0;
#endif
@@ -401,6 +398,8 @@ void THD::change_user(void)
void THD::cleanup(void)
{
DBUG_ENTER("THD::cleanup");
+ DBUG_ASSERT(cleanup_done == 0);
+
#ifdef ENABLE_WHEN_BINLOG_WILL_BE_ABLE_TO_PREPARE
if (transaction.xid_state.xa_state == XA_PREPARED)
{
@@ -436,7 +435,6 @@ void THD::cleanup(void)
pthread_mutex_lock(&LOCK_user_locks);
item_user_lock_release(ull);
pthread_mutex_unlock(&LOCK_user_locks);
- ull= 0;
}
cleanup_done=1;
@@ -550,7 +548,9 @@ void THD::awake(THD::killed_state state_
killed= state_to_set;
if (state_to_set != THD::KILL_QUERY)
{
- thr_alarm_kill(real_id);
+ thr_alarm_kill(thread_id);
+ if (!slave_thread)
+ thread_scheduler.post_kill_notification(this);
#ifdef SIGNAL_WITH_VIO_CLOSE
close_active_vio();
#endif
@@ -601,18 +601,19 @@ bool THD::store_globals()
Assert that thread_stack is initialized: it's necessary to be able
to track stack overrun.
*/
- DBUG_ASSERT(this->thread_stack);
+ DBUG_ASSERT(thread_stack);
if (my_pthread_setspecific_ptr(THR_THD, this) ||
my_pthread_setspecific_ptr(THR_MALLOC, &mem_root))
return 1;
mysys_var=my_thread_var;
- dbug_thread_id=my_thread_id();
/*
- By default 'slave_proxy_id' is 'thread_id'. They may later become different
- if this is the slave SQL thread.
+ Let mysqld define the thread id (not mysys)
+ This allows us to move THD to different threads if needed.
*/
- variables.pseudo_thread_id= thread_id;
+ mysys_var->id= thread_id;
+ real_id= pthread_self(); // For debugging
+
/*
We have to call thr_lock_info_init() again here as THD may have been
created in another thread
@@ -2519,7 +2520,7 @@ my_size_t THD::pack_row(TABLE *table, MY
if (bitmap_is_set(cols,i))
{
my_ptrdiff_t const offset=
- field->is_null(rec_offset) ? def_offset : rec_offset;
+ field->is_null((uint) rec_offset) ? def_offset : rec_offset;
field->move_field_offset(offset);
ptr= (byte*)field->pack((char *) ptr, field->ptr);
field->move_field_offset(-offset);
@@ -2561,7 +2562,7 @@ namespace {
: m_memory(0)
{
#ifndef DBUG_OFF
- m_alloc_checked= false;
+ m_alloc_checked= FALSE;
#endif
allocate_memory(table, len1);
m_ptr[0]= has_memory() ? m_memory : 0;
@@ -2572,7 +2573,7 @@ namespace {
: m_memory(0)
{
#ifndef DBUG_OFF
- m_alloc_checked= false;
+ m_alloc_checked= FALSE;
#endif
allocate_memory(table, len1 + len2);
m_ptr[0]= has_memory() ? m_memory : 0;
@@ -2593,7 +2594,7 @@ namespace {
*/
bool has_memory() const {
#ifndef DBUG_OFF
- m_alloc_checked= true;
+ m_alloc_checked= TRUE;
#endif
return m_memory != 0;
}
@@ -2602,7 +2603,7 @@ namespace {
{
DBUG_ASSERT(s < sizeof(m_ptr)/sizeof(*m_ptr));
DBUG_ASSERT(m_ptr[s] != 0);
- DBUG_ASSERT(m_alloc_checked == true);
+ DBUG_ASSERT(m_alloc_checked == TRUE);
return m_ptr[s];
}
@@ -2632,12 +2633,12 @@ namespace {
table->write_row_record=
(byte *) alloc_root(&table->mem_root, 2 * maxlen);
m_memory= table->write_row_record;
- m_release_memory_on_destruction= false;
+ m_release_memory_on_destruction= FALSE;
}
else
{
m_memory= (byte *) my_malloc(total_length, MYF(MY_WME));
- m_release_memory_on_destruction= true;
+ m_release_memory_on_destruction= TRUE;
}
}
--- 1.340/sql/sql_class.h 2007-02-14 14:51:47 +01:00
+++ 1.341/sql/sql_class.h 2007-03-01 14:41:27 +01:00
@@ -214,7 +214,7 @@ struct system_variables
ulong read_rnd_buff_size;
ulong div_precincrement;
ulong sortbuff_size;
- handlerton *table_type;
+ ulong thread_handling;
ulong tx_isolation;
ulong completion_type;
/* Determines which non-standard SQL behaviour should be enabled */
@@ -231,11 +231,15 @@ struct system_variables
ulong trans_prealloc_size;
ulong log_warnings;
ulong group_concat_max_len;
+ ulong ndb_autoincrement_prefetch_sz;
+ ulong ndb_index_stat_cache_entries;
+ ulong ndb_index_stat_update_freq;
+ ulong binlog_format; // binlog format for this thd (see enum_binlog_format)
/*
In slave thread we need to know in behalf of which
thread the query is being run to replicate temp tables properly
*/
- ulong pseudo_thread_id;
+ my_thread_id pseudo_thread_id;
my_bool low_priority_updates;
my_bool new_mode;
@@ -248,14 +252,12 @@ struct system_variables
my_bool ndb_use_exact_count;
my_bool ndb_use_transactions;
my_bool ndb_index_stat_enable;
- ulong ndb_autoincrement_prefetch_sz;
- ulong ndb_index_stat_cache_entries;
- ulong ndb_index_stat_update_freq;
- ulong binlog_format; // binlog format for this thd (see enum_binlog_format)
my_bool old_alter_table;
my_bool old_passwords;
+ handlerton *table_type;
+
/* Only charset part of these variables is sensible */
CHARSET_INFO *character_set_filesystem;
CHARSET_INFO *character_set_client;
@@ -1064,7 +1066,7 @@ public:
} transaction;
Field *dup_field;
#ifndef __WIN__
- sigset_t signals,block_signals;
+ sigset_t signals;
#endif
#ifdef SIGNAL_WITH_VIO_CLOSE
Vio* active_vio;
@@ -1255,7 +1257,7 @@ public:
update auto-updatable fields (like auto_increment and timestamp).
*/
query_id_t query_id, warn_id;
- ulong thread_id, col_access;
+ ulong col_access;
#ifdef ERROR_INJECT_SUPPORT
ulong error_inject_value;
@@ -1264,8 +1266,8 @@ public:
ulong statement_id_counter;
ulong rand_saved_seed1, rand_saved_seed2;
ulong row_count; // Row counter, mainly for errors and warnings
- long dbug_thread_id;
- pthread_t real_id;
+ pthread_t real_id; /* For debugging */
+ my_thread_id thread_id;
uint tmp_table, global_read_lock;
uint server_status,open_options;
enum enum_thread_type system_thread;
@@ -1629,6 +1631,7 @@ public:
*p_db_length= db_length;
return FALSE;
}
+ thd_scheduler scheduler;
};
--- 1.627/sql/sql_parse.cc 2007-02-20 12:48:54 +01:00
+++ 1.628/sql/sql_parse.cc 2007-03-01 14:41:27 +01:00
@@ -28,24 +28,6 @@
#include "events.h"
#include "event_data_objects.h"
-#ifdef HAVE_OPENSSL
-/*
- Without SSL the handshake consists of one packet. This packet
- has both client capabilites and scrambled password.
- With SSL the handshake might consist of two packets. If the first
- packet (client capabilities) has CLIENT_SSL flag set, we have to
- switch to SSL and read the second packet. The scrambled password
- is in the second packet and client_capabilites field will be ignored.
- Maybe it is better to accept flags other than CLIENT_SSL from the
- second packet?
-*/
-#define SSL_HANDSHAKE_SIZE 2
-#define NORMAL_HANDSHAKE_SIZE 6
-#define MIN_HANDSHAKE_SIZE 2
-#else
-#define MIN_HANDSHAKE_SIZE 6
-#endif /* HAVE_OPENSSL */
-
/* Used in error handling only */
#define SP_TYPE_STRING(LP) \
((LP)->sphead->m_type == TYPE_ENUM_FUNCTION ? "FUNCTION" : "PROCEDURE")
@@ -56,11 +38,6 @@
(LP)->sql_command == SQLCOM_DROP_FUNCTION ? \
"FUNCTION" : "PROCEDURE")
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-static void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
-static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
-static void decrease_user_connections(USER_CONN *uc);
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
const char *any_db="*any*"; // Special symbol for check_access
@@ -103,20 +80,6 @@ const char *xa_state_names[]={
"NON-EXISTING", "ACTIVE", "IDLE", "PREPARED"
};
-#ifdef __WIN__
-static void test_signal(int sig_ptr)
-{
-#if !defined( DBUG_OFF)
- MessageBox(NULL,"Test signal","DBUG",MB_OK);
-#endif
-}
-static void init_signals(void)
-{
- int signals[7] = {SIGINT,SIGILL,SIGFPE,SIGSEGV,SIGTERM,SIGBREAK,SIGABRT } ;
- for (int i=0 ; i < 7 ; i++)
- signal( signals[i], test_signal) ;
-}
-#endif
static void unlock_locked_tables(THD *thd)
{
@@ -160,6 +123,7 @@ bool end_active_trans(THD *thd)
DBUG_RETURN(error);
}
+
bool begin_trans(THD *thd)
{
int error=0;
@@ -211,413 +175,6 @@ static bool some_non_temp_table_to_be_up
return 0;
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-static HASH hash_user_connections;
-
-static int get_or_create_user_conn(THD *thd, const char *user,
- const char *host,
- USER_RESOURCES *mqh)
-{
- int return_val= 0;
- uint temp_len, user_len;
- char temp_user[USER_HOST_BUFF_SIZE];
- struct user_conn *uc;
-
- DBUG_ASSERT(user != 0);
- DBUG_ASSERT(host != 0);
-
- 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,
- (byte*) temp_user, temp_len)))
- {
- /* First connection for user; Create a user connection object */
- if (!(uc= ((struct user_conn*)
- my_malloc(sizeof(struct user_conn) + temp_len+1,
- MYF(MY_WME)))))
- {
- net_send_error(thd, 0, NullS); // Out of memory
- 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->connections= uc->questions= uc->updates= uc->conn_per_hour= 0;
- 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;
- goto end;
- }
- }
- thd->user_connect=uc;
- uc->connections++;
-end:
- (void) pthread_mutex_unlock(&LOCK_user_conn);
- return return_val;
-
-}
-#endif /* !NO_EMBEDDED_ACCESS_CHECKS */
-
-
-/*
- Check if user exist and password supplied is correct.
-
- SYNOPSIS
- check_user()
- thd thread handle, thd->security_ctx->{host,user,ip} are used
- command originator of the check: now check_user is called
- during connect and change user procedures; used for
- logging.
- passwd scrambled password received from client
- passwd_len length of scrambled password
- db database name to connect to, may be NULL
- check_count dont know exactly
-
- Note, that host, user and passwd may point to communication buffer.
- Current implementation does not depend on that, but future changes
- should be done with this in mind; 'thd' is INOUT, all other params
- are 'IN'.
-
- RETURN VALUE
- 0 OK; thd->security_ctx->user/master_access/priv_user/db_access and
- thd->db are updated; OK is sent to client;
- -1 access denied or handshake error; error is sent to client;
- >0 error, not sent to client
-*/
-
-int check_user(THD *thd, enum enum_server_command command,
- const char *passwd, uint passwd_len, const char *db,
- bool check_count)
-{
- DBUG_ENTER("check_user");
-
-#ifdef NO_EMBEDDED_ACCESS_CHECKS
- thd->main_security_ctx.master_access= GLOBAL_ACLS; // Full rights
- /* Change database if necessary */
- if (db && db[0])
- {
- /*
- thd->db is saved in caller and needs to be freed by caller if this
- function returns 0
- */
- thd->reset_db(NULL, 0);
- if (mysql_change_db(thd, db, FALSE))
- {
- /* Send the error to the client */
- net_send_error(thd);
- DBUG_RETURN(-1);
- }
- }
- send_ok(thd);
- DBUG_RETURN(0);
-#else
-
- my_bool opt_secure_auth_local;
- pthread_mutex_lock(&LOCK_global_system_variables);
- opt_secure_auth_local= opt_secure_auth;
- pthread_mutex_unlock(&LOCK_global_system_variables);
-
- /*
- If the server is running in secure auth mode, short scrambles are
- forbidden.
- */
- if (opt_secure_auth_local && passwd_len == SCRAMBLE_LENGTH_323)
- {
- net_printf_error(thd, ER_NOT_SUPPORTED_AUTH_MODE);
- general_log_print(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
- DBUG_RETURN(-1);
- }
- if (passwd_len != 0 &&
- passwd_len != SCRAMBLE_LENGTH &&
- passwd_len != SCRAMBLE_LENGTH_323)
- DBUG_RETURN(ER_HANDSHAKE_ERROR);
-
- /*
- Clear thd->db as it points to something, that will be freed when
- connection is closed. We don't want to accidentally free a wrong pointer
- if connect failed. Also in case of 'CHANGE USER' failure, current
- database will be switched to 'no database selected'.
- */
- thd->reset_db(NULL, 0);
-
- USER_RESOURCES ur;
- int res= acl_getroot(thd, &ur, passwd, passwd_len);
-#ifndef EMBEDDED_LIBRARY
- if (res == -1)
- {
- /*
- This happens when client (new) sends password scrambled with
- scramble(), but database holds old value (scrambled with
- scramble_323()). Here we please client to send scrambled_password
- in old format.
- */
- NET *net= &thd->net;
- if (opt_secure_auth_local)
- {
- net_printf_error(thd, ER_SERVER_IS_IN_SECURE_AUTH_MODE,
- thd->main_security_ctx.user,
- thd->main_security_ctx.host_or_ip);
- general_log_print(thd, COM_CONNECT, ER(ER_SERVER_IS_IN_SECURE_AUTH_MODE),
- thd->main_security_ctx.user,
- thd->main_security_ctx.host_or_ip);
- DBUG_RETURN(-1);
- }
- /* We have to read very specific packet size */
- if (send_old_password_request(thd) ||
- my_net_read(net) != SCRAMBLE_LENGTH_323 + 1)
- {
- inc_host_errors(&thd->remote.sin_addr);
- DBUG_RETURN(ER_HANDSHAKE_ERROR);
- }
- /* Final attempt to check the user based on reply */
- /* So as passwd is short, errcode is always >= 0 */
- res= acl_getroot(thd, &ur, (char *) net->read_pos, SCRAMBLE_LENGTH_323);
- }
-#endif /*EMBEDDED_LIBRARY*/
- /* here res is always >= 0 */
- if (res == 0)
- {
- if (!(thd->main_security_ctx.master_access &
- NO_ACCESS)) // authentication is OK
- {
- DBUG_PRINT("info",
- ("Capabilities: %lu packet_length: %ld Host: '%s' "
- "Login user: '%s' Priv_user: '%s' Using password: %s "
- "Access: %lu db: '%s'",
- thd->client_capabilities,
- thd->max_client_packet_length,
- thd->main_security_ctx.host_or_ip,
- thd->main_security_ctx.user,
- thd->main_security_ctx.priv_user,
- passwd_len ? "yes": "no",
- thd->main_security_ctx.master_access,
- (thd->db ? thd->db : "*none*")));
-
- if (check_count)
- {
- VOID(pthread_mutex_lock(&LOCK_thread_count));
- bool count_ok= thread_count <= max_connections + delayed_insert_threads
- || (thd->main_security_ctx.master_access & SUPER_ACL);
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
- if (!count_ok)
- { // too many connections
- net_send_error(thd, ER_CON_COUNT_ERROR);
- DBUG_RETURN(-1);
- }
- }
-
- /*
- Log the command before authentication checks, so that the user can
- check the log for the tried login tried and also to detect
- break-in attempts.
- */
- general_log_print(thd, command,
- (thd->main_security_ctx.priv_user ==
- thd->main_security_ctx.user ?
- (char*) "%s@%s on %s" :
- (char*) "%s@%s as anonymous on %s"),
- thd->main_security_ctx.user,
- thd->main_security_ctx.host_or_ip,
- db ? db : (char*) "");
-
- /*
- This is the default access rights for the current database. It's
- set to 0 here because we don't have an active database yet (and we
- may not have an active database to set.
- */
- thd->main_security_ctx.db_access=0;
-
- /* Don't allow user to connect if he has done too many queries */
- if ((ur.questions || ur.updates || ur.conn_per_hour || ur.user_conn ||
- max_user_connections) &&
- get_or_create_user_conn(thd,
- (opt_old_style_user_limits ? thd->main_security_ctx.user :
- thd->main_security_ctx.priv_user),
- (opt_old_style_user_limits ? thd->main_security_ctx.host_or_ip :
- thd->main_security_ctx.priv_host),
- &ur))
- DBUG_RETURN(-1);
- if (thd->user_connect &&
- (thd->user_connect->user_resources.conn_per_hour ||
- thd->user_connect->user_resources.user_conn ||
- max_user_connections) &&
- check_for_max_user_connections(thd, thd->user_connect))
- DBUG_RETURN(-1);
-
- /* Change database if necessary */
- if (db && db[0])
- {
- if (mysql_change_db(thd, db, FALSE))
- {
- /* Send error to the client */
- net_send_error(thd);
- if (thd->user_connect)
- decrease_user_connections(thd->user_connect);
- DBUG_RETURN(-1);
- }
- }
- send_ok(thd);
- thd->password= test(passwd_len); // remember for error messages
- /* Ready to handle queries */
- DBUG_RETURN(0);
- }
- }
- else if (res == 2) // client gave short hash, server has long hash
- {
- net_printf_error(thd, ER_NOT_SUPPORTED_AUTH_MODE);
- general_log_print(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
- DBUG_RETURN(-1);
- }
- net_printf_error(thd, ER_ACCESS_DENIED_ERROR,
- thd->main_security_ctx.user,
- thd->main_security_ctx.host_or_ip,
- passwd_len ? ER(ER_YES) : ER(ER_NO));
- general_log_print(thd, COM_CONNECT, ER(ER_ACCESS_DENIED_ERROR),
- thd->main_security_ctx.user,
- thd->main_security_ctx.host_or_ip,
- passwd_len ? ER(ER_YES) : ER(ER_NO));
- DBUG_RETURN(-1);
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
-}
-
-/*
- Check for maximum allowable user connections, if the mysqld server is
- started with corresponding variable that is greater then 0.
-*/
-
-extern "C" byte *get_key_conn(user_conn *buff, uint *length,
- my_bool not_used __attribute__((unused)))
-{
- *length=buff->len;
- return (byte*) buff->user;
-}
-
-extern "C" void free_user(struct user_conn *uc)
-{
- my_free((char*) uc,MYF(0));
-}
-
-void init_max_user_conn(void)
-{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- (void) hash_init(&hash_user_connections,system_charset_info,max_connections,
- 0,0,
- (hash_get_key) get_key_conn, (hash_free_key) free_user,
- 0);
-#endif
-}
-
-
-/*
- check if user has already too many connections
-
- SYNOPSIS
- check_for_max_user_connections()
- thd Thread handle
- uc User connect object
-
- NOTES
- If check fails, we decrease user connection count, which means one
- shouldn't call decrease_user_connections() after this function.
-
- RETURN
- 0 ok
- 1 error
-*/
-
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-
-static int check_for_max_user_connections(THD *thd, USER_CONN *uc)
-{
- int error=0;
- DBUG_ENTER("check_for_max_user_connections");
-
- (void) pthread_mutex_lock(&LOCK_user_conn);
- if (max_user_connections && !uc->user_resources.user_conn &&
- max_user_connections < (uint) uc->connections)
- {
- net_printf_error(thd, ER_TOO_MANY_USER_CONNECTIONS, uc->user);
- error=1;
- goto end;
- }
- time_out_user_resource_limits(thd, uc);
- if (uc->user_resources.user_conn &&
- uc->user_resources.user_conn < uc->connections)
- {
- net_printf_error(thd, ER_USER_LIMIT_REACHED, uc->user,
- "max_user_connections",
- (long) uc->user_resources.user_conn);
- error= 1;
- goto end;
- }
- if (uc->user_resources.conn_per_hour &&
- uc->user_resources.conn_per_hour <= uc->conn_per_hour)
- {
- net_printf_error(thd, ER_USER_LIMIT_REACHED, uc->user,
- "max_connections_per_hour",
- (long) uc->user_resources.conn_per_hour);
- error=1;
- goto end;
- }
- uc->conn_per_hour++;
-
- end:
- if (error)
- uc->connections--; // no need for decrease_user_connections() here
- (void) pthread_mutex_unlock(&LOCK_user_conn);
- DBUG_RETURN(error);
-}
-
-/*
- Decrease user connection count
-
- SYNOPSIS
- decrease_user_connections()
- uc User connection object
-
- NOTES
- If there is a n user connection object for a connection
- (which only happens if 'max_user_connections' is defined or
- if someone has created a resource grant for a user), then
- the connection count is always incremented on connect.
-
- The user connect object is not freed if some users has
- 'max connections per hour' defined as we need to be able to hold
- count over the lifetime of the connection.
-*/
-
-static void decrease_user_connections(USER_CONN *uc)
-{
- DBUG_ENTER("decrease_user_connections");
- (void) pthread_mutex_lock(&LOCK_user_conn);
- DBUG_ASSERT(uc->connections);
- if (!--uc->connections && !mqh_used)
- {
- /* Last connection for user; Delete it */
- (void) hash_delete(&hash_user_connections,(byte*) uc);
- }
- (void) pthread_mutex_unlock(&LOCK_user_conn);
- DBUG_VOID_RETURN;
-}
-
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
-
-
-void free_max_user_conn(void)
-{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- hash_free(&hash_user_connections);
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
-}
-
-
/*
Mark all commands that somehow changes a table
@@ -701,402 +258,6 @@ bool is_update_query(enum enum_sql_comma
return (sql_command_flags[command] & CF_CHANGES_DATA) != 0;
}
-/*
- Reset per-hour user resource limits when it has been more than
- an hour since they were last checked
-
- SYNOPSIS:
- time_out_user_resource_limits()
- thd Thread handler
- uc User connection details
-
- NOTE:
- This assumes that the LOCK_user_conn mutex has been acquired, so it is
- safe to test and modify members of the USER_CONN structure.
-*/
-
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-
-static void time_out_user_resource_limits(THD *thd, USER_CONN *uc)
-{
- time_t check_time = thd->start_time ? thd->start_time : time(NULL);
- DBUG_ENTER("time_out_user_resource_limits");
-
- /* If more than a hour since last check, reset resource checking */
- if (check_time - uc->intime >= 3600)
- {
- uc->questions=1;
- uc->updates=0;
- uc->conn_per_hour=0;
- uc->intime=check_time;
- }
-
- DBUG_VOID_RETURN;
-}
-
-/*
- Check if maximum queries per hour limit has been reached
- returns 0 if OK.
-*/
-
-static bool check_mqh(THD *thd, uint check_command)
-{
- bool error= 0;
- USER_CONN *uc=thd->user_connect;
- DBUG_ENTER("check_mqh");
- DBUG_ASSERT(uc != 0);
-
- (void) pthread_mutex_lock(&LOCK_user_conn);
-
- time_out_user_resource_limits(thd, uc);
-
- /* Check that we have not done too many questions / hour */
- if (uc->user_resources.questions &&
- uc->questions++ >= uc->user_resources.questions)
- {
- net_printf_error(thd, ER_USER_LIMIT_REACHED, uc->user, "max_questions",
- (long) uc->user_resources.questions);
- error=1;
- goto end;
- }
- if (check_command < (uint) SQLCOM_END)
- {
- /* Check that we have not done too many updates / hour */
- if (uc->user_resources.updates &&
- (sql_command_flags[check_command] & CF_CHANGES_DATA) &&
- uc->updates++ >= uc->user_resources.updates)
- {
- net_printf_error(thd, ER_USER_LIMIT_REACHED, uc->user, "max_updates",
- (long) uc->user_resources.updates);
- error=1;
- goto end;
- }
- }
-end:
- (void) pthread_mutex_unlock(&LOCK_user_conn);
- DBUG_RETURN(error);
-}
-
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
-
-
-static void reset_mqh(LEX_USER *lu, bool get_them= 0)
-{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- (void) pthread_mutex_lock(&LOCK_user_conn);
- if (lu) // for GRANT
- {
- USER_CONN *uc;
- uint temp_len=lu->user.length+lu->host.length+2;
- char temp_user[USER_HOST_BUFF_SIZE];
-
- memcpy(temp_user,lu->user.str,lu->user.length);
- memcpy(temp_user+lu->user.length+1,lu->host.str,lu->host.length);
- temp_user[lu->user.length]='\0'; temp_user[temp_len-1]=0;
- if ((uc = (struct user_conn *) hash_search(&hash_user_connections,
- (byte*) temp_user, temp_len)))
- {
- uc->questions=0;
- get_mqh(temp_user,&temp_user[lu->user.length+1],uc);
- uc->updates=0;
- uc->conn_per_hour=0;
- }
- }
- else
- {
- /* for FLUSH PRIVILEGES and FLUSH USER_RESOURCES */
- for (uint idx=0;idx < hash_user_connections.records; idx++)
- {
- USER_CONN *uc=(struct user_conn *) hash_element(&hash_user_connections,
- idx);
- if (get_them)
- get_mqh(uc->user,uc->host,uc);
- uc->questions=0;
- uc->updates=0;
- uc->conn_per_hour=0;
- }
- }
- (void) pthread_mutex_unlock(&LOCK_user_conn);
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
-}
-
-void thd_init_client_charset(THD *thd, uint cs_number)
-{
- /*
- Use server character set and collation if
- - opt_character_set_client_handshake is not set
- - client has not specified a character set
- - client character set is the same as the servers
- - client character set doesn't exists in server
- */
- if (!opt_character_set_client_handshake ||
- !(thd->variables.character_set_client= get_charset(cs_number, MYF(0))) ||
- !my_strcasecmp(&my_charset_latin1,
- global_system_variables.character_set_client->name,
- thd->variables.character_set_client->name))
- {
- thd->variables.character_set_client=
- global_system_variables.character_set_client;
- thd->variables.collation_connection=
- global_system_variables.collation_connection;
- thd->variables.character_set_results=
- global_system_variables.character_set_results;
- }
- else
- {
- thd->variables.character_set_results=
- thd->variables.collation_connection=
- thd->variables.character_set_client;
- }
-}
-
-
-/*
- Perform handshake, authorize client and update thd ACL variables.
- SYNOPSIS
- check_connection()
- thd thread handle
-
- RETURN
- 0 success, OK is sent to user, thd is updated.
- -1 error, which is sent to user
- > 0 error code (not sent to user)
-*/
-
-#ifndef EMBEDDED_LIBRARY
-static int check_connection(THD *thd)
-{
- uint connect_errors= 0;
- NET *net= &thd->net;
- ulong pkt_len= 0;
- char *end;
-
- DBUG_PRINT("info",
- ("New connection received on %s", vio_description(net->vio)));
-#ifdef SIGNAL_WITH_VIO_CLOSE
- thd->set_active_vio(net->vio);
-#endif
-
- if (!thd->main_security_ctx.host) // If TCP/IP connection
- {
- char ip[30];
-
- if (vio_peer_addr(net->vio, ip, &thd->peer_port))
- return (ER_BAD_HOST_ERROR);
- if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(0))))
- return (ER_OUT_OF_RESOURCES);
- thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip;
- vio_in_addr(net->vio,&thd->remote.sin_addr);
- if (!(specialflag & SPECIAL_NO_RESOLVE))
- {
- vio_in_addr(net->vio,&thd->remote.sin_addr);
- thd->main_security_ctx.host=
- ip_to_hostname(&thd->remote.sin_addr, &connect_errors);
- /* Cut very long hostnames to avoid possible overflows */
- if (thd->main_security_ctx.host)
- {
- if (thd->main_security_ctx.host != my_localhost)
- thd->main_security_ctx.host[min(strlen(thd->main_security_ctx.host),
- HOSTNAME_LENGTH)]= 0;
- thd->main_security_ctx.host_or_ip= thd->main_security_ctx.host;
- }
- if (connect_errors > max_connect_errors)
- return(ER_HOST_IS_BLOCKED);
- }
- DBUG_PRINT("info",("Host: %s ip: %s",
- (thd->main_security_ctx.host ?
- thd->main_security_ctx.host : "unknown host"),
- (thd->main_security_ctx.ip ?
- thd->main_security_ctx.ip : "unknown ip")));
- if (acl_check_host(thd->main_security_ctx.host, thd->main_security_ctx.ip))
- return(ER_HOST_NOT_PRIVILEGED);
- }
- else /* Hostname given means that the connection was on a socket */
- {
- DBUG_PRINT("info",("Host: %s", thd->main_security_ctx.host));
- thd->main_security_ctx.host_or_ip= thd->main_security_ctx.host;
- thd->main_security_ctx.ip= 0;
- /* Reset sin_addr */
- bzero((char*) &thd->remote, sizeof(thd->remote));
- }
- vio_keepalive(net->vio, TRUE);
- {
- /* buff[] needs to big enough to hold the server_version variable */
- char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH + 64];
- ulong client_flags = (CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB |
- CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION);
-
- if (opt_using_transactions)
- client_flags|=CLIENT_TRANSACTIONS;
-#ifdef HAVE_COMPRESS
- client_flags |= CLIENT_COMPRESS;
-#endif /* HAVE_COMPRESS */
-#ifdef HAVE_OPENSSL
- if (ssl_acceptor_fd)
- client_flags |= CLIENT_SSL; /* Wow, SSL is available! */
-#endif /* HAVE_OPENSSL */
-
- end= strnmov(buff, server_version, SERVER_VERSION_LENGTH) + 1;
- int4store((uchar*) end, thd->thread_id);
- end+= 4;
- /*
- So as check_connection is the only entry point to authorization
- procedure, scramble is set here. This gives us new scramble for
- each handshake.
- */
- create_random_string(thd->scramble, SCRAMBLE_LENGTH, &thd->rand);
- /*
- Old clients does not understand long scrambles, but can ignore packet
- tail: that's why first part of the scramble is placed here, and second
- part at the end of packet.
- */
- end= strmake(end, thd->scramble, SCRAMBLE_LENGTH_323) + 1;
-
- int2store(end, client_flags);
- /* write server characteristics: up to 16 bytes allowed */
- end[2]=(char) default_charset_info->number;
- int2store(end+3, thd->server_status);
- bzero(end+5, 13);
- end+= 18;
- /* write scramble tail */
- end= strmake(end, thd->scramble + SCRAMBLE_LENGTH_323,
- SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323) + 1;
-
- /* At this point we write connection message and read reply */
- if (net_write_command(net, (uchar) protocol_version, "", 0, buff,
- (uint) (end-buff)) ||
- (pkt_len= my_net_read(net)) == packet_error ||
- pkt_len < MIN_HANDSHAKE_SIZE)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return(ER_HANDSHAKE_ERROR);
- }
- }
-#ifdef _CUSTOMCONFIG_
-#include "_cust_sql_parse.h"
-#endif
- if (connect_errors)
- reset_host_errors(&thd->remote.sin_addr);
- if (thd->packet.alloc(thd->variables.net_buffer_length))
- return(ER_OUT_OF_RESOURCES);
-
- thd->client_capabilities=uint2korr(net->read_pos);
- if (thd->client_capabilities & CLIENT_PROTOCOL_41)
- {
- thd->client_capabilities|= ((ulong) uint2korr(net->read_pos+2)) << 16;
- thd->max_client_packet_length= uint4korr(net->read_pos+4);
- DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8]));
- thd_init_client_charset(thd, (uint) net->read_pos[8]);
- thd->update_charset();
- end= (char*) net->read_pos+32;
- }
- else
- {
- thd->max_client_packet_length= uint3korr(net->read_pos+2);
- end= (char*) net->read_pos+5;
- }
-
- if (thd->client_capabilities & CLIENT_IGNORE_SPACE)
- thd->variables.sql_mode|= MODE_IGNORE_SPACE;
-#ifdef HAVE_OPENSSL
- DBUG_PRINT("info", ("client capabilities: %lu", thd->client_capabilities));
- if (thd->client_capabilities & CLIENT_SSL)
- {
- /* Do the SSL layering. */
- if (!ssl_acceptor_fd)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return(ER_HANDSHAKE_ERROR);
- }
- DBUG_PRINT("info", ("IO layer change in progress..."));
- if (sslaccept(ssl_acceptor_fd, net->vio, net->read_timeout))
- {
- DBUG_PRINT("error", ("Failed to accept new SSL connection"));
- inc_host_errors(&thd->remote.sin_addr);
- return(ER_HANDSHAKE_ERROR);
- }
- DBUG_PRINT("info", ("Reading user information over SSL layer"));
- if ((pkt_len= my_net_read(net)) == packet_error ||
- pkt_len < NORMAL_HANDSHAKE_SIZE)
- {
- DBUG_PRINT("error", ("Failed to read user information (pkt_len= %lu)",
- pkt_len));
- inc_host_errors(&thd->remote.sin_addr);
- return(ER_HANDSHAKE_ERROR);
- }
- }
-#endif
-
- if (end >= (char*) net->read_pos+ pkt_len +2)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return(ER_HANDSHAKE_ERROR);
- }
-
- if (thd->client_capabilities & CLIENT_INTERACTIVE)
- thd->variables.net_wait_timeout= thd->variables.net_interactive_timeout;
- if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
- opt_using_transactions)
- net->return_status= &thd->server_status;
-
- char *user= end;
- char *passwd= strend(user)+1;
- uint user_len= passwd - user - 1;
- char *db= passwd;
- char db_buff[NAME_LEN + 1]; // buffer to store db in utf8
- char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
- uint dummy_errors;
-
- /*
- Old clients send null-terminated string as password; new clients send
- the size (1 byte) + string (not null-terminated). Hence in case of empty
- password both send '\0'.
-
- This strlen() can't be easily deleted without changing protocol.
- */
- uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
- *passwd++ : strlen(passwd);
- db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
- db + passwd_len + 1 : 0;
- /* strlen() can't be easily deleted without changing protocol */
- uint db_len= db ? strlen(db) : 0;
-
- if (passwd + passwd_len + db_len > (char *)net->read_pos + pkt_len)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return ER_HANDSHAKE_ERROR;
- }
-
- /* Since 4.1 all database names are stored in utf8 */
- if (db)
- {
- db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
- system_charset_info,
- db, db_len,
- thd->charset(), &dummy_errors)]= 0;
- db= db_buff;
- }
-
- user_buff[user_len= copy_and_convert(user_buff, sizeof(user_buff)-1,
- system_charset_info, user, user_len,
- thd->charset(), &dummy_errors)]= '\0';
- user= user_buff;
-
- /* If username starts and ends in "'", chop them off */
- if (user_len > 1 && user[0] == '\'' && user[user_len - 1] == '\'')
- {
- user[user_len-1]= 0;
- user++;
- user_len-= 2;
- }
-
- if (thd->main_security_ctx.user)
- x_free(thd->main_security_ctx.user);
- if (!(thd->main_security_ctx.user= my_strdup(user, MYF(0))))
- return (ER_OUT_OF_RESOURCES);
- return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE);
-}
-
void execute_init_command(THD *thd, sys_var_str *init_command_var,
rw_lock_t *var_mutex)
@@ -1129,153 +290,6 @@ void execute_init_command(THD *thd, sys_
}
-pthread_handler_t handle_one_connection(void *arg)
-{
- THD *thd=(THD*) arg;
- uint launch_time =
- (uint) ((thd->thr_create_time = time(NULL)) - thd->connect_time);
- if (launch_time >= slow_launch_time)
- statistic_increment(slow_launch_threads,&LOCK_status );
-
- pthread_detach_this_thread();
-
-#if !defined( __WIN__) // Win32 calls this in pthread_create
- /* The following calls needs to be done before we call DBUG_ macros */
- if (!(test_flags & TEST_NO_THREADS) & my_thread_init())
- {
- close_connection(thd, ER_OUT_OF_RESOURCES, 1);
- statistic_increment(aborted_connects,&LOCK_status);
- end_thread(thd,0);
- return 0;
- }
-#endif
-
- /*
- handle_one_connection() is the only way a thread would start
- and would always be on top of the stack, therefore, the thread
- stack always starts at the address of the first local variable
- of handle_one_connection, which is thd. We need to know the
- start of the stack so that we could check for stack overruns.
- */
- DBUG_PRINT("info", ("handle_one_connection called by thread %lu\n",
- thd->thread_id));
- /* now that we've called my_thread_init(), it is safe to call DBUG_* */
-
-#if defined(__WIN__)
- init_signals();
-#elif !defined(__NETWARE__)
- sigset_t set;
- VOID(sigemptyset(&set)); // Get mask in use
- VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
-#endif
- thd->thread_stack= (char*) &thd;
- if (thd->store_globals())
- {
- close_connection(thd, ER_OUT_OF_RESOURCES, 1);
- statistic_increment(aborted_connects,&LOCK_status);
- end_thread(thd,0);
- return 0;
- }
-
- do
- {
- int error;
- NET *net= &thd->net;
- Security_context *sctx= thd->security_ctx;
- net->no_send_error= 0;
-
- /* Use "connect_timeout" value during connection phase */
- net_set_read_timeout(net, connect_timeout);
- net_set_write_timeout(net, connect_timeout);
-
- if ((error=check_connection(thd)))
- { // Wrong permissions
- if (error > 0)
- net_printf_error(thd, error, sctx->host_or_ip);
-#ifdef __NT__
- if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE)
- my_sleep(1000); /* must wait after eof() */
-#endif
- statistic_increment(aborted_connects,&LOCK_status);
- goto end_thread;
- }
-#ifdef __NETWARE__
- netware_reg_user(sctx->ip, sctx->user, "MySQL");
-#endif
- if (thd->variables.max_join_size == HA_POS_ERROR)
- thd->options |= OPTION_BIG_SELECTS;
- if (thd->client_capabilities & CLIENT_COMPRESS)
- net->compress=1; // Use compression
-
- thd->version= refresh_version;
- thd->proc_info= 0;
- thd->command= COM_SLEEP;
- thd->set_time();
- thd->init_for_queries();
-
- if (sys_init_connect.value_length && !(sctx->master_access & SUPER_ACL))
- {
- execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect);
- if (thd->query_error)
- {
- thd->killed= THD::KILL_CONNECTION;
- sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
- thd->thread_id,(thd->db ? thd->db : "unconnected"),
- sctx->user ? sctx->user : "unauthenticated",
- sctx->host_or_ip, "init_connect command failed");
- sql_print_warning("%s", net->last_error);
- }
- thd->proc_info=0;
- thd->set_time();
- thd->init_for_queries();
- }
-
- /* Connect completed, set read/write timeouts back to tdefault */
- net_set_read_timeout(net, thd->variables.net_read_timeout);
- net_set_write_timeout(net, thd->variables.net_write_timeout);
-
- while (!net->error && net->vio != 0 &&
- !(thd->killed == THD::KILL_CONNECTION))
- {
- net->no_send_error= 0;
- if (do_command(thd))
- break;
- }
- if (thd->user_connect)
- decrease_user_connections(thd->user_connect);
- if (net->error && net->vio != 0 && net->report_error)
- {
- if (!thd->killed && thd->variables.log_warnings > 1)
- sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
- thd->thread_id,(thd->db ? thd->db : "unconnected"),
- sctx->user ? sctx->user : "unauthenticated",
- sctx->host_or_ip,
- (net->last_errno ? ER(net->last_errno) :
- ER(ER_UNKNOWN_ERROR)));
- net_send_error(thd, net->last_errno, NullS);
- statistic_increment(aborted_threads,&LOCK_status);
- }
- else if (thd->killed)
- {
- statistic_increment(aborted_threads,&LOCK_status);
- }
-
-end_thread:
- close_connection(thd, 0, 1);
- end_thread(thd,1);
- /*
- If end_thread returns, we are either running with --one-thread
- or this thread has been schedule to handle the next query
- */
- thd= current_thd;
- thd->thread_stack= (char*) &thd;
- } while (!(test_flags & TEST_NO_THREADS));
- /* The following is only executed if we are not using --one-thread */
- return(0); /* purecov: deadcode */
-}
-
-#endif /* EMBEDDED_LIBRARY */
-
/*
Execute commands from bootstrap_file.
Used when creating the initial grant tables
@@ -1302,11 +316,6 @@ pthread_handler_t handle_bootstrap(void
#ifndef EMBEDDED_LIBRARY
pthread_detach_this_thread();
thd->thread_stack= (char*) &thd;
-#if !defined(__WIN__) && !defined(__NETWARE__)
- sigset_t set;
- VOID(sigemptyset(&set)); // Get mask in use
- VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
-#endif
#endif /* EMBEDDED_LIBRARY */
if (thd->variables.max_join_size == HA_POS_ERROR)
@@ -2096,7 +1105,6 @@ bool dispatch_command(enum enum_server_c
*/
enum mysql_enum_shutdown_level level=
(enum mysql_enum_shutdown_level) (uchar) packet[0];
- DBUG_PRINT("quit",("Got shutdown command for level %u", level));
if (level == SHUTDOWN_DEFAULT)
level= SHUTDOWN_WAIT_ALL_BUFFERS; // soon default will be configurable
else if (level != SHUTDOWN_WAIT_ALL_BUFFERS)
@@ -4241,7 +3249,7 @@ end_with_restore_list:
{
if (!(user= get_current_user(thd, tmp_user)))
goto error;
- reset_mqh(user);
+ reset_mqh(user, 0);
}
}
}
@@ -4271,7 +3279,9 @@ end_with_restore_list:
We WANT to write and we CAN write.
! we write after unlocking the table.
*/
- /* Presumably, RESET and binlog writing doesn't require synchronization */
+ /*
+ Presumably, RESET and binlog writing doesn't require synchronization
+ */
if (!lex->no_write_to_binlog && write_to_binlog)
{
if (mysql_bin_log.is_open())
@@ -6591,6 +5601,7 @@ bool st_select_lex::init_nested_join(THD
join_list->push_front(ptr);
ptr->embedding= embedding;
ptr->join_list= join_list;
+ ptr->alias= (char*) "(nested_join)";
embedding= ptr;
join_list= &nested_join->join_list;
join_list->empty();
@@ -6675,6 +5686,7 @@ TABLE_LIST *st_select_lex::nest_last_joi
ptr->embedding= embedding;
ptr->join_list= join_list;
+ ptr->alias= (char*) "(nest_last_join)";
embedded_list= &nested_join->join_list;
embedded_list->empty();
@@ -7169,7 +6181,7 @@ bool reload_acl_and_cache(THD *thd, ulon
}
#endif
if (options & REFRESH_USER_RESOURCES)
- reset_mqh((LEX_USER *) NULL);
+ reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */
*write_to_binlog= tmp_write_to_binlog;
return result;
}
--- 1.48/sql/tztime.cc 2007-02-23 12:13:50 +01:00
+++ 1.49/sql/tztime.cc 2007-03-01 14:41:27 +01:00
@@ -780,6 +780,8 @@ gmt_sec_to_TIME(TIME *tmp, my_time_t sec
static my_time_t
sec_since_epoch(int year, int mon, int mday, int hour, int min ,int sec)
{
+ /* Guard against my_time_t overflow(on system with 32 bit my_time_t) */
+ DBUG_ASSERT(!(year == TIMESTAMP_MAX_YEAR && mon == 1 && mday > 17));
#ifndef WE_WANT_TO_HANDLE_UNORMALIZED_DATES
/*
It turns out that only whenever month is normalized or unnormalized
@@ -960,12 +962,12 @@ TIME_to_gmt_sec(const TIME *t, const TIM
*/
if (shift)
{
- if (local_t > (my_time_t) (TIMESTAMP_MAX_VALUE - shift*86400L +
+ if (local_t > (my_time_t) (TIMESTAMP_MAX_VALUE - shift * SECS_PER_DAY +
sp->revtis[i].rt_offset - saved_seconds))
{
DBUG_RETURN(0); /* my_time_t overflow */
}
- local_t+= shift*86400L;
+ local_t+= shift * SECS_PER_DAY;
}
if (sp->revtis[i].rt_type)
@@ -1353,6 +1355,7 @@ my_time_t
Time_zone_offset::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
{
my_time_t local_t;
+ int shift= 0;
/*
Check timestamp range.we have to do this as calling function relies on
@@ -1361,9 +1364,23 @@ Time_zone_offset::TIME_to_gmt_sec(const
if (!validate_timestamp_range(t))
return 0;
- local_t= sec_since_epoch(t->year, t->month, t->day,
+ /*
+ Do a temporary shift of the boundary dates to avoid
+ overflow of my_time_t if the time value is near it's
+ maximum range
+ */
+ if ((t->year == TIMESTAMP_MAX_YEAR) && (t->month == 1) && t->day > 4)
+ shift= 2;
+
+ local_t= sec_since_epoch(t->year, t->month, (t->day - shift),
t->hour, t->minute, t->second) -
offset;
+
+ if (shift)
+ {
+ /* Add back the shifted time */
+ local_t+= shift * SECS_PER_DAY;
+ }
if (local_t >= TIMESTAMP_MIN_VALUE && local_t <= TIMESTAMP_MAX_VALUE)
return local_t;
--- 1.279/mysql-test/mysql-test-run.pl 2007-02-28 16:41:27 +01:00
+++ 1.280/mysql-test/mysql-test-run.pl 2007-03-01 14:53:30 +01:00
@@ -412,24 +412,24 @@ sub main () {
{
next if $test->{skip};
- $need_ndbcluster||= $test->{ndb_test};
- $need_im||= $test->{component_id} eq 'im';
-
- # Count max number of slaves used by a test case
- if ( $test->{slave_num} > $max_slave_num)
+ if (!$opt_extern)
{
- $max_slave_num= $test->{slave_num};
- mtr_error("Too many slaves") if $max_slave_num > 3;
- }
+ $need_ndbcluster||= $test->{ndb_test};
+ $need_im||= $test->{component_id} eq 'im';
- # Count max number of masters used by a test case
- if ( $test->{master_num} > $max_master_num)
- {
- $max_master_num= $test->{master_num};
- mtr_error("Too many masters") if $max_master_num > 2;
- mtr_error("Too few masters") if $max_master_num < 1;
- }
+ # Count max number of slaves used by a test case
+ if ( $test->{slave_num} > $max_slave_num) {
+ $max_slave_num= $test->{slave_num};
+ mtr_error("Too many slaves") if $max_slave_num > 3;
+ }
+ # Count max number of masters used by a test case
+ if ( $test->{master_num} > $max_master_num) {
+ $max_master_num= $test->{master_num};
+ mtr_error("Too many masters") if $max_master_num > 2;
+ mtr_error("Too few masters") if $max_master_num < 1;
+ }
+ }
$use_innodb||= $test->{'innodb_test'};
}
@@ -703,7 +703,9 @@ sub command_line_setup () {
"$glob_basedir/client",
"$glob_basedir/bin");
- $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
+ if (!$opt_extern)
+ {
+ $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
"$glob_basedir/sql/mysqld",
"$path_client_bindir/mysqld-max-nt",
"$path_client_bindir/mysqld-max",
@@ -715,8 +717,16 @@ sub command_line_setup () {
"$glob_basedir/bin/mysqld",
"$glob_basedir/sbin/mysqld");
- # Use the mysqld found above to find out what features are available
- collect_mysqld_features();
+ # Use the mysqld found above to find out what features are available
+ collect_mysqld_features();
+ }
+ else
+ {
+ $mysqld_variables{'port'}= 3306;
+ $mysqld_variables{'master-port'}= 3306;
+ $opt_skip_ndbcluster= 1;
+ $opt_skip_im= 1;
+ }
if ( $opt_comment )
{
@@ -753,7 +763,7 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# NOTE if the default binlog format is changed, this has to be changed
$used_binlog_format= "stmt";
- if ( $mysql_version_id >= 50100 )
+ if (!$opt_extern && $mysql_version_id >= 50100 )
{
$used_binlog_format= "mixed"; # Default value for binlog format
@@ -839,19 +849,20 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Check im suport
# --------------------------------------------------------------------------
- if ( $mysql_version_id < 50000 )
+ if (!$opt_extern)
{
- # Instance manager is not supported until 5.0
- $opt_skip_im= 1;
+ if ( $mysql_version_id < 50000 ) {
+ # Instance manager is not supported until 5.0
+ $opt_skip_im= 1;
- }
+ }
- if ( $glob_win32 )
- {
- mtr_report("Disable Instance manager - not supported on Windows");
- $opt_skip_im= 1;
- }
+ if ( $glob_win32 ) {
+ mtr_report("Disable Instance manager - not supported on Windows");
+ $opt_skip_im= 1;
+ }
+ }
# --------------------------------------------------------------------------
# Record flag
# --------------------------------------------------------------------------
@@ -1215,7 +1226,7 @@ sub command_line_setup () {
$opt_skip_rpl= 1;
# Setup master->[0] with the settings for the extern server
- $master->[0]->{'path_sock'}= $opt_socket if $opt_socket;
+ $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
mtr_report("Using extern server at '$master->[0]->{path_sock}'");
}
else
@@ -1481,65 +1492,70 @@ sub executable_setup () {
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
- if ( $mysql_version_id >= 50100 )
- {
- $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
- }
- if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
- {
- $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
- }
- else
- {
- $exe_mysql_upgrade= "";
- }
- if ( ! $glob_win32 )
+ if (!$opt_extern)
{
- # Look for mysql_fix_system_table script
- $exe_mysql_fix_system_tables=
- mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
- "$path_client_bindir/mysql_fix_privilege_tables");
-
- }
-
# Look for SQL scripts directory
$path_sql_dir= mtr_path_exists("$glob_basedir/share",
"$glob_basedir/scripts");
- # Look for mysql_fix_privilege_tables.sql script
- $file_mysql_fix_privilege_tables=
- mtr_file_exists("$path_sql_dir/mysql_fix_privilege_tables.sql");
-
- if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
- {
- mtr_warning("Could not find all required ndb binaries, " .
- "all ndb tests will fail, use --skip-ndbcluster to " .
- "skip testing it.");
+ if ( $mysql_version_id >= 50100 )
+ {
+ $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
+ }
+ if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
+ {
+ $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
+ }
+ else
+ {
+ $exe_mysql_upgrade= "";
+ }
- foreach my $cluster (@{$clusters})
+ if ( ! $glob_win32 )
{
- $cluster->{"executable_setup_failed"}= 1;
+ # Look for mysql_fix_system_table script
+ $exe_mysql_fix_system_tables=
+ mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
+ "$path_client_bindir/mysql_fix_privilege_tables");
}
- }
- if ( ! $opt_skip_im and executable_setup_im())
- {
- mtr_warning("Could not find all required instance manager binaries, " .
- "all im tests will fail, use --skip-im to " .
- "continue without instance manager");
- $instance_manager->{"executable_setup_failed"}= 1;
- }
+ # Look for mysql_fix_privilege_tables.sql script
+ $file_mysql_fix_privilege_tables=
+ mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
+ "$glob_basedir/share/mysql_fix_privilege_tables.sql");
- # Look for the udf_example library
- $lib_udf_example=
- mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
- "$glob_basedir/sql/.libs/udf_example.so",);
+ if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
+ {
+ mtr_warning("Could not find all required ndb binaries, " .
+ "all ndb tests will fail, use --skip-ndbcluster to " .
+ "skip testing it.");
- # Look for the ha_example library
- $lib_example_plugin=
- mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
- "$glob_basedir/storage/example/.libs/ha_example.so",);
+ foreach my $cluster (@{$clusters})
+ {
+ $cluster->{"executable_setup_failed"}= 1;
+ }
+ }
+
+ if ( ! $opt_skip_im and executable_setup_im())
+ {
+ mtr_warning("Could not find all required instance manager binaries, " .
+ "all im tests will fail, use --skip-im to " .
+ "continue without instance manager");
+ $instance_manager->{"executable_setup_failed"}= 1;
+ }
+
+ # Look for the udf_example library
+ $lib_udf_example=
+ mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
+ "$glob_basedir/sql/.libs/udf_example.so",);
+
+ # Look for the ha_example library
+ $lib_example_plugin=
+ mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
+ "$glob_basedir/storage/example/.libs/ha_example.so",);
+
+ }
# Look for mysqltest executable
if ( $glob_use_embedded_server )
@@ -1607,7 +1623,7 @@ sub mysql_client_test_arguments()
mtr_add_arg($args, "--port=$master->[0]->{'port'}");
mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
- if ( $mysql_version_id >= 50000 )
+ if ( $opt_extern || $mysql_version_id >= 50000 )
{
mtr_add_arg($args, "--vardir=$opt_vardir")
}
@@ -1726,7 +1742,7 @@ sub environment_setup () {
}
$ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
- $ENV{'LD_LIBRARY_PATHS'} ?
+ $ENV{'LD_LIBRARY_PATH'} ?
split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
@@ -1911,7 +1927,7 @@ sub environment_setup () {
my $cmdline_mysqlbinlog=
mtr_native_path($exe_mysqlbinlog) .
" --no-defaults --disable-force-if-open --debug-info --local-load=$opt_tmpdir";
- if ( $mysql_version_id >= 50000 )
+ if ( !$opt_extern && $mysql_version_id >= 50000 )
{
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
}
@@ -1943,7 +1959,7 @@ sub environment_setup () {
# ----------------------------------------------------
# Setup env so childs can execute mysql_upgrade
# ----------------------------------------------------
- if ( $mysql_version_id >= 50000 )
+ if ( !$opt_extern && $mysql_version_id >= 50000 )
{
$ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
}
@@ -1951,7 +1967,7 @@ sub environment_setup () {
# ----------------------------------------------------
# Setup env so childs can execute mysql_fix_system_tables
# ----------------------------------------------------
- if ( ! $glob_win32 )
+ if ( !$opt_extern && ! $glob_win32 )
{
my $cmdline_mysql_fix_system_tables=
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
@@ -1962,7 +1978,10 @@ sub environment_setup () {
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
}
- $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
+ if (!$opt_extern)
+ {
+ $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
+ }
# ----------------------------------------------------
# Setup env so childs can execute my_print_defaults
@@ -2277,7 +2296,10 @@ sub check_ssl_support ($) {
if ($opt_skip_ssl || $opt_extern)
{
- mtr_report("Skipping SSL");
+ if (!$opt_extern)
+ {
+ mtr_report("Skipping SSL");
+ }
$opt_ssl_supported= 0;
$opt_ssl= 0;
return;
@@ -2352,9 +2374,12 @@ sub vs_config_dirs ($$) {
sub check_ndbcluster_support ($) {
my $mysqld_variables= shift;
- if ($opt_skip_ndbcluster)
+ if ($opt_skip_ndbcluster || $opt_extern)
{
- mtr_report("Skipping ndbcluster");
+ if (!$opt_extern)
+ {
+ mtr_report("Skipping ndbcluster");
+ }
$opt_skip_ndbcluster_slave= 1;
return;
}
@@ -2770,7 +2795,10 @@ sub initialize_servers () {
}
else
{
- mtr_report("No need to create '$opt_vardir' it already exists");
+ if ($opt_verbose)
+ {
+ mtr_report("No need to create '$opt_vardir' it already exists");
+ }
}
}
else
@@ -3172,17 +3200,17 @@ sub do_before_run_mysqltest($)
unlink("$result_dir/$tname.log");
unlink("$result_dir/$tname.warnings");
- if ( $mysql_version_id < 50000 )
- {
- # Set environment variable NDB_STATUS_OK to 1
- # if script decided to run mysqltest cluster _is_ installed ok
- $ENV{'NDB_STATUS_OK'} = "1";
- }
- elsif ( $mysql_version_id < 50100 )
+ if (!$opt_extern)
{
- # Set environment variable NDB_STATUS_OK to YES
- # if script decided to run mysqltest cluster _is_ installed ok
- $ENV{'NDB_STATUS_OK'} = "YES";
+ if ( $mysql_version_id < 50000 ) {
+ # Set environment variable NDB_STATUS_OK to 1
+ # if script decided to run mysqltest cluster _is_ installed ok
+ $ENV{'NDB_STATUS_OK'} = "1";
+ } elsif ( $mysql_version_id < 50100 ) {
+ # Set environment variable NDB_STATUS_OK to YES
+ # if script decided to run mysqltest cluster _is_ installed ok
+ $ENV{'NDB_STATUS_OK'} = "YES";
+ }
}
}
@@ -4968,10 +4996,10 @@ sub usage ($) {
if ( $message )
{
- print STDERR "$message \n";
+ print STDERR "$message\n";
}
- print STDERR <<HERE;
+ print <<HERE;
$0 [ OPTIONS ] [ TESTCASE ]
--- 1.232/mysql-test/t/disabled.def 2007-02-23 12:13:47 +01:00
+++ 1.233/mysql-test/t/disabled.def 2007-03-01 14:41:26 +01:00
@@ -36,7 +36,6 @@ synchronization : Bug#24529 T
#ndb_binlog_discover : bug#21806 2006-08-24
#ndb_autodiscover3 : bug#21806
-mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results
plugin : Bug#25659 memory leak via "plugins" test
rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly
ndb_alter_table : Bug##25774 ndb_alter_table.test fails in DBUG_ASSERT() on Linux x64
--- 1.5/mysql-test/r/mix2_myisam.result 2007-02-19 13:31:49 +01:00
+++ 1.6/mysql-test/r/mix2_myisam.result 2007-03-01 14:41:26 +01:00
@@ -1532,7 +1532,7 @@ id select_type table type possible_keys
1 SIMPLE t1 ref c c 11 const # Using where; Using index
explain select count(*) from t1 where t='a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range t t 13 NULL # Using where
+1 SIMPLE t1 ref t t 13 const # Using where
explain select count(*) from t1 where v like 'a%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where; Using index
--- 1.186/mysql-test/r/innodb.result 2007-02-20 20:56:50 +01:00
+++ 1.187/mysql-test/r/innodb.result 2007-03-01 14:41:26 +01:00
@@ -1984,7 +1984,7 @@ id select_type table type possible_keys
1 SIMPLE t1 ref c c 11 const # Using where; Using index
explain select count(*) from t1 where t='a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range t t 13 NULL # Using where
+1 SIMPLE t1 ref t t 13 const # Using where
explain select count(*) from t1 where v like 'a%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where; Using index
--- 1.57/mysql-test/r/type_blob.result 2007-02-14 14:46:09 +01:00
+++ 1.58/mysql-test/r/type_blob.result 2007-03-01 14:41:26 +01:00
@@ -610,12 +610,12 @@ create table t1 (id integer primary key
insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
select * from t1 where txt='Chevy' or txt is NULL;
id txt
-3 NULL
1 Chevy
2 Chevy
+3 NULL
explain select * from t1 where txt='Chevy' or txt is NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range txt_index txt_index 23 NULL 2 Using where
+1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where
select * from t1 where txt='Chevy ';
id txt
1 Chevy
--- 1.217/sql/set_var.cc 2007-02-20 16:26:29 +01:00
+++ 1.218/sql/set_var.cc 2007-03-01 14:41:27 +01:00
@@ -396,6 +396,10 @@ sys_var_thd_ulong sys_trans_alloc_block_
sys_var_thd_ulong sys_trans_prealloc_size("transaction_prealloc_size",
&SV::trans_prealloc_size,
0, fix_trans_mem_root);
+sys_var_thd_enum sys_thread_handling("thread_handling",
+ &SV::thread_handling,
+ &thread_handling_typelib,
+ NULL);
#ifdef HAVE_QUERY_CACHE
sys_var_long_ptr sys_query_cache_limit("query_cache_limit",
@@ -466,6 +470,10 @@ sys_var_long_ptr sys_table_lock_wait_tim
&table_lock_wait_timeout);
sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
&thread_cache_size);
+#if HAVE_POOL_OF_THREADS == 1
+sys_var_long_ptr sys_thread_pool_size("thread_pool_size",
+ &thread_pool_size);
+#endif
sys_var_thd_enum sys_tx_isolation("tx_isolation",
&SV::tx_isolation,
&tx_isolation_typelib,
@@ -1014,6 +1022,10 @@ SHOW_VAR init_vars[]= {
#ifdef HAVE_THR_SETCONCURRENCY
{"thread_concurrency", (char*) &concurrency, SHOW_LONG},
#endif
+ {sys_thread_handling.name, (char*) &sys_thread_handling, SHOW_SYS},
+#if HAVE_POOL_OF_THREADS == 1
+ {sys_thread_pool_size.name, (char*) &sys_thread_pool_size, SHOW_SYS},
+#endif
{"thread_stack", (char*) &thread_stack, SHOW_LONG},
{sys_time_format.name, (char*) &sys_time_format, SHOW_SYS},
{"time_zone", (char*) &sys_time_zone, SHOW_SYS},
@@ -2594,7 +2606,7 @@ bool update_sys_var_str_path(THD *thd, s
file_log= logger.get_log_file_handler();
break;
default:
- DBUG_ASSERT(0);
+ assert(0); // Impossible
}
if (!old_value)
@@ -3633,7 +3645,7 @@ bool sys_var_thd_table_type::update(THD
*/
byte *sys_var_thd_sql_mode::symbolic_mode_representation(THD *thd,
- ulong val,
+ ulonglong val,
ulong *len)
{
char buff[256];
@@ -4009,7 +4021,7 @@ sys_var_event_scheduler::update(THD *thd
res= Events::get_instance()->stop_execution_of_events();
else
{
- DBUG_ASSERT(0);
+ assert(0); // Impossible
}
if (res)
my_error(ER_EVENT_SET_VAR_ERROR, MYF(0));
--- 1.280/client/mysqltest.c 2007-02-28 16:41:27 +01:00
+++ 1.281/client/mysqltest.c 2007-03-01 14:53:30 +01:00
@@ -415,10 +415,12 @@ struct st_command
TYPELIB command_typelib= {array_elements(command_names),"",
command_names, 0};
-DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages;
+static DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages;
+static DYNAMIC_STRING global_ds_warnings, global_eval_query;
char builtin_echo[FN_REFLEN];
+
void die(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
void abort_not_supported_test(const char *fmt, ...)
@@ -795,6 +797,9 @@ void free_used_memory()
dynstr_free(&ds_res);
dynstr_free(&ds_progress);
dynstr_free(&ds_warning_messages);
+ dynstr_free(&global_ds_warnings);
+ dynstr_free(&global_eval_query);
+
free_all_replace();
my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(default_argv);
@@ -5509,8 +5514,6 @@ void run_query(struct st_connection *cn,
MYSQL *mysql= &cn->mysql;
DYNAMIC_STRING *ds;
DYNAMIC_STRING ds_result;
- DYNAMIC_STRING ds_warnings;
- DYNAMIC_STRING eval_query;
char *query;
int query_len;
my_bool view_created= 0, sp_created= 0;
@@ -5518,7 +5521,7 @@ void run_query(struct st_connection *cn,
(flags & QUERY_REAP_FLAG));
DBUG_ENTER("run_query");
- init_dynamic_string(&ds_warnings, NULL, 0, 256);
+ init_dynamic_string(&global_ds_warnings, NULL, 0, 256);
/* Scan for warning before sendign to server */
scan_command_for_warnings(command);
@@ -5528,10 +5531,10 @@ void run_query(struct st_connection *cn,
*/
if (command->type == Q_EVAL)
{
- init_dynamic_string(&eval_query, "", command->query_len+256, 1024);
- do_eval(&eval_query, command->query, command->end, FALSE);
- query = eval_query.str;
- query_len = eval_query.length;
+ init_dynamic_string(&global_eval_query, "", command->query_len+256, 1024);
+ do_eval(&global_eval_query, command->query, command->end, FALSE);
+ query = global_eval_query.str;
+ query_len = global_eval_query.length;
}
else
{
@@ -5603,7 +5606,7 @@ void run_query(struct st_connection *cn,
Collect warnings from create of the view that should otherwise
have been produced when the SELECT was executed
*/
- append_warnings(&ds_warnings, cur_con->util_mysql);
+ append_warnings(&global_ds_warnings, cur_con->util_mysql);
}
dynstr_free(&query_str);
@@ -5662,10 +5665,10 @@ void run_query(struct st_connection *cn,
if (ps_protocol_enabled &&
complete_query &&
match_re(&ps_re, query))
- run_query_stmt(mysql, command, query, query_len, ds, &ds_warnings);
+ run_query_stmt(mysql, command, query, query_len, ds, &global_ds_warnings);
else
run_query_normal(cn, command, flags, query, query_len,
- ds, &ds_warnings);
+ ds, &global_ds_warnings);
if (sp_created)
{
@@ -5689,11 +5692,11 @@ void run_query(struct st_connection *cn,
check_require(ds, command->require_file);
}
- dynstr_free(&ds_warnings);
+ dynstr_free(&global_ds_warnings);
if (ds == &ds_result)
dynstr_free(&ds_result);
if (command->type == Q_EVAL)
- dynstr_free(&eval_query);
+ dynstr_free(&global_eval_query);
DBUG_VOID_RETURN;
}
@@ -6605,7 +6608,8 @@ typedef struct st_replace_found {
void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
- const char *str, int len)
+ const char *str,
+ int len __attribute__((unused)))
{
reg1 REPLACE *rep_pos;
reg2 REPLACE_STRING *rep_str;
@@ -6996,7 +7000,7 @@ int reg_replace(char** buf_p, int* buf_l
we need at least what we have so far in the buffer + the part
before this match
*/
- need_buf_len= (res_p - buf) + subs[0].rm_so;
+ need_buf_len= (res_p - buf) + (int) subs[0].rm_so;
/* on this pass, calculate the memory for the result buffer */
while (expr_p < replace_end)
@@ -7006,17 +7010,17 @@ int reg_replace(char** buf_p, int* buf_l
if (c == '\\' && expr_p + 1 < replace_end)
{
- back_ref_num= expr_p[1] - '0';
+ back_ref_num= (int) (expr_p[1] - '0');
}
/* found a valid back_ref (eg. \1)*/
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
{
- int start_off,end_off;
+ regoff_t start_off, end_off;
if ((start_off=subs[back_ref_num].rm_so) > -1 &&
(end_off=subs[back_ref_num].rm_eo) > -1)
{
- need_buf_len += (end_off - start_off);
+ need_buf_len += (int) (end_off - start_off);
}
expr_p += 2;
}
@@ -7036,7 +7040,7 @@ int reg_replace(char** buf_p, int* buf_l
/* copy the pre-match part */
if (subs[0].rm_so)
{
- memcpy(res_p, str_p, subs[0].rm_so);
+ memcpy(res_p, str_p, (size_t) subs[0].rm_so);
res_p+= subs[0].rm_so;
}
@@ -7055,11 +7059,11 @@ int reg_replace(char** buf_p, int* buf_l
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
{
- int start_off,end_off;
- if ((start_off=subs[back_ref_num].rm_so) > -1 &&
+ regoff_t start_off, end_off;
+ if ((start_off= subs[back_ref_num].rm_so) > -1 &&
(end_off=subs[back_ref_num].rm_eo) > -1)
{
- int block_len= end_off - start_off;
+ int block_len= (int) (end_off - start_off);
memcpy(res_p,str_p + start_off, block_len);
res_p += block_len;
}
--- 1.278/BitKeeper/etc/ignore 2007-02-23 12:22:53 +01:00
+++ 1.279/BitKeeper/etc/ignore 2007-03-01 14:41:22 +01:00
@@ -1249,6 +1249,7 @@ mysql-test/*.ds?
mysql-test/*.vcproj
mysql-test/gmon.out
mysql-test/install_test_db
+mysql-test/lib/init_db.sql
mysql-test/mtr
mysql-test/mysql-test-run
mysql-test/mysql-test-run-shell
@@ -1813,6 +1814,7 @@ scripts/mysql_explain_log
scripts/mysql_find_rows
scripts/mysql_fix_extensions
scripts/mysql_fix_privilege_tables
+scripts/mysql_fix_privilege_tables.sql
scripts/mysql_install_db
scripts/mysql_secure_installation
scripts/mysql_setpermission
| Thread |
|---|
| • bk commit into 5.1 tree (msvensson:1.2486) | msvensson | 1 Mar |