Commit 4f4c928b authored by unknown's avatar unknown

Fixed delete in tables with hidden primary key

Remove not used BDB logs on shutdown
Don't give warnings for repair on slaves
Fixed transaction log files


Docs/manual.texi:
  Updated 'known bugs'
include/my_sys.h:
  Added define for checking number of bytes left in the IO_CACHE
mysql-test/mysql-test-run:
  Small bug fixes
mysys/mf_iocache2.c:
  Use new define
sql/filesort.cc:
  Temporary fix for FULLTEXT index
sql/ha_berkeley.cc:
  Fix for delete in tables with hidden primary key
  Remove not used BDB logs on shutdown
sql/ha_myisam.cc:
  Don't give warnings for repair on slaves
sql/hostname.cc:
  Portability fix
sql/log.cc:
  Fix transaction log files
sql/log_event.h:
  portability fix
sql/slave.cc:
  Don't give warnings for repair on slaves
sql/sql_class.h:
  Cleanup
sql/sql_parse.cc:
  Fixed typo
parent 3e7c27a0
...@@ -39765,6 +39765,8 @@ though, so Version 3.23 is not released as a stable version yet. ...@@ -39765,6 +39765,8 @@ though, so Version 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.29 @appendixsubsec Changes in release 3.23.29
@itemize @bullet @itemize @bullet
@item @item
Remove not used BDB logs on shutdown.
@item
When creating a table, put @code{PRIMARY} keys first, followed by When creating a table, put @code{PRIMARY} keys first, followed by
@code{UNIQUE} keys. @code{UNIQUE} keys.
@item @item
...@@ -44312,6 +44314,34 @@ You can't use temporary tables more than once in the same query. ...@@ -44312,6 +44314,34 @@ You can't use temporary tables more than once in the same query.
select * from temporary_table, temporary_table as t2; select * from temporary_table, temporary_table as t2;
@end example @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 @item
Because @strong{MySQL} allows you to work with table types that don't Because @strong{MySQL} allows you to work with table types that don't
support transactions, and thus can't @code{rollback} data, some things support transactions, and thus can't @code{rollback} data, some things
...@@ -332,6 +332,8 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); ...@@ -332,6 +332,8 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
#define my_b_tell(info) ((info)->pos_in_file + \ #define my_b_tell(info) ((info)->pos_in_file + \
((info)->rc_pos - (info)->rc_request_pos)) ((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 { typedef struct st_changeable_var {
const char *name; /* Name of variable */ const char *name; /* Name of variable */
long *varptr; /* Pointer to variable */ long *varptr; /* Pointer to variable */
......
...@@ -23,7 +23,7 @@ else ...@@ -23,7 +23,7 @@ else
if [ -f ./mysql-test-run ] && [ -d ../sql ] ; then if [ -f ./mysql-test-run ] && [ -d ../sql ] ; then
SOURCE_DIST=1 SOURCE_DIST=1
else 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 \ 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" mysql-test/mysql-test-run or from mysql-test as ./mysql-test-run"
exit 1 exit 1
...@@ -100,18 +100,18 @@ fi ...@@ -100,18 +100,18 @@ fi
#++ #++
# Program Definitions # Program Definitions
#-- #--
BASENAME=`which basename` BASENAME=`which basename | head -1`
CAT=/bin/cat CAT=/bin/cat
CUT=/usr/bin/cut CUT=/usr/bin/cut
ECHO=/bin/echo ECHO=/bin/echo
EXPR=`which expr` EXPR=`which expr | head -1`
FIND=/usr/bin/find FIND=/usr/bin/find
GCOV=`which gcov` GCOV=`which gcov | head -1`
PRINTF=/usr/bin/printf PRINTF=/usr/bin/printf
RM=/bin/rm RM=/bin/rm
TIME=/usr/bin/time TIME=/usr/bin/time
TR=/usr/bin/tr TR=/usr/bin/tr
XARGS=`which xargs` XARGS=`which xargs | head -1`
# on source dist, we pick up freshly build executables # on source dist, we pick up freshly build executables
# on binary, use what is installed # on binary, use what is installed
...@@ -130,7 +130,7 @@ fi ...@@ -130,7 +130,7 @@ fi
SLAVE_MYSQLD=$MYSQLD #this will be changed later if we are doing gcov 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_MASTER_INIT=/tmp/gdbinit.master
GDB_SLAVE_INIT=/tmp/gdbinit.slave GDB_SLAVE_INIT=/tmp/gdbinit.slave
...@@ -358,7 +358,7 @@ stop_slave () ...@@ -358,7 +358,7 @@ stop_slave ()
{ {
if [ x$SLAVE_RUNNING = x1 ] if [ x$SLAVE_RUNNING = x1 ]
then then
$MYSQLADMIN --socket=$SLAVE_MYSOCK -u root shutdown $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root shutdown
SLAVE_RUNNING=0 SLAVE_RUNNING=0
fi fi
} }
...@@ -367,7 +367,7 @@ stop_master () ...@@ -367,7 +367,7 @@ stop_master ()
{ {
if [ x$MASTER_RUNNING = x1 ] if [ x$MASTER_RUNNING = x1 ]
then then
$MYSQLADMIN --socket=$MASTER_MYSOCK -u root shutdown $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root shutdown
MASTER_RUNNING=0 MASTER_RUNNING=0
fi fi
} }
......
...@@ -50,7 +50,8 @@ void my_b_seek(IO_CACHE *info,my_off_t pos) ...@@ -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) ** return: 0 on error or EOF (info->error = -1 on error)
** number of characters ** number of characters
*/ */
...@@ -102,9 +103,9 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length) ...@@ -102,9 +103,9 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
uint length; uint length;
max_length--; /* Save place for end \0 */ max_length--; /* Save place for end \0 */
/* Calculate number of characters in buffer */ /* Calculate number of characters in buffer */
if (!(length= (uint) (info->rc_end - info->rc_pos))) if (!(length= my_b_bytes_in_cache(info)) &&
if (!(length=my_b_fill(info))) !(length= my_b_fill(info)))
return 0; return 0;
for (;;) for (;;)
{ {
char *pos,*end; char *pos,*end;
......
...@@ -324,8 +324,12 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, ...@@ -324,8 +324,12 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
file->rnd_init(); file->rnd_init();
file->extra(HA_EXTRA_CACHE); /* Quicker reads */ 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 (;;) for (;;)
{ {
if (quick_select) if (quick_select)
......
...@@ -161,6 +161,7 @@ bool berkeley_end(void) ...@@ -161,6 +161,7 @@ bool berkeley_end(void)
DBUG_ENTER("berkeley_end"); DBUG_ENTER("berkeley_end");
if (!db_env) if (!db_env)
return 1; return 1;
berkeley_cleanup_log_files();
error=db_env->close(db_env,0); // Error is logged error=db_env->close(db_env,0); // Error is logged
db_env=0; db_env=0;
hash_free(&bdb_open_tables); hash_free(&bdb_open_tables);
...@@ -987,7 +988,7 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record, ...@@ -987,7 +988,7 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
DBUG_PRINT("enter",("index: %d",keynr)); DBUG_PRINT("enter",("index: %d",keynr));
if ((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) == if ((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) ==
HA_NOSAME) HA_NOSAME || keynr == primary_key)
{ // Unique key { // Unique key
dbug_assert(keynr == primary_key || prim_key->data != key_buff2); dbug_assert(keynr == primary_key || prim_key->data != key_buff2);
error=key_file[keynr]->del(key_file[keynr], sub_trans, error=key_file[keynr]->del(key_file[keynr], sub_trans,
......
...@@ -563,7 +563,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize) ...@@ -563,7 +563,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
T_STATISTICS ? UPDATE_STAT : 0)); T_STATISTICS ? UPDATE_STAT : 0));
info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
HA_STATUS_CONST); HA_STATUS_CONST);
if (rows != file->state->records) if (rows != file->state->records && ! (param.testflag & T_VERY_SILENT))
{ {
char llbuff[22],llbuff2[22]; char llbuff[22],llbuff2[22];
mi_check_print_warning(&param,"Number of rows changed from %s to %s", mi_check_print_warning(&param,"Number of rows changed from %s to %s",
......
...@@ -123,6 +123,7 @@ void reset_host_errors(struct in_addr *in) ...@@ -123,6 +123,7 @@ void reset_host_errors(struct in_addr *in)
my_string ip_to_hostname(struct in_addr *in, uint *errors) my_string ip_to_hostname(struct in_addr *in, uint *errors)
{ {
uint i;
host_entry *entry; host_entry *entry;
DBUG_ENTER("ip_to_hostname"); DBUG_ENTER("ip_to_hostname");
...@@ -222,7 +223,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) ...@@ -222,7 +223,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
} }
/* Check that 'gethostbyname' returned the used ip */ /* 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) if (*(uint32*)(check->h_addr_list)[i] == in->s_addr)
{ {
......
...@@ -76,7 +76,7 @@ static int find_uniq_filename(char *name) ...@@ -76,7 +76,7 @@ static int find_uniq_filename(char *name)
MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1), MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1),
name(0), log_type(LOG_CLOSED),write_error(0), 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 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) ...@@ -616,7 +616,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
IO_CACHE *file = (event_info->cache_stmt ? &thd->transaction.trans_log : IO_CACHE *file = (event_info->cache_stmt ? &thd->transaction.trans_log :
&log_file); &log_file);
if ((!(thd->options & OPTION_BIN_LOG) && 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)) !db_ok(event_info->db, binlog_do_db, binlog_ignore_db))
{ {
VOID(pthread_mutex_unlock(&LOCK_log)); VOID(pthread_mutex_unlock(&LOCK_log));
...@@ -684,14 +684,14 @@ bool MYSQL_LOG::write(IO_CACHE *cache) ...@@ -684,14 +684,14 @@ bool MYSQL_LOG::write(IO_CACHE *cache)
if (is_open()) if (is_open())
{ {
uint length; uint length;
my_off_t start_pos=my_b_tell(&log_file);
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
{ {
sql_print_error(ER(ER_ERROR_ON_WRITE), cache->file_name, errno); sql_print_error(ER(ER_ERROR_ON_WRITE), cache->file_name, errno);
goto err; 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)) if (my_b_write(&log_file, cache->rc_pos, length))
{ {
...@@ -700,7 +700,7 @@ bool MYSQL_LOG::write(IO_CACHE *cache) ...@@ -700,7 +700,7 @@ bool MYSQL_LOG::write(IO_CACHE *cache)
goto err; goto err;
} }
cache->rc_pos=cache->rc_end; // Mark buffer used up cache->rc_pos=cache->rc_end; // Mark buffer used up
} } while ((length=my_b_fill(cache)));
if (flush_io_cache(&log_file)) if (flush_io_cache(&log_file))
{ {
if (!write_error) if (!write_error)
......
...@@ -72,7 +72,7 @@ class Log_event ...@@ -72,7 +72,7 @@ class Log_event
static void operator delete(void *ptr, size_t size) 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); int write(IO_CACHE* file);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include <mysql.h> #include <mysql.h>
#include <myisam.h>
#include "mini_client.h" #include "mini_client.h"
#include "slave.h" #include "slave.h"
#include <thr_alarm.h> #include <thr_alarm.h>
...@@ -360,6 +361,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, ...@@ -360,6 +361,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
HA_CHECK_OPT check_opt; HA_CHECK_OPT check_opt;
check_opt.init(); check_opt.init();
check_opt.flags|= T_VERY_SILENT;
check_opt.quick = 1; check_opt.quick = 1;
thd->proc_info = "rebuilding the index on master dump table"; thd->proc_info = "rebuilding the index on master dump table";
Vio* save_vio = thd->net.vio; Vio* save_vio = thd->net.vio;
......
...@@ -60,7 +60,7 @@ class MYSQL_LOG { ...@@ -60,7 +60,7 @@ class MYSQL_LOG {
volatile enum_log_type log_type; volatile enum_log_type log_type;
char time_buff[20],db[NAME_LEN+1]; char time_buff[20],db[NAME_LEN+1];
char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN]; 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 bool no_rotate; // for binlog - if log name can never change
// we should not try to rotate it or write any rotation events // we should not try to rotate it or write any rotation events
// the user should use FLUSH MASTER instead of FLUSH LOGS for // the user should use FLUSH MASTER instead of FLUSH LOGS for
......
...@@ -1779,7 +1779,7 @@ mysql_execute_command(void) ...@@ -1779,7 +1779,7 @@ mysql_execute_command(void)
} }
else else
{ {
thd->options= ((thd->options & (ulong) (OPTION_STATUS_NO_TRANS_UPDATE)) | thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) |
OPTION_BEGIN); OPTION_BEGIN);
thd->server_status|= SERVER_STATUS_IN_TRANS; thd->server_status|= SERVER_STATUS_IN_TRANS;
send_ok(&thd->net); send_ok(&thd->net);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment