MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kgeorge Date:June 11 2007 11:45am
Subject:bk commit into 5.0 tree (gkodinov:1.2529) BUG#28992
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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-06-11 14:45:14+03:00, gkodinov@stripped +3 -0
  Bug #28992: trigger fails in pushbuild
   - fixed wrong test case for bug 20903
   - closed the dangling connections in trigger.test
   - GET_LOCK() and RELEASE_LOCK() now produce more detailed log
   - fixed an omission in GET_LOCK() : assign the thread_id when
      acquiring the lock.

  mysql-test/r/trigger.result@stripped, 2007-06-11 14:45:12+03:00, gkodinov@stripped +9 -6
    Bug #28992: test case updated

  mysql-test/t/trigger.test@stripped, 2007-06-11 14:45:12+03:00, gkodinov@stripped +12 -5
    Bug #28992: test case updated. dangling connections closed.

  sql/item_func.cc@stripped, 2007-06-11 14:45:12+03:00, gkodinov@stripped +28 -13
    Bug #28992: 
     - GET_LOCK() and RELEASE_LOCK() now produce more detailed log
     - fixed an omission in GET_LOCK() : assign the thread_id when
        acquiring the lock.

# 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:	gkodinov
# Host:	magare.gmz
# Root:	/home/kgeorge/mysql/work/B28992-5.0-opt

--- 1.347/sql/item_func.cc	2007-06-03 14:21:53 +03:00
+++ 1.348/sql/item_func.cc	2007-06-11 14:45:12 +03:00
@@ -3449,6 +3449,7 @@ longlong Item_func_get_lock::val_int()
   THD *thd=current_thd;
   User_level_lock *ull;
   int error;
+  DBUG_ENTER("Item_func_get_lock::val_int");
 
   /*
     In slave thread no need to get locks, everything is serialized. Anyway
@@ -3458,7 +3459,7 @@ longlong Item_func_get_lock::val_int()
     it's not guaranteed to be same as on master.
   */
   if (thd->slave_thread)
-    return 1;
+    DBUG_RETURN(1);
 
   pthread_mutex_lock(&LOCK_user_locks);
 
@@ -3466,8 +3467,10 @@ longlong Item_func_get_lock::val_int()
   {
     pthread_mutex_unlock(&LOCK_user_locks);
     null_value=1;
-    return 0;
+    DBUG_RETURN(0);
   }
+  DBUG_PRINT("info", ("lock %.*s, thd=%ld", res->length(), res->ptr(),
+                      (long) thd->real_id));
   null_value=0;
 
   if (thd->ull)
@@ -3486,14 +3489,17 @@ longlong Item_func_get_lock::val_int()
       delete ull;
       pthread_mutex_unlock(&LOCK_user_locks);
       null_value=1;				// Probably out of memory
-      return 0;
+      DBUG_RETURN(0);
     }
     ull->thread=thd->real_id;
+    ull->thread_id=thd->thread_id;
     thd->ull=ull;
     pthread_mutex_unlock(&LOCK_user_locks);
-    return 1;					// Got new lock
+    DBUG_PRINT("info", ("made new lock"));
+    DBUG_RETURN(1);				// Got new lock
   }
   ull->count++;
+  DBUG_PRINT("info", ("ull->count=%d", ull->count));
 
   /*
     Structure is now initialized.  Try to get the lock.
@@ -3507,9 +3513,13 @@ longlong Item_func_get_lock::val_int()
   error= 0;
   while (ull->locked && !thd->killed)
   {
+    DBUG_PRINT("info", ("waiting on lock"));
     error= pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime);
     if (error == ETIMEDOUT || error == ETIME)
+    {
+      DBUG_PRINT("info", ("lock wait timeout"));
       break;
+    }
     error= 0;
   }
 
@@ -3533,6 +3543,7 @@ longlong Item_func_get_lock::val_int()
     ull->thread_id= thd->thread_id;
     thd->ull=ull;
     error=0;
+    DBUG_PRINT("info", ("got the lock"));
   }
   pthread_mutex_unlock(&LOCK_user_locks);
 
@@ -3542,7 +3553,7 @@ longlong Item_func_get_lock::val_int()
   thd->mysys_var->current_cond=  0;
   pthread_mutex_unlock(&thd->mysys_var->mutex);
 
-  return !error ? 1 : 0;
+  DBUG_RETURN(!error ? 1 : 0);
 }
 
 
@@ -3560,11 +3571,14 @@ longlong Item_func_release_lock::val_int
   String *res=args[0]->val_str(&value);
   User_level_lock *ull;
   longlong result;
+  THD *thd=current_thd;
+  DBUG_ENTER("Item_func_release_lock::val_int");
   if (!res || !res->length())
   {
     null_value=1;
-    return 0;
+    DBUG_RETURN(0);
   }
+  DBUG_PRINT("info", ("lock %.*s", res->length(), res->ptr()));
   null_value=0;
 
   result=0;
@@ -3577,19 +3591,20 @@ longlong Item_func_release_lock::val_int
   }
   else
   {
-#ifdef EMBEDDED_LIBRARY
-    if (ull->locked && pthread_equal(current_thd->real_id,ull->thread))
-#else
-    if (ull->locked && pthread_equal(pthread_self(),ull->thread))
-#endif
+    DBUG_PRINT("info", ("ull->locked=%d ull->thread=%ld thd=%ld", 
+                        (int) ull->locked,
+                        (long)ull->thread,
+                        (long)thd->real_id));
+    if (ull->locked && pthread_equal(thd->real_id,ull->thread))
     {
+      DBUG_PRINT("info", ("release lock"));
       result=1;					// Release is ok
       item_user_lock_release(ull);
-      current_thd->ull=0;
+      thd->ull=0;
     }
   }
   pthread_mutex_unlock(&LOCK_user_locks);
-  return result;
+  DBUG_RETURN(result);
 }
 
 

--- 1.60/mysql-test/r/trigger.result	2007-06-03 10:03:10 +03:00
+++ 1.61/mysql-test/r/trigger.result	2007-06-11 14:45:12 +03:00
@@ -1454,19 +1454,22 @@ CREATE TABLE t2 (id INTEGER);
 INSERT INTO t2 VALUES (1),(2);
 CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW 
 INSERT INTO t2 VALUES (new.id);
-SELECT GET_LOCK('B26162',20);
-GET_LOCK('B26162',20)
+SELECT GET_LOCK('B26162',120);
+GET_LOCK('B26162',120)
 1
-SELECT 'rl_acquirer', GET_LOCK('B26162',5), id FROM t2 WHERE id = 1;
+SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
 SET SESSION LOW_PRIORITY_UPDATES=1;
 SET GLOBAL LOW_PRIORITY_UPDATES=1;
 INSERT INTO t1 VALUES (5);
 SELECT 'rl_contender', id FROM t2 WHERE id > 1;
 SELECT RELEASE_LOCK('B26162');
 RELEASE_LOCK('B26162')
-0
-rl_acquirer	GET_LOCK('B26162',5)	id
-rl_acquirer	0	1
+1
+rl_acquirer	GET_LOCK('B26162',120)	id
+rl_acquirer	1	1
+SELECT RELEASE_LOCK('B26162');
+RELEASE_LOCK('B26162')
+1
 rl_contender	id
 rl_contender	2
 DROP TRIGGER t1_test;

--- 1.67/mysql-test/t/trigger.test	2007-06-03 10:03:11 +03:00
+++ 1.68/mysql-test/t/trigger.test	2007-06-11 14:45:12 +03:00
@@ -1763,6 +1763,9 @@ select * from t1;
 select * from t3;
 drop table t1, t2, t3;
 
+disconnect addconroot1;
+disconnect addconroot2;
+disconnect addconwithoutdb;
 #
 # Bug #26162: Trigger DML ignores low_priority_updates setting
 #
@@ -1776,15 +1779,17 @@ INSERT INTO t2 VALUES (1),(2);
 CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW 
   INSERT INTO t2 VALUES (new.id);
 
+CONNECT (rl_holder,    localhost, root,,);
 CONNECT (rl_acquirer,  localhost, root,,);
 CONNECT (wl_acquirer,  localhost, root,,);
 CONNECT (rl_contender, localhost, root,,);
 
-SELECT GET_LOCK('B26162',20);
+CONNECTION rl_holder;
+SELECT GET_LOCK('B26162',120);
 
 CONNECTION rl_acquirer;
 --send
-SELECT 'rl_acquirer', GET_LOCK('B26162',5), id FROM t2 WHERE id = 1;
+SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
 
 CONNECTION wl_acquirer;
 SET SESSION LOW_PRIORITY_UPDATES=1;
@@ -1798,13 +1803,14 @@ CONNECTION rl_contender;
 --send
 SELECT 'rl_contender', id FROM t2 WHERE id > 1;
 
-CONNECTION default;
+CONNECTION rl_holder;
 SELECT RELEASE_LOCK('B26162');
 
-CONNECTION wl_acquirer;
---reap
 CONNECTION rl_acquirer;
 --reap
+SELECT RELEASE_LOCK('B26162');
+CONNECTION wl_acquirer;
+--reap
 CONNECTION rl_contender;
 --reap
 
@@ -1812,6 +1818,7 @@ CONNECTION default;
 DISCONNECT rl_acquirer;
 DISCONNECT wl_acquirer;
 DISCONNECT rl_contender;
+DISCONNECT rl_holder;
 
 DROP TRIGGER t1_test;
 DROP TABLE t1,t2;
Thread
bk commit into 5.0 tree (gkodinov:1.2529) BUG#28992kgeorge11 Jun