diff options
author | unknown <monty@mysql.com> | 2004-05-20 00:54:52 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-05-20 00:54:52 +0300 |
commit | 348f6268f16bcc32485e3a505efbf10abcd21fe0 (patch) | |
tree | 969ae655143f6308b50b399e6abcb73c20e39a81 /sql | |
parent | 8243f763f09f424b220ec7002ad4b0300b873750 (diff) | |
parent | 0cc766f425fe8f9dc38d87db45089ddc773e6d2d (diff) | |
download | mariadb-git-348f6268f16bcc32485e3a505efbf10abcd21fe0.tar.gz |
Merge with 4.0, mainly to get changes to windows project files
VC++Files/client/mysqladmin.dsp:
Auto merged
VC++Files/client/mysqldump.dsp:
Auto merged
VC++Files/client/mysqlimport.dsp:
Auto merged
VC++Files/client/mysqlshow.dsp:
Auto merged
VC++Files/dbug/dbug.dsp:
Auto merged
VC++Files/heap/heap.dsp:
Auto merged
VC++Files/innobase/innobase.dsp:
Auto merged
VC++Files/isam/isam.dsp:
Auto merged
VC++Files/isamchk/isamchk.dsp:
Auto merged
VC++Files/libmysql/libmysql.dsp:
Auto merged
VC++Files/mysql.dsw:
Auto merged
BitKeeper/deleted/.del-sync0ipm.ic~2024167f6418de39:
Auto merged
VC++Files/libmysqltest/myTest.dsp:
Auto merged
VC++Files/merge/merge.dsp:
Auto merged
VC++Files/my_print_defaults/my_print_defaults.dsp:
Auto merged
VC++Files/myisam/myisam.dsp:
Auto merged
VC++Files/myisam_ftdump/myisam_ftdump.dsp:
Auto merged
VC++Files/myisammrg/myisammrg.dsp:
Auto merged
VC++Files/mysqlbinlog/mysqlbinlog.dsp:
Auto merged
VC++Files/mysqlcheck/mysqlcheck.dsp:
Auto merged
VC++Files/mysqlshutdown/mysqlshutdown.dsp:
Auto merged
VC++Files/mysqlwatch/mysqlwatch.dsp:
Auto merged
VC++Files/mysys/mysys.dsp:
Auto merged
VC++Files/pack_isam/pack_isam.dsp:
Auto merged
VC++Files/perror/perror.dsp:
Auto merged
VC++Files/regex/regex.dsp:
Auto merged
VC++Files/replace/replace.dsp:
Auto merged
VC++Files/test1/test1.dsp:
Auto merged
VC++Files/thr_test/thr_test.dsp:
Auto merged
VC++Files/vio/vio.dsp:
Auto merged
VC++Files/zlib/zlib.dsp:
Auto merged
extra/my_print_defaults.c:
Auto merged
include/m_string.h:
Auto merged
include/mysql_embed.h:
Auto merged
include/mysql_version.h.in:
Auto merged
innobase/dict/dict0dict.c:
Auto merged
innobase/mem/mem0pool.c:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
innobase/trx/trx0sys.c:
Auto merged
myisam/myisam_ftdump.c:
Auto merged
VC++Files/bdb/bdb.dsp:
Merge with 4.0
VC++Files/client/mysql.dsp:
Merge with 4.0
VC++Files/client/mysqlclient.dsp:
Merge with 4.0
VC++Files/comp_err/comp_err.dsp:
Merge with 4.0
VC++Files/libmysqld/examples/test_libmysqld.dsp:
Merge with 4.0
VC++Files/libmysqld/libmysqld.dsp:
Merge with 4.0
VC++Files/myisamchk/myisamchk.dsp:
Merge with 4.0
VC++Files/myisamlog/myisamlog.dsp:
Merge with 4.0
VC++Files/myisampack/myisampack.dsp:
Merge with 4.0
VC++Files/mysqldemb/mysqldemb.dsp:
Merge with 4.0
VC++Files/mysqlserver/mysqlserver.dsp:
Merge with 4.0
VC++Files/sql/mysqld.dsp:
Merge with 4.0
VC++Files/strings/strings.dsp:
Merge with 4.0
libmysqld/lib_sql.cc:
Merge with 4.0
libmysqld/libmysqld.def:
Merge with 4.0
mysql-test/r/func_str.result:
Merge with 4.0
mysql-test/r/handler.result:
auto
mysql-test/r/variables.result:
Merge with 4.0
mysql-test/t/func_str.test:
auto
mysql-test/t/handler.test:
auto
mysql-test/t/variables.test:
Merge with 4.0
scripts/make_win_src_distribution.sh:
auto
scripts/mysql_install_db.sh:
Use original file
sql/Makefile.am:
Merge with 4.0
sql/ha_innodb.cc:
auto
sql/item_strfunc.cc:
Merge with 4.0
sql/mysql_priv.h:
auto
sql/mysqld.cc:
Merge with 4.0
sql/set_var.cc:
Merge with 4.0
sql/slave.cc:
auto
sql/sql_class.h:
auto
sql/sql_handler.cc:
Merge with 4.0
strings/ctype-tis620.c:
Merge with 4.0
Diffstat (limited to 'sql')
-rw-r--r-- | sql/Makefile.am | 4 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 1 | ||||
-rw-r--r-- | sql/mysql_priv.h | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 65 | ||||
-rw-r--r-- | sql/mysqld_suffix.h | 38 | ||||
-rw-r--r-- | sql/set_var.cc | 18 | ||||
-rw-r--r-- | sql/slave.cc | 6 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sql_handler.cc | 16 |
9 files changed, 103 insertions, 49 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am index 1044673f8ec..469b82f95fa 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -49,7 +49,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ mysql_priv.h item_geofunc.h sql_bitmap.h \ procedure.h sql_class.h sql_lex.h sql_list.h \ sql_manager.h sql_map.h sql_string.h unireg.h \ - field.h handler.h \ + field.h handler.h mysqld_suffix.h \ ha_isammrg.h ha_isam.h ha_myisammrg.h\ ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \ ha_ndbcluster.h opt_range.h protocol.h \ @@ -86,7 +86,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ slave.cc sql_repl.cc sql_union.cc sql_derived.cc \ client.c sql_client.cc mini_client_errors.c pack.c\ - stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\ + stacktrace.c repl_failsafe.h repl_failsafe.cc \ gstream.cc spatial.cc sql_help.cc protocol_cursor.cc \ examples/ha_example.cc gen_lex_hash_SOURCES = gen_lex_hash.cc diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index c05091cae1f..676d8c1386a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2587,6 +2587,7 @@ String *Item_func_quote::val_str(String *str) *to= '\''; str->length(new_length); str->set_charset(collation.collation); + null_value= 0; return str; null: diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 14bd16332ef..ab3ad43af4d 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -857,7 +857,7 @@ extern uint protocol_version, mysqld_port, dropping_tables; extern uint delay_key_write_options, lower_case_table_names; extern bool opt_endinfo, using_udf_functions, locked_in_memory; extern bool opt_using_transactions, mysql_embedded; -extern bool using_update_log, opt_large_files; +extern bool using_update_log, opt_large_files, server_id_supplied; extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log; extern bool opt_disable_networking, opt_skip_show_db; extern bool volatile abort_loop, shutdown_in_progress, grant_option; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2d2514b0017..858a3758fe1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -22,6 +22,7 @@ #include "sql_repl.h" #include "repl_failsafe.h" #include "stacktrace.h" +#include "mysqld_suffix.h" #ifdef HAVE_BERKELEY_DB #include "ha_berkeley.h" #endif @@ -191,22 +192,6 @@ inline void reset_floating_point_exceptions() extern "C" int gethostname(char *name, int namelen); #endif -/* Set prefix for windows binary */ -#ifdef __WIN__ -#undef MYSQL_SERVER_SUFFIX -#ifdef __NT__ -#if defined(HAVE_BERKELEY_DB) -#define MYSQL_SERVER_SUFFIX "-max-nt" -#else -#define MYSQL_SERVER_SUFFIX "-nt" -#endif /* ...DB */ -#elif defined(HAVE_BERKELEY_DB) -#define MYSQL_SERVER_SUFFIX "-max" -#else -#define MYSQL_SERVER_SUFFIX "" -#endif /* __NT__ */ -#endif /* __WIN__ */ - /* Constants */ @@ -335,7 +320,7 @@ const char *opt_date_time_formats[3]; char *language_ptr, *default_collation_name, *default_character_set_name; char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home; -char server_version[SERVER_VERSION_LENGTH]=MYSQL_SERVER_VERSION; +char server_version[SERVER_VERSION_LENGTH]; char *mysqld_unix_port, *opt_mysql_tmpdir; char *my_bind_addr_str; const char **errmesg; /* Error messages */ @@ -489,6 +474,7 @@ static void start_signal_handler(void); extern "C" pthread_handler_decl(signal_hand, arg); static void mysql_init_variables(void); static void get_options(int argc,char **argv); +static void set_server_version(void); static int init_thread_environment(); static char *get_relative_path(const char *path); static void fix_paths(void); @@ -2108,18 +2094,11 @@ static int init_common_variables(const char *conf_file_name, int argc, strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); strmov(fn_ext(pidfile_name),".pid"); // Add proper extension -#ifndef DBUG_OFF - if (!*(MYSQL_SERVER_SUFFIX)) - strmov(strend(server_version),"-debug"); - else -#endif - strmov(strend(server_version),MYSQL_SERVER_SUFFIX); - load_defaults(conf_file_name, groups, &argc, &argv); defaults_argv=argv; get_options(argc,argv); - if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) - strcat(server_version,"-log"); + set_server_version(); + DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname, server_version, SYSTEM_TYPE,MACHINE_TYPE)); @@ -2603,14 +2582,14 @@ You should consider changing lower_case_table_names to 1 or 2", switch (server_id) { case 1: sql_print_error("\ -Warning: You have enabled the binary log, but you haven't set server-id:\n\ -Updates will be logged to the binary log, but connections to slaves will\n\ -not be accepted."); +Warning: You have enabled the binary log, but you haven't set server-id to \ +a non-zero value: we force server id to 1; updates will be logged to the \ +binary log, but connections from slaves will not be accepted."); break; case 2: sql_print_error("\ -Warning: You should set server-id to a non-0 value if master_host is set.\n\ -The server will not act as a slave."); +Warning: You should set server-id to a non-0 value if master_host is set; \ +we force server id to 2, but this MySQL server will not act as a slave."); break; } #endif @@ -4947,6 +4926,7 @@ struct show_var_st status_vars[]= { static void print_version(void) { + set_server_version(); printf("%s Ver %s for %s on %s (%s)\n",my_progname, server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT); } @@ -5828,6 +5808,29 @@ static void get_options(int argc,char **argv) } +/* + Create version name for running mysqld version + We automaticly add suffixes -debug, -embedded and -log to the version + name to make the version more descriptive. + (MYSQL_SERVER_SUFFIX is set by the compilation environment) +*/ + +static void set_server_version(void) +{ + char *end= strxmov(server_version, MYSQL_SERVER_VERSION, + MYSQL_SERVER_SUFFIX, NullS); +#ifdef EMBEDDED_LIBRARY + end= strmov(end, "-embedded"); +#endif +#ifndef DBUG_OFF + if (!strstr(MYSQL_SERVER_SUFFIX, "-debug")) + end= strmov(end, "-debug"); +#endif + if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) + strmov(end, "-log"); // This may slow down system +} + + static char *get_relative_path(const char *path) { if (test_if_hard_path(path) && diff --git a/sql/mysqld_suffix.h b/sql/mysqld_suffix.h new file mode 100644 index 00000000000..502cdeed75f --- /dev/null +++ b/sql/mysqld_suffix.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2000-2004 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Set MYSQL_SERVER_SUFFIX + The following code is quite ugly as there is no portable way to set a + string to the value of a macro +*/ + +#if defined(MYSQL_SERVER_SUFFIX_NT) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-nt" +#elif defined(MYSQL_SERVER_SUFFIX_MAX) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-max" +#elif defined(MYSQL_SERVER_SUFFIX_NT_MAX) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-nt-max" +#elif defined(MYSQL_SERVER_SUFFIX_PRO) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-pro" +#elif defined(MYSQL_SERVER_SUFFIX_PRO_NT) +#undef MYSQL_SERVER_SUFFIX +#define MYSQL_SERVER_SUFFIX "-pro-nt" +#endif diff --git a/sql/set_var.cc b/sql/set_var.cc index 1205eb17357..403304cc7c4 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -107,6 +107,7 @@ static void fix_max_connections(THD *thd, enum_var_type type); static int check_max_delayed_threads(THD *thd, set_var *var); static void fix_thd_mem_root(THD *thd, enum_var_type type); static void fix_trans_mem_root(THD *thd, enum_var_type type); +static void fix_server_id(THD *thd, enum_var_type type); static KEY_CACHE *create_key_cache(const char *name, uint length); void fix_sql_mode_var(THD *thd, enum_var_type type); static byte *get_error_count(THD *thd); @@ -307,7 +308,7 @@ sys_query_cache_wlock_invalidate("query_cache_wlock_invalidate", &SV::query_cache_wlock_invalidate); #endif /* HAVE_QUERY_CACHE */ sys_var_bool_ptr sys_secure_auth("secure_auth", &opt_secure_auth); -sys_var_long_ptr sys_server_id("server_id",&server_id); +sys_var_long_ptr sys_server_id("server_id", &server_id, fix_server_id); sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol", &opt_slave_compressed_protocol); #ifdef HAVE_REPLICATION @@ -444,8 +445,6 @@ sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE); sys_var_const_str sys_license("license", LICENSE); - - /* List of all variables for initialisation and storage in hash This is sorted in alphabetical order to make it easy to add new variables @@ -703,7 +702,7 @@ struct show_var_st init_vars[]= { {sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS}, {sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS}, {sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS}, - {"lower_case_file_system", (char*) &lower_case_file_system, SHOW_BOOL}, + {"lower_case_file_system", (char*) &lower_case_file_system, SHOW_MY_BOOL}, {"lower_case_table_names", (char*) &lower_case_table_names, SHOW_INT}, {sys_max_allowed_packet.name,(char*) &sys_max_allowed_packet, SHOW_SYS}, {sys_max_binlog_cache_size.name,(char*) &sys_max_binlog_cache_size, SHOW_SYS}, @@ -1134,6 +1133,13 @@ static void fix_trans_mem_root(THD *thd, enum_var_type type) thd->variables.trans_prealloc_size); } + +static void fix_server_id(THD *thd, enum_var_type type) +{ + server_id_supplied = 1; +} + + bool sys_var_long_ptr::update(THD *thd, set_var *var) { ulonglong tmp= var->save_result.ulonglong_value; @@ -1293,11 +1299,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) { ulonglong tmp= var->save_result.ulonglong_value; - if ((ulonglong) tmp > max_system_variables.*offset) + if (tmp > max_system_variables.*offset) tmp= max_system_variables.*offset; if (option_limits) - tmp= (ulong) getopt_ull_limit_value(tmp, option_limits); + tmp= getopt_ull_limit_value(tmp, option_limits); if (var->type == OPT_GLOBAL) { /* Lock is needed to make things safe on 32 bit systems */ diff --git a/sql/slave.cc b/sql/slave.cc index 4ce8d5939bc..a66e78f04bc 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -167,13 +167,11 @@ int init_slave() goto err; } - /* - make sure slave thread gets started if server_id is set, - valid master.info is present, and master_host has not been specified - */ if (server_id && !master_host && active_mi->host[0]) master_host= active_mi->host; + /* If server id is not set, start_slave_thread() will say it */ + if (master_host && !opt_skip_slave_start) { if (start_slave_threads(1 /* need mutex */, diff --git a/sql/sql_class.h b/sql/sql_class.h index 2566385a6d9..47e006b9bea 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -28,7 +28,7 @@ class Load_log_event; class Slave_log_event; enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE }; -enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY }; +enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME }; enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_IGNORE, DUP_UPDATE }; enum enum_log_type { LOG_CLOSED, LOG_TO_BE_OPENED, LOG_NORMAL, LOG_NEW, LOG_BIN}; enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 1579ac3b5c8..fcc56cbf9c9 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -103,7 +103,7 @@ int mysql_ha_closeall(THD *thd, TABLE_LIST *tables) } static enum enum_ha_read_modes rkey_to_rnext[]= - { RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; + { RNEXT_SAME, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; int mysql_ha_read(THD *thd, TABLE_LIST *tables, @@ -146,7 +146,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, char buff[MAX_FIELD_WIDTH]; String buffer(buff, sizeof(buff), system_charset_info); uint num_rows; - it++; + byte *key; + uint key_len; + LINT_INIT(key); + LINT_INIT(key_len); + + it++; // Skip first NULL field insert_fields(thd,tables,tables->db,tables->alias,&it); @@ -194,13 +199,16 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, DBUG_ASSERT(keyname != 0); err=table->file->index_prev(table->record[0]); break; + case RNEXT_SAME: + /* Continue scan on "(keypart1,keypart2,...)=(c1, c2, ...) */ + DBUG_ASSERT(keyname != 0); + err= table->file->index_next_same(table->record[0], key, key_len); + break; case RKEY: { DBUG_ASSERT(keyname != 0); KEY *keyinfo=table->key_info+keyno; KEY_PART_INFO *key_part=keyinfo->key_part; - uint key_len; - byte *key; if (key_expr->elements > keyinfo->key_parts) { my_printf_error(ER_TOO_MANY_KEY_PARTS,ER(ER_TOO_MANY_KEY_PARTS), |