List:Commits« Previous MessageNext Message »
From:cbell Date:December 6 2007 5:36pm
Subject:bk commit into 6.0 tree (cbell:1.2716)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of cbell. When cbell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-12-06 11:35:42-05:00, cbell@mysql_cab_desk. +2 -0
  Fix valgrind errors in mysql-6.0-rpl-merge
  
  This patch corrects a valgrind error on the tables attribute and
  corrects a valgrind error on the tables_in_backup attribute. Also 
  fixes a valgrind memory issue found with locking_thd structure.

  sql/backup/backup_progress.cc@stripped, 2007-12-06 11:35:37-05:00, cbell@mysql_cab_desk. +57
-21
    Fix valgrind errors in mysql-6.0-rpl-merge
    
    This patch corrects a valgrind error on the tables attribute.
    Also fixes a valgrind memory issue found with locking_thd structure.

  sql/backup/be_thread.cc@stripped, 2007-12-06 11:35:37-05:00, cbell@mysql_cab_desk. +1 -0
    Fix valgrind errors in mysql-6.0-rpl-merge
    
    This patch corrects a valgrind error on the tables_in_backup attribute.

diff -Nrup a/sql/backup/backup_progress.cc b/sql/backup/backup_progress.cc
--- a/sql/backup/backup_progress.cc	2007-12-03 15:28:11 -05:00
+++ b/sql/backup/backup_progress.cc	2007-12-06 11:35:37 -05:00
@@ -51,8 +51,6 @@ Locking_thread_st *open_backup_progress_
 
   DBUG_ENTER("open_backup_progress_table()");
 
-  tables.init_one_table("mysql", table_name, lock);
-
   /*
     The locking thread will, via open_table(), fail if the table does not
     exist.
@@ -64,7 +62,10 @@ Locking_thread_st *open_backup_progress_
   locking_thd= new Locking_thread_st();
   if (locking_thd == NULL)
     DBUG_RETURN(locking_thd);    
-  locking_thd->tables_in_backup= &tables;
+
+  locking_thd->tables_in_backup= (TABLE_LIST*)my_malloc(sizeof(TABLE_LIST),
MYF(MY_WME));
+  locking_thd->tables_in_backup->init_one_table("mysql", table_name, lock);
+
 
   /*
     Start the locking thread and wait until it is ready.
@@ -86,6 +87,41 @@ Locking_thread_st *open_backup_progress_
 }
 
 /**
+   Close backup progress table.
+
+   This method closes the online backup table specified. It uses the locking
+   thread mechanism in be_thread.cc to close the table in a separate thread.
+
+   @param Locking_thread_st *locking_thd  The locking thread.
+
+   @returns 0 = success
+   @returns 1 = failed to close table
+
+   @todo : Replace poling loop with signal.
+  */
+int close_backup_progress_table(Locking_thread_st *locking_thd)
+{
+  DBUG_ENTER("close_backup_progress_table()");
+
+  /*
+    Tell locking thread to die.
+  */
+  locking_thd->kill_locking_thread();
+
+  /*
+    Poll the locking thread until ready.
+  */
+  while (locking_thd && (locking_thd->lock_state != LOCK_DONE) &&
+         (locking_thd->lock_state != LOCK_ERROR))
+    sleep(0);
+  if (locking_thd->lock_state == LOCK_ERROR)
+    DBUG_RETURN(1);
+  delete locking_thd;
+  locking_thd= NULL;
+  DBUG_RETURN(0);
+}
+
+/**
    Find the row in the table that matches the backup_id.
 
    This method locates the row in the online backup table that matches the
@@ -192,7 +228,7 @@ int update_online_backup_int_field(ulong
   locking_thd= open_backup_progress_table(table_name, TL_WRITE);
   if (!locking_thd)
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(0);
   }
 
@@ -201,7 +237,7 @@ int update_online_backup_int_field(ulong
 
   if (find_online_backup_row(table, backup_id))
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(1);
   }
 
@@ -219,7 +255,7 @@ int update_online_backup_int_field(ulong
   if ((ret= table->file->ha_update_row(table->record[1], table->record[0])))
     table->file->print_error(ret, MYF(0));
 
-  locking_thd->kill_locking_thread();
+  ret= close_backup_progress_table(locking_thd);
   DBUG_RETURN(ret);
 }
 
@@ -252,7 +288,7 @@ int update_online_backup_datetime_field(
   locking_thd= open_backup_progress_table(table_name, TL_WRITE);
   if (!locking_thd)
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(0);
   }
 
@@ -261,7 +297,7 @@ int update_online_backup_datetime_field(
 
   if (find_online_backup_row(table, backup_id))
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(1);
   }
 
@@ -285,7 +321,7 @@ int update_online_backup_datetime_field(
   if ((ret= table->file->ha_update_row(table->record[1], table->record[0])))
     table->file->print_error(ret, MYF(0));
 
-  locking_thd->kill_locking_thread();
+  ret= close_backup_progress_table(locking_thd);
   DBUG_RETURN(ret);
 }
 
@@ -327,7 +363,7 @@ ulonglong report_ob_init(int process_id,
   locking_thd= open_backup_progress_table("online_backup", TL_WRITE);
   if (!locking_thd)
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(0);
   }
 
@@ -411,7 +447,7 @@ ulonglong report_ob_init(int process_id,
 
 end:
 
-  locking_thd->kill_locking_thread();
+  ret= close_backup_progress_table(locking_thd);
   /*
     Record progress update.
   */
@@ -449,7 +485,7 @@ int report_ob_binlog_info(ulonglong back
   locking_thd= open_backup_progress_table("online_backup", TL_WRITE);
   if (!locking_thd)
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(0);
   }
 
@@ -458,7 +494,7 @@ int report_ob_binlog_info(ulonglong back
 
   if (find_online_backup_row(table, backup_id))
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(1);
   }
 
@@ -490,7 +526,7 @@ int report_ob_binlog_info(ulonglong back
 
 end:
 
-  locking_thd->kill_locking_thread();
+  ret= close_backup_progress_table(locking_thd);
   DBUG_RETURN(ret);
 }
 
@@ -643,7 +679,7 @@ int report_ob_engines(ulonglong backup_i
   locking_thd= open_backup_progress_table("online_backup", TL_WRITE);
   if (!locking_thd)
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(0);
   }
 
@@ -652,7 +688,7 @@ int report_ob_engines(ulonglong backup_i
 
   if (find_online_backup_row(table, backup_id))
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(1);
   }
 
@@ -686,7 +722,7 @@ int report_ob_engines(ulonglong backup_i
 
 end:
 
-  locking_thd->kill_locking_thread();
+  ret= close_backup_progress_table(locking_thd);
   DBUG_RETURN(ret);
 }
 
@@ -759,7 +795,7 @@ int report_ob_progress(ulonglong backup_
   locking_thd= open_backup_progress_table("online_backup_progress", TL_WRITE);
   if (!locking_thd)
   {
-    locking_thd->kill_locking_thread();
+    ret= close_backup_progress_table(locking_thd);
     DBUG_RETURN(0);
   }
 
@@ -830,7 +866,7 @@ int report_ob_progress(ulonglong backup_
 
 end:
 
-  locking_thd->kill_locking_thread();
+  ret= close_backup_progress_table(locking_thd);
   DBUG_RETURN(ret);
 }
 
@@ -858,7 +894,7 @@ ulonglong sum_progress_rows(ulonglong ba
   locking_thd= open_backup_progress_table("online_backup_progress", TL_READ);
   if (!locking_thd)
   {
-    locking_thd->kill_locking_thread();
+    close_backup_progress_table(locking_thd);
     DBUG_RETURN(0);
   }
 
@@ -878,7 +914,7 @@ ulonglong sum_progress_rows(ulonglong ba
 
   hdl->ha_rnd_end();
 
-  locking_thd->kill_locking_thread();
+  close_backup_progress_table(locking_thd);
   DBUG_RETURN(size);
 }
 
diff -Nrup a/sql/backup/be_thread.cc b/sql/backup/be_thread.cc
--- a/sql/backup/be_thread.cc	2007-12-04 12:38:06 -05:00
+++ b/sql/backup/be_thread.cc	2007-12-06 11:35:37 -05:00
@@ -245,6 +245,7 @@ Locking_thread_st::~Locking_thread_st()
   pthread_cond_destroy(&COND_thread_wait);
   pthread_mutex_destroy(&THR_LOCK_caller);
   pthread_cond_destroy(&COND_caller_wait);
+  my_free(tables_in_backup, MYF(0)); 
 }
 
 /**

Thread
bk commit into 6.0 tree (cbell:1.2716)cbell6 Dec