[Commits] bzr commit into Mariadb 5.2, with Maria 2.0:maria/5.2 branch (monty:2839)

Michael Widenius monty at askmonty.org
Tue Nov 2 11:03:37 EET 2010


#At lp:maria/5.2 based on revid:igor at askmonty.org-20101030015939-swvo5gymoid0y1cl

 2839 Michael Widenius	2010-11-02
      Fixed wrong queue_replace(), which caused timeout failure in pbxt.flush_read_lock_kill
      Fixed compiler warnings.
      modified:
        include/queues.h
        mysys/queues.c
        mysys/thr_alarm.c
        sql/item_subselect.cc
        sql/sql_class.cc
        sql/sql_show.cc

per-file messages:
  include/queues.h
    Added prototype for queue_replace()
  mysys/queues.c
    Fixed wrong queue_replace()
  mysys/thr_alarm.c
    Added DBUG_PRINT
  sql/item_subselect.cc
    Check return value of ha_rnd_init().
    (Fixes compiler warnings)
  sql/sql_class.cc
    Fixed wrong test
  sql/sql_show.cc
    Removed not used variable.
=== modified file 'include/queues.h'
--- a/include/queues.h	2010-07-16 07:33:01 +0000
+++ b/include/queues.h	2010-11-02 09:03:33 +0000
@@ -51,7 +51,6 @@ typedef struct st_queue {
 #define queue_top(queue) ((queue)->root[1])
 #define queue_element(queue,index) ((queue)->root[index])
 #define queue_end(queue) ((queue)->root[(queue)->elements])
-#define queue_replace(queue, idx) _downheap(queue, idx, (queue)->root[idx])
 #define queue_replace_top(queue) _downheap(queue, 1, (queue)->root[1])
 #define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
 #define queue_set_max_at_top(queue, set_arg) \
@@ -72,6 +71,8 @@ void delete_queue(QUEUE *queue);
 void queue_insert(QUEUE *queue,uchar *element);
 int queue_insert_safe(QUEUE *queue, uchar *element);
 uchar *queue_remove(QUEUE *queue,uint idx);
+void queue_replace(QUEUE *queue,uint idx);
+
 #define queue_remove_all(queue) { (queue)->elements= 0; }
 #define queue_is_full(queue) (queue->elements == queue->max_elements)
 void _downheap(QUEUE *queue, uint idx, uchar *element);

=== modified file 'mysys/queues.c'
--- a/mysys/queues.c	2010-07-16 07:33:01 +0000
+++ b/mysys/queues.c	2010-11-02 09:03:33 +0000
@@ -280,6 +280,9 @@ uchar *queue_remove(register QUEUE *queu
     queue	Queue to use
     idx         Index of element to change
     element     Element to store at 'idx'
+
+  NOTE
+    This only works if element is >= all elements <= start_idx
 */
 
 void _downheap(register QUEUE *queue, uint start_idx, uchar *element)
@@ -353,3 +356,22 @@ void queue_fix(QUEUE *queue)
   for (i= queue->elements >> 1; i > 0; i--)
     _downheap(queue, i, queue_element(queue, i));
 }
+
+
+/*
+  Change element at fixed position
+
+  SYNOPSIS
+    queue_replace()
+    queue	Queue to use
+    idx         Index of element to change
+    element     Element to store at 'idx'
+*/
+
+void queue_replace(QUEUE *queue, uint idx)
+{
+  uchar *element= queue->root[idx];
+  DBUG_ASSERT(idx >= 1 && idx <= queue->elements);
+  queue_remove(queue, idx);
+  queue_insert(queue, element);
+}

=== modified file 'mysys/thr_alarm.c'
--- a/mysys/thr_alarm.c	2010-10-10 14:18:11 +0000
+++ b/mysys/thr_alarm.c	2010-11-02 09:03:33 +0000
@@ -465,6 +465,8 @@ void end_thr_alarm(my_bool free_structur
 void thr_alarm_kill(my_thread_id thread_id)
 {
   uint i;
+  DBUG_ENTER("thr_alarm_kill");
+
   if (alarm_aborted)
     return;
   pthread_mutex_lock(&LOCK_alarm);
@@ -475,6 +477,7 @@ void thr_alarm_kill(my_thread_id thread_
     ALARM *element= (ALARM*) queue_element(&alarm_queue,i);
     if (element->thread_id == thread_id)
     {
+      DBUG_PRINT("info", ("found thread; Killing it"));
       element->expire_time= 0;
       queue_replace(&alarm_queue, i);
       reschedule_alarms();
@@ -482,6 +485,7 @@ void thr_alarm_kill(my_thread_id thread_
     }
   }
   pthread_mutex_unlock(&LOCK_alarm);
+  DBUG_VOID_RETURN;
 }
 
 

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2010-10-27 13:28:19 +0000
+++ b/sql/item_subselect.cc	2010-11-02 09:03:33 +0000
@@ -4827,7 +4827,8 @@ subselect_rowid_merge_engine::init(MY_BI
   DBUG_ASSERT(cur_keyid == keys_count);
 
   /* Populate the indexes with data from the temporary table. */
-  tmp_table->file->ha_rnd_init(1);
+  if (tmp_table->file->ha_rnd_init_with_error(1))
+    return TRUE;
   tmp_table->file->extra_opt(HA_EXTRA_CACHE,
                              current_thd->variables.read_buff_size);
   tmp_table->null_row= 0;
@@ -5008,7 +5009,11 @@ bool subselect_rowid_merge_engine::parti
   DBUG_ASSERT(!pq.elements);
 
   /* All data accesses during execution are via handler::ha_rnd_pos() */
-  tmp_table->file->ha_rnd_init(0);
+  if (tmp_table->file->ha_rnd_init_with_error(0))
+  {
+    res= FALSE;
+    goto end;
+  }
 
   /* Check if there is a match for the columns of the only non-NULL key. */
   if (non_null_key && !non_null_key->lookup())
@@ -5175,7 +5180,12 @@ bool subselect_table_scan_engine::partia
   int error;
   bool res;
 
-  tmp_table->file->ha_rnd_init(1);
+  if (tmp_table->file->ha_rnd_init_with_error(1))
+  {
+    res= FALSE;
+    goto end;
+  }
+
   tmp_table->file->extra_opt(HA_EXTRA_CACHE,
                              current_thd->variables.read_buff_size);
   /*

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-10-10 14:18:11 +0000
+++ b/sql/sql_class.cc	2010-11-02 09:03:33 +0000
@@ -3017,7 +3017,7 @@ create_result_table(THD *thd_arg, List<I
 
   col_stat= (Column_statistics*) table->in_use->alloc(table->s->fields *
                                                       sizeof(Column_statistics));
-  if (!stat)
+  if (!col_stat)
     return TRUE;
 
   reset();

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-10-28 17:04:23 +0000
+++ b/sql/sql_show.cc	2010-11-02 09:03:33 +0000
@@ -4103,7 +4103,7 @@ static int get_schema_tables_record(THD
   }
   else
   {
-    char option_buff[350],*ptr;
+    char option_buff[350];
     String str(option_buff,sizeof(option_buff), system_charset_info);
     TABLE *show_table= tables->table;
     TABLE_SHARE *share= show_table->s;



More information about the commits mailing list