diff options
-rw-r--r-- | Docs/manual.texi | 30 | ||||
-rw-r--r-- | include/my_sys.h | 2 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run | 16 | ||||
-rw-r--r-- | mysys/mf_iocache2.c | 9 | ||||
-rw-r--r-- | sql/filesort.cc | 6 | ||||
-rw-r--r-- | sql/ha_berkeley.cc | 3 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 2 | ||||
-rw-r--r-- | sql/hostname.cc | 3 | ||||
-rw-r--r-- | sql/log.cc | 10 | ||||
-rw-r--r-- | sql/log_event.h | 2 | ||||
-rw-r--r-- | sql/slave.cc | 2 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 |
13 files changed, 65 insertions, 24 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index f6abd3f9159..9e39092318e 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -39765,6 +39765,8 @@ though, so Version 3.23 is not released as a stable version yet. @appendixsubsec Changes in release 3.23.29 @itemize @bullet @item +Remove not used BDB logs on shutdown. +@item When creating a table, put @code{PRIMARY} keys first, followed by @code{UNIQUE} keys. @item @@ -44313,6 +44315,34 @@ select * from temporary_table, temporary_table as t2; @end example @item +The optimizer may handle @code{DISTINCT} differently if you are using +'hidden' columns in a join or not. In a join, hidden columns are +counted as part of the result (even if they are not shown) while in +normal queries hidden columns doesn't participate in the @code{DISTINCT} +comparison. We will probably change this in the future to never compare +the hidden columns when executing @code{DISTINCT} + +An example of this is: + +@example +SELECT DISTINCT mp3id FROM band_downloads WHERE userid = 9 ORDER BY id +DESC; + +and + +SELECT DISTINCT band_downloads.mp3id, FROM band_downloads,band_mp3 +WHERE band_downloads.userid = 9 AND band_mp3.id = band_downloads.mp3id +ORDER BY band_downloads.id DESC; +@end example + +In the second case you may in @strong{MySQL} 3.23.x get two identical rows +in the result set (because the hidden 'id' column may differ). + +Note that the this only happens for queries where you don't have the +ORDER BY columns in the result, something that is you are not allowed +to do in ANSI SQL. + +@item Because @strong{MySQL} allows you to work with table types that don't support transactions, and thus can't @code{rollback} data, some things behave a little differently in @strong{MySQL} than in other SQL servers. diff --git a/include/my_sys.h b/include/my_sys.h index aa465ba6d21..bd56482f8cf 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -332,6 +332,8 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); #define my_b_tell(info) ((info)->pos_in_file + \ ((info)->rc_pos - (info)->rc_request_pos)) +#define my_b_bytes_in_cache(info) ((uint) ((info)->rc_end - (info)->rc_pos)) + typedef struct st_changeable_var { const char *name; /* Name of variable */ long *varptr; /* Pointer to variable */ diff --git a/mysql-test/mysql-test-run b/mysql-test/mysql-test-run index eb39a25fbaf..111dd0b41cc 100755 --- a/mysql-test/mysql-test-run +++ b/mysql-test/mysql-test-run @@ -23,7 +23,7 @@ else if [ -f ./mysql-test-run ] && [ -d ../sql ] ; then SOURCE_DIST=1 else - echo "If you are using binary distirubution, run me from install root as \ + echo "If you are using binary distribution, run me from install root as \ scripts/mysql-test-run. On source distribution run me from source root as \ mysql-test/mysql-test-run or from mysql-test as ./mysql-test-run" exit 1 @@ -100,18 +100,18 @@ fi #++ # Program Definitions #-- -BASENAME=`which basename` +BASENAME=`which basename | head -1` CAT=/bin/cat CUT=/usr/bin/cut ECHO=/bin/echo -EXPR=`which expr` +EXPR=`which expr | head -1` FIND=/usr/bin/find -GCOV=`which gcov` +GCOV=`which gcov | head -1` PRINTF=/usr/bin/printf RM=/bin/rm TIME=/usr/bin/time TR=/usr/bin/tr -XARGS=`which xargs` +XARGS=`which xargs | head -1` # on source dist, we pick up freshly build executables # on binary, use what is installed @@ -130,7 +130,7 @@ fi SLAVE_MYSQLD=$MYSQLD #this will be changed later if we are doing gcov -MYSQL_TEST="$MYSQL_TEST --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent" +MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent" GDB_MASTER_INIT=/tmp/gdbinit.master GDB_SLAVE_INIT=/tmp/gdbinit.slave @@ -358,7 +358,7 @@ stop_slave () { if [ x$SLAVE_RUNNING = x1 ] then - $MYSQLADMIN --socket=$SLAVE_MYSOCK -u root shutdown + $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root shutdown SLAVE_RUNNING=0 fi } @@ -367,7 +367,7 @@ stop_master () { if [ x$MASTER_RUNNING = x1 ] then - $MYSQLADMIN --socket=$MASTER_MYSOCK -u root shutdown + $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root shutdown MASTER_RUNNING=0 fi } diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 4e44a632156..9880c1615bb 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -50,7 +50,8 @@ void my_b_seek(IO_CACHE *info,my_off_t pos) } /* -** Fill buffer +** Fill buffer. Note that this assumes that you have already used +** all characters in the CACHE, independent of the rc_pos value! ** return: 0 on error or EOF (info->error = -1 on error) ** number of characters */ @@ -102,9 +103,9 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length) uint length; max_length--; /* Save place for end \0 */ /* Calculate number of characters in buffer */ - if (!(length= (uint) (info->rc_end - info->rc_pos))) - if (!(length=my_b_fill(info))) - return 0; + if (!(length= my_b_bytes_in_cache(info)) && + !(length= my_b_fill(info))) + return 0; for (;;) { char *pos,*end; diff --git a/sql/filesort.cc b/sql/filesort.cc index 09151a1327e..e0808a9e8b7 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -324,8 +324,12 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, file->rnd_init(); file->extra(HA_EXTRA_CACHE); /* Quicker reads */ } + else if (quick_select) // QQ For FULLTEXT + { // QQ Should be removed soon + file->index_end(); + select->quick->init(); + } - if (!error) for (;;) { if (quick_select) diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index ceaa0b0291a..0436b16fddc 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -161,6 +161,7 @@ bool berkeley_end(void) DBUG_ENTER("berkeley_end"); if (!db_env) return 1; + berkeley_cleanup_log_files(); error=db_env->close(db_env,0); // Error is logged db_env=0; hash_free(&bdb_open_tables); @@ -987,7 +988,7 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record, DBUG_PRINT("enter",("index: %d",keynr)); if ((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) == - HA_NOSAME) + HA_NOSAME || keynr == primary_key) { // Unique key dbug_assert(keynr == primary_key || prim_key->data != key_buff2); error=key_file[keynr]->del(key_file[keynr], sub_trans, diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 860418a3fe4..c0f7b73a856 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -563,7 +563,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) T_STATISTICS ? UPDATE_STAT : 0)); info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | HA_STATUS_CONST); - if (rows != file->state->records) + if (rows != file->state->records && ! (param.testflag & T_VERY_SILENT)) { char llbuff[22],llbuff2[22]; mi_check_print_warning(¶m,"Number of rows changed from %s to %s", diff --git a/sql/hostname.cc b/sql/hostname.cc index 1c52a5363d3..fcf8d2753b8 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -123,6 +123,7 @@ void reset_host_errors(struct in_addr *in) my_string ip_to_hostname(struct in_addr *in, uint *errors) { + uint i; host_entry *entry; DBUG_ENTER("ip_to_hostname"); @@ -222,7 +223,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) } /* Check that 'gethostbyname' returned the used ip */ - for (uint i=0; check->h_addr_list[i]; i++) + for (i=0; check->h_addr_list[i]; i++) { if (*(uint32*)(check->h_addr_list)[i] == in->s_addr) { diff --git a/sql/log.cc b/sql/log.cc index 49e0faf4a7a..41fb4bfb856 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -76,7 +76,7 @@ static int find_uniq_filename(char *name) MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1), name(0), log_type(LOG_CLOSED),write_error(0), - inited(0), opened(0), no_rotate(0) + inited(0), no_rotate(0) { /* We don't want to intialize LOCK_Log here as the thread system may @@ -616,7 +616,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info) IO_CACHE *file = (event_info->cache_stmt ? &thd->transaction.trans_log : &log_file); if ((!(thd->options & OPTION_BIN_LOG) && - thd->master_access & PROCESS_ACL) || + (thd->master_access & PROCESS_ACL)) || !db_ok(event_info->db, binlog_do_db, binlog_ignore_db)) { VOID(pthread_mutex_unlock(&LOCK_log)); @@ -684,14 +684,14 @@ bool MYSQL_LOG::write(IO_CACHE *cache) if (is_open()) { uint length; - my_off_t start_pos=my_b_tell(&log_file); if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) { sql_print_error(ER(ER_ERROR_ON_WRITE), cache->file_name, errno); goto err; } - while ((length=my_b_fill(cache))) + length=my_b_bytes_in_cache(cache); + do { if (my_b_write(&log_file, cache->rc_pos, length)) { @@ -700,7 +700,7 @@ bool MYSQL_LOG::write(IO_CACHE *cache) goto err; } cache->rc_pos=cache->rc_end; // Mark buffer used up - } + } while ((length=my_b_fill(cache))); if (flush_io_cache(&log_file)) { if (!write_error) diff --git a/sql/log_event.h b/sql/log_event.h index 9c97a1a121c..6dde2932014 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -72,7 +72,7 @@ public: static void operator delete(void *ptr, size_t size) { - my_free((byte*)ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + my_free((gptr) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); } int write(IO_CACHE* file); diff --git a/sql/slave.cc b/sql/slave.cc index 2545745e7ea..86dc3e593af 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -17,6 +17,7 @@ #include "mysql_priv.h" #include <mysql.h> +#include <myisam.h> #include "mini_client.h" #include "slave.h" #include <thr_alarm.h> @@ -360,6 +361,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, HA_CHECK_OPT check_opt; check_opt.init(); + check_opt.flags|= T_VERY_SILENT; check_opt.quick = 1; thd->proc_info = "rebuilding the index on master dump table"; Vio* save_vio = thd->net.vio; diff --git a/sql/sql_class.h b/sql/sql_class.h index 4943e334aa0..b1b734165d0 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -60,7 +60,7 @@ class MYSQL_LOG { volatile enum_log_type log_type; char time_buff[20],db[NAME_LEN+1]; char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN]; - bool write_error,inited,opened; + bool write_error,inited; bool no_rotate; // for binlog - if log name can never change // we should not try to rotate it or write any rotation events // the user should use FLUSH MASTER instead of FLUSH LOGS for diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 88a9df7543a..d3177eae1ee 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1779,7 +1779,7 @@ mysql_execute_command(void) } else { - thd->options= ((thd->options & (ulong) (OPTION_STATUS_NO_TRANS_UPDATE)) | + thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) | OPTION_BEGIN); thd->server_status|= SERVER_STATUS_IN_TRANS; send_ok(&thd->net); |