Commit d6bc5fb2 authored by unknown's avatar unknown

Fixed bug when creating keys in temporary HEAP tables.

(This caused the DISTINCT test to fail)
Removed one inline as this caused compiler problems


heap/hp_create.c:
  Comment
heap/hp_update.c:
  Indentation cleanup
heap/hp_write.c:
  Indentation cleanup
mysql-test/mysql-test-run.sh:
  Better options for valgrind
sql/item_sum.cc:
  Removed inline as this caused compiler problems with gcc 3.2
  (Was also non standard usage of inline)
sql/item_sum.h:
  Removed inline as this caused compiler problems with gcc 3.2
sql/sql_class.cc:
  Fixed reference to uninitialized value
sql/sql_lex.cc:
  Indentation cleanup
sql/sql_select.cc:
  Fixed bug when creating keys in temporary HEAP tables.
parent 0bb120c4
......@@ -140,6 +140,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
share->auto_key= create_info->auto_key;
share->auto_key_type= create_info->auto_key_type;
share->auto_increment= create_info->auto_increment;
/* Must be allocated separately for rename to work */
if (!(share->name= my_strdup(name,MYF(0))))
{
my_free((gptr) share,MYF(0));
......
......@@ -62,7 +62,8 @@ int heap_update(HP_INFO *info, const byte *old, const byte *heap_new)
/* we don't need to delete non-inserted key from rb-tree */
if ((*keydef->write_key)(info, keydef, old, pos))
{
if (++(share->records) == share->blength) share->blength+= share->blength;
if (++(share->records) == share->blength)
share->blength+= share->blength;
DBUG_RETURN(my_errno);
}
keydef--;
......@@ -78,6 +79,7 @@ int heap_update(HP_INFO *info, const byte *old, const byte *heap_new)
keydef--;
}
}
if (++(share->records) == share->blength) share->blength+= share->blength;
if (++(share->records) == share->blength)
share->blength+= share->blength;
DBUG_RETURN(my_errno);
} /* heap_update */
......@@ -19,7 +19,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
# Program Definitions
#--
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH
MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
# Standard functions
......@@ -319,8 +319,8 @@ while test $# -gt 0; do
VALGRIND="valgrind --alignment=8 --leak-check=yes"
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
SLEEP_TIME_AFTER_RESTART=120
SLEEP_TIME_FOR_DELETE=120
SLEEP_TIME_AFTER_RESTART=60
SLEEP_TIME_FOR_DELETE=60
;;
--valgrind-options=*)
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
......
......@@ -41,7 +41,7 @@ Item_sum::Item_sum(List<Item> &list)
list.empty(); // Fields are used
}
inline void Item_sum::mark_as_sum_func()
void Item_sum::mark_as_sum_func()
{
current_thd->lex.current_select->with_sum_func= with_sum_func= 1;
}
......
......@@ -34,7 +34,7 @@ class Item_sum :public Item_result_field
uint arg_count;
bool quick_group; /* If incremental update of fields */
inline void mark_as_sum_func();
void mark_as_sum_func();
Item_sum() : arg_count(0),quick_group(1)
{
mark_as_sum_func();
......
......@@ -142,8 +142,6 @@ THD::THD():user_time(0), fatal_error(0),
bzero((char*) &con_root,sizeof(con_root));
bzero((char*) &warn_root,sizeof(warn_root));
init_alloc_root(&warn_root, 1024, 0);
bzero((char*) warn_count, sizeof(warn_count));
warn_list.empty();
user_connect=(USER_CONN *)0;
hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
(hash_get_key) get_var_key,
......@@ -187,17 +185,20 @@ THD::THD():user_time(0), fatal_error(0),
void THD::init(void)
{
pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables;
pthread_mutex_unlock(&LOCK_global_system_variables);
server_status= SERVER_STATUS_AUTOCOMMIT;
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
TL_WRITE);
options= thd_startup_options;
sql_mode=(uint) opt_sql_mode;
open_options=ha_open_options;
pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables;
pthread_mutex_unlock(&LOCK_global_system_variables);
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
TL_WRITE);
session_tx_isolation= (enum_tx_isolation) variables.tx_isolation;
warn_list.empty();
bzero((char*) warn_count, sizeof(warn_count));
total_warn_count= 0;
}
/*
......@@ -228,6 +229,7 @@ void THD::cleanup(void)
{
DBUG_ENTER("THD::cleanup");
ha_rollback(this);
delete_tree(&prepared_statements);
if (locked_tables)
{
lock=locked_tables; locked_tables=0;
......@@ -289,7 +291,6 @@ THD::~THD()
free_root(&con_root,MYF(0));
free_root(&warn_root,MYF(0));
free_root(&transaction.mem_root,MYF(0));
delete_tree(&prepared_statements);
mysys_var=0; // Safety (shouldn't be needed)
pthread_mutex_destroy(&LOCK_delete);
#ifndef DBUG_OFF
......
......@@ -458,7 +458,7 @@ int yylex(void *arg, void *yythd)
LINT_INIT(c);
for (;;)
{
switch(state) {
switch (state) {
case STATE_OPERATOR_OR_IDENT: // Next is operator or keyword
case STATE_START: // Start of token
// Skip startspace
......@@ -900,7 +900,8 @@ int yylex(void *arg, void *yythd)
return((int) '@');
case STATE_HOSTNAME: // end '@' of user@hostname
for (c=yyGet() ;
my_isalnum(system_charset_info,c) || c == '.' || c == '_' || c == '$';
my_isalnum(system_charset_info,c) || c == '.' || c == '_' ||
c == '$';
c= yyGet()) ;
yylval->lex_str=get_token(lex,yyLength());
return(LEX_HOSTNAME);
......
......@@ -4115,6 +4115,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->usable_key_parts=keyinfo->key_parts= param->group_parts;
keyinfo->key_length=0;
keyinfo->rec_per_key=0;
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
for (; group ; group=group->next,key_part_info++)
{
Field *field=(*group->item)->tmp_table_field();
......@@ -4191,6 +4192,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->flags=HA_NOSAME | HA_NULL_ARE_EQUAL;
keyinfo->key_length=(uint16) reclength;
keyinfo->name=(char*) "tmp";
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
if (null_pack_length)
{
key_part_info->null_bit=0;
......
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