Commit 815b9fed authored by Michael Widenius's avatar Michael Widenius

Safety change to ensure read/black trees (used with heap tables) works on 64...

Safety change to ensure read/black trees (used with heap tables) works on 64 bit setups where ulong <> size_t
Don't retry test cases by default
Fixed bug where we could (under unlikely error conditions) access not initialized variable

include/my_tree.h:
  Safety change to ensure read/black trees (used with heap tables) works on 64 bit setups where ulong <> size_t
  (Pointed out by Bryan Aker)
mysql-test/mysql-test-run.pl:
  Don't retry test cases by default
  This makes it too easy to miss failures and we have anyway to fix race conditions, not ignore them.
mysys/tree.c:
  Safety change to ensure read/black trees (used with heap tables) works on 64 bit setups where ulong <> size_t
sql/sql_delete.cc:
  Fixed bug where we could (under unlikely error conditions) access not initialized variable.
  (Pointed out by Bryan Aker)
parent 9dfe197d
...@@ -51,7 +51,7 @@ typedef struct st_tree { ...@@ -51,7 +51,7 @@ typedef struct st_tree {
TREE_ELEMENT *root,null_element; TREE_ELEMENT *root,null_element;
TREE_ELEMENT **parents[MAX_TREE_HEIGHT]; TREE_ELEMENT **parents[MAX_TREE_HEIGHT];
uint offset_to_key,elements_in_tree,size_of_element; uint offset_to_key,elements_in_tree,size_of_element;
ulong memory_limit, allocated; size_t memory_limit, allocated;
qsort_cmp2 compare; qsort_cmp2 compare;
void *custom_arg; void *custom_arg;
MEM_ROOT mem_root; MEM_ROOT mem_root;
...@@ -61,7 +61,7 @@ typedef struct st_tree { ...@@ -61,7 +61,7 @@ typedef struct st_tree {
} TREE; } TREE;
/* Functions on whole tree */ /* Functions on whole tree */
void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit, void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit,
int size, qsort_cmp2 compare, my_bool with_delete, int size, qsort_cmp2 compare, my_bool with_delete,
tree_element_free free_element, void *custom_arg); tree_element_free free_element, void *custom_arg);
void delete_tree(TREE*); void delete_tree(TREE*);
......
...@@ -218,7 +218,7 @@ my $opt_start; ...@@ -218,7 +218,7 @@ my $opt_start;
my $opt_start_dirty; my $opt_start_dirty;
my $opt_wait_all; my $opt_wait_all;
my $opt_repeat= 1; my $opt_repeat= 1;
my $opt_retry= 3; my $opt_retry= 1;
my $opt_retry_failure= 2; my $opt_retry_failure= 2;
my $opt_strace_client; my $opt_strace_client;
......
...@@ -77,13 +77,13 @@ static void rb_insert(TREE *tree,TREE_ELEMENT ***parent, ...@@ -77,13 +77,13 @@ static void rb_insert(TREE *tree,TREE_ELEMENT ***parent,
static void rb_delete_fixup(TREE *tree,TREE_ELEMENT ***parent); static void rb_delete_fixup(TREE *tree,TREE_ELEMENT ***parent);
/* The actuall code for handling binary trees */ /* The actual code for handling binary trees */
#ifndef DBUG_OFF #ifndef DBUG_OFF
static int test_rb_tree(TREE_ELEMENT *element); static int test_rb_tree(TREE_ELEMENT *element);
#endif #endif
void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit, void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit,
int size, qsort_cmp2 compare, my_bool with_delete, int size, qsort_cmp2 compare, my_bool with_delete,
tree_element_free free_element, void *custom_arg) tree_element_free free_element, void *custom_arg)
{ {
...@@ -96,7 +96,7 @@ void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit, ...@@ -96,7 +96,7 @@ void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
bzero((uchar*) &tree->null_element,sizeof(tree->null_element)); bzero((uchar*) &tree->null_element,sizeof(tree->null_element));
tree->root= &tree->null_element; tree->root= &tree->null_element;
tree->compare=compare; tree->compare=compare;
tree->size_of_element=size > 0 ? (uint) size : 0; tree->size_of_element= size > 0 ? (uint) size : 0;
tree->memory_limit=memory_limit; tree->memory_limit=memory_limit;
tree->free=free_element; tree->free=free_element;
tree->allocated=0; tree->allocated=0;
...@@ -127,7 +127,7 @@ void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit, ...@@ -127,7 +127,7 @@ void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
} }
if (!(tree->with_delete=with_delete)) if (!(tree->with_delete=with_delete))
{ {
init_alloc_root(&tree->mem_root, (uint) default_alloc_size, 0); init_alloc_root(&tree->mem_root, default_alloc_size, 0);
tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element); tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -1073,8 +1073,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) ...@@ -1073,8 +1073,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
/* If it is a temporary table, close and regenerate it */ /* If it is a temporary table, close and regenerate it */
if (!dont_send_ok && (table= find_temporary_table(thd, table_list))) if (!dont_send_ok && (table= find_temporary_table(thd, table_list)))
{ {
handlerton *table_type= table->s->db_type();
TABLE_SHARE *share= table->s; TABLE_SHARE *share= table->s;
handlerton *table_type= share->db_type();
if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE)) if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE))
goto trunc_by_del; goto trunc_by_del;
...@@ -1088,7 +1088,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) ...@@ -1088,7 +1088,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
if ((error= (int) !(open_temporary_table(thd, share->path.str, if ((error= (int) !(open_temporary_table(thd, share->path.str,
share->db.str, share->db.str,
share->table_name.str, 1)))) share->table_name.str, 1))))
(void) rm_temporary_table(table_type, path); (void) rm_temporary_table(table_type, share->path.str);
else else
thd->thread_specific_used= TRUE; thd->thread_specific_used= TRUE;
......
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