Commit 10693572 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

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
parent 60dc7eab
......@@ -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
......@@ -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;
@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
......@@ -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 */
......
......@@ -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
}
......
......@@ -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,8 +103,8 @@ 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)))
if (!(length= my_b_bytes_in_cache(info)) &&
!(length= my_b_fill(info)))
return 0;
for (;;)
{
......
......@@ -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)
......
......@@ -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,
......
......@@ -563,7 +563,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, 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(&param,"Number of rows changed from %s to %s",
......
......@@ -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)
{
......
......@@ -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)
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
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