List:Commits« Previous MessageNext Message »
From:klewis Date:January 9 2008 5:40am
Subject:bk commit into 6.0 tree (klewis:1.2780) BUG#33480
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of . When  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, 2008-01-08 23:40:07-06:00, klewis@klewis-mysql. +2 -0
  Bug#33480 - Two kinds of hangs / deadlocks are fixed here.
  
  1) In ha_partition.cc, prevent serialization into Falcon of 
  threads writing to autoincrement fields.  Only InnoDB needs 
  this.  It can cause deadlocks and timeouts in Falcon which 
  appear as 0% CPU utilization when all threads are hung.  
  When this happens for just a few threads, the serial log 
  can grow indefinitely.
  
  2) If a deadlock happens between threads which are checking 
  for duplicates, the code in Table::checkUniqueRecordVersion()
  was not handling the detected deadlock by throwing an exception.  
  Now it does.  This can cause 100% CPU utilization hangs between 
  threads.  One is waiting and the other is looping in 
  Table::checkUnigueIndexes().  This can also cause the serial log
  to grow indefinitely.

  sql/ha_partition.cc@stripped, 2008-01-08 23:39:40-06:00, klewis@klewis-mysql. +1 -1
    Bug#33480 - Prevent serialization into Falcon of threads writing 
    to autoincrement fields.  Only InnoDB needs this.  It can cause 
    deadlocks and timeouts in Falcon which appear as 0% CPU utilization
    when all threads are hung.  When this happens for just a few threads,
    the serial log can grow indefinitely

  storage/falcon/Table.cpp@stripped, 2008-01-08 23:39:45-06:00, klewis@klewis-mysql. +23 -15
    Bug#33480 - If a deadlock happens between threads which are checking 
    for duplicates, the code was not handling the detected deadlock by
    throwing an exception.  Now it does.  This can cause 100% CPU utilization
    hangs between threads.  One is waiting and the other is looping in 
    Table::checkUnigueIndexes().  This can also cause the serial log to 
    grow indefinitely.

diff -Nrup a/sql/ha_partition.cc b/sql/ha_partition.cc
--- a/sql/ha_partition.cc	2007-12-05 12:43:04 -06:00
+++ b/sql/ha_partition.cc	2008-01-08 23:39:40 -06:00
@@ -2715,7 +2715,7 @@ int ha_partition::write_row(uchar * buf)
       use autoincrement_lock variable to avoid unnecessary locks.
       Probably not an ideal solution.
     */
-    if (table_share->tmp_table == NO_TMP_TABLE)
+    if (table_share->tmp_table == NO_TMP_TABLE && m_innodb)
     {
       /*
         Bug#30878 crash when alter table from non partitioned table
diff -Nrup a/storage/falcon/Table.cpp b/storage/falcon/Table.cpp
--- a/storage/falcon/Table.cpp	2007-12-04 20:46:37 -06:00
+++ b/storage/falcon/Table.cpp	2008-01-08 23:39:45 -06:00
@@ -2459,33 +2459,41 @@ int Table::checkUniqueRecordVersion(int3
 
 				if (sync)
 					sync->unlock();
-					
-				state = transaction->getRelativeState(dup, WAIT_IF_ACTIVE);
-				rec->release();
 				
-				if (activeTransaction)
-					activeTransaction->release();
-				
-				return checkUniqueWaited;
+				state = transaction->getRelativeState(dup, WAIT_IF_ACTIVE);
+
+				if (state != Deadlock)
+					{
+					rec->release();
+					
+					if (activeTransaction)
+						activeTransaction->release();
+					
+					return checkUniqueWaited;
+					}
 				}
 
-			if (activeTransaction)
+			else if (activeTransaction)
 				{
 				if (sync)
 					sync->unlock();
 				
 				state = transaction->getRelativeState(activeTransaction,
 						activeTransaction->transactionId, WAIT_IF_ACTIVE);
-				activeTransaction->release();
-				rec->release();
-				
-				return checkUniqueWaited;
+
+				if (state != Deadlock)
+					{
+					activeTransaction->release();
+					rec->release();
+
+					return checkUniqueWaited;
+					}
 				}
 
-			// Found a duplicate conflict.
+			// Found a duplicate conflict or a deadlock.
 
 			rec->release();
-			
+
 			if (activeTransaction)
 				activeTransaction->release();
 
@@ -2497,7 +2505,7 @@ int Table::checkUniqueRecordVersion(int3
 				text = "deadlock on key %s in table %s.%s";
 				code = DEADLOCK;
 				}
-				
+
 			SQLEXCEPTION exception(code, text,
 									(const char*) index->name, 
 									(const char*) schemaName,
Thread
bk commit into 6.0 tree (klewis:1.2780) BUG#33480klewis9 Jan