List:Internals« Previous MessageNext Message »
From:monty Date:July 26 2005 4:56pm
Subject:bk commit into 4.0 tree (monty:1.2126)
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of monty. When monty 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
  1.2126 05/07/26 17:55:58 monty@stripped +7 -0
  Review fixes:
  Fixed portability problem with bool in C programs
  Moved close_thread_tables out from LOCK_thread_count mutex (safety fix)
  my_sleep() -> pthread_cond_timedwait()

  BitKeeper/etc/ignore
    1.159 05/07/26 17:54:44 monty@stripped +1 -0
    added ac_available_languages_fragment

  sql/sql_base.cc
    1.191 05/07/26 17:53:32 monty@stripped +15 -11
    Added comments
    my_sleep() -> pthread_cond_timedwait() to get less code and potentitally faster
loop

  sql/slave.cc
    1.287 05/07/26 17:53:32 monty@stripped +1 -1
    Moved close_thread_tables out from LOCK_thread_count mutex (safety fix)

  sql/mysql_priv.h
    1.236 05/07/26 17:53:32 monty@stripped +3 -0
    Added comment

  sql/lock.cc
    1.54 05/07/26 17:53:32 monty@stripped +15 -5
    Added comment
    Don't use | on bool variable

  mysys/thr_lock.c
    1.39 05/07/26 17:53:32 monty@stripped +2 -2
    bool -> my_bool (bool is not portable in C programs)

  include/thr_lock.h
    1.14 05/07/26 17:53:32 monty@stripped +1 -1
    bool -> my_bool (bool is not portable in C programs)

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	monty
# Host:	narttu.mysql.com
# Root:	/home/my/mysql-4.0

--- 1.13/include/thr_lock.h	2005-07-19 01:29:10 +03:00
+++ 1.14/include/thr_lock.h	2005-07-26 17:53:32 +03:00
@@ -107,7 +107,7 @@
 int thr_multi_lock(THR_LOCK_DATA **data,uint count);
 void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
 void thr_abort_locks(THR_LOCK *lock);
-bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread);
+my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread);
 void thr_print_locks(void);		/* For debugging */
 my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data);
 my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data);

--- 1.38/mysys/thr_lock.c	2005-07-19 01:29:11 +03:00
+++ 1.39/mysys/thr_lock.c	2005-07-26 17:53:32 +03:00
@@ -966,10 +966,10 @@
   This is used to abort all locks for a specific thread
 */
 
-bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
+my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
 {
   THR_LOCK_DATA *data;
-  bool found= FALSE;
+  my_bool found= FALSE;
   DBUG_ENTER("thr_abort_locks_for_thread");
 
   pthread_mutex_lock(&lock->mutex);

--- 1.53/sql/lock.cc	2005-07-20 22:18:57 +03:00
+++ 1.54/sql/lock.cc	2005-07-26 17:53:32 +03:00
@@ -331,7 +331,18 @@
 }
 
 
-/* Abort one thread / table combination */
+/*
+  Abort one thread / table combination
+
+  SYNOPSIS
+    mysql_lock_abort_for_thread()
+    thd		Thread handler
+    table	Table that should be removed from lock queue
+
+  RETURN
+    0  Table was not locked by another thread
+    1  Table was locked by at least one other thread
+*/
 
 bool mysql_lock_abort_for_thread(THD *thd, TABLE *table)
 {
@@ -344,10 +355,9 @@
   {
     for (uint i=0; i < locked->lock_count; i++)
     {
-      bool found;
-      found= thr_abort_locks_for_thread(locked->locks[i]->lock,
-	         			 table->in_use->real_id);
-      result|= found;
+      if (thr_abort_locks_for_thread(locked->locks[i]->lock,
+                                     table->in_use->real_id))
+        result= TRUE;
     }
     my_free((gptr) locked,MYF(0));
   }

--- 1.235/sql/mysql_priv.h	2005-07-20 22:18:57 +03:00
+++ 1.236/sql/mysql_priv.h	2005-07-26 17:53:32 +03:00
@@ -606,12 +606,15 @@
 			    const char *table_name);
 void remove_db_from_cache(const my_string db);
 void flush_tables();
+
+/* bits for last argument to remove_table_from_cache() */
 #define RTFC_NO_FLAG                0x0000
 #define RTFC_OWNED_BY_THD_FLAG      0x0001
 #define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
 #define RTFC_CHECK_KILLED_FLAG      0x0004
 bool remove_table_from_cache(THD *thd, const char *db, const char *table,
                              uint flags);
+
 bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
 void copy_field_from_tmp_record(Field *field,int offset);
 int fill_record(List<Item> &fields,List<Item> &values, bool
ignore_errors);

--- 1.286/sql/slave.cc	2005-07-14 10:33:25 +03:00
+++ 1.287/sql/slave.cc	2005-07-26 17:53:32 +03:00
@@ -2719,9 +2719,9 @@
   mi->abort_slave = 0; // TODO: check if this is needed
   DBUG_ASSERT(thd->net.buff != 0);
   net_end(&thd->net); // destructor will not free it, because net.vio is 0
+  close_thread_tables(thd, 0);
   pthread_mutex_lock(&LOCK_thread_count);
   THD_CHECK_SENTRY(thd);
-  close_thread_tables(thd);
   delete thd;
   pthread_mutex_unlock(&LOCK_thread_count);
   pthread_cond_broadcast(&mi->stop_cond);	// tell the world we are done

--- 1.190/sql/sql_base.cc	2005-07-20 22:18:57 +03:00
+++ 1.191/sql/sql_base.cc	2005-07-26 17:53:32 +03:00
@@ -2403,8 +2403,14 @@
 
 
 /*
-** Mark all entries with the table as deleted to force an reopen of the table
-** Returns true if the table is in use by another thread
+  Mark all entries with the table as deleted to force an reopen of the table
+
+  PREREQUISITES
+    Lock on LOCK_open()
+
+  RETURN
+    0 If the table is NOT in use by another thread
+    1 If the table is NOT in use by another thread
 */
 
 bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
@@ -2416,6 +2422,7 @@
   bool result=0, signalled= 0;
   DBUG_ENTER("remove_table_from_cache");
 
+
   key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
   for (;;)
   {
@@ -2473,15 +2480,12 @@
     {
       if (!(flags & RTFC_CHECK_KILLED_FLAG) || !thd->killed)
       {
+        dropping_tables++;
         if (likely(signalled))
-        {
-          dropping_tables++;
           (void) pthread_cond_wait(&COND_refresh, &LOCK_open);
-          dropping_tables--;
-          continue;
-        }
         else
         {
+          struct timespec abstime;
           /*
             It can happen that another thread has opened the
             table but has not yet locked any table at all. Since
@@ -2492,11 +2496,11 @@
             and then we retry another loop in the
             remove_table_from_cache routine.
           */
-          pthread_mutex_unlock(&LOCK_open);
-          my_sleep(10);
-          pthread_mutex_lock(&LOCK_open);
-          continue;
+          set_timespec(abstime, 10);
+          pthread_cond_timedwait(&COND_refresh, &LOCK_open, &abstime);
         }
+        dropping_tables--;
+        continue;
       }
     }
     break;

--- 1.158/BitKeeper/etc/ignore	2004-09-05 12:27:28 +03:00
+++ 1.159/BitKeeper/etc/ignore	2005-07-26 17:54:44 +03:00
@@ -546,3 +546,4 @@
 scripts/make_win_binary_distribution
 EXCEPTIONS-CLIENT
 support-files/my-innodb-heavy-4G.cnf
+ac_available_languages_fragment
Thread
bk commit into 4.0 tree (monty:1.2126)monty26 Jul