List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:November 19 2010 8:53am
Subject:bzr commit into mysql-trunk branch (tor.didriksen:3358)
View as plain text  
#At file:///export/home/didrik/repo/trunk-bugfixing/ based on revid:bar@stripped

 3358 Tor Didriksen	2010-11-19
      Fix failing unit test after MDL interface change.

    modified:
      sql/mdl.cc
      unittest/gunit/mdl-t.cc
=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc	2010-11-18 16:34:56 +0000
+++ b/sql/mdl.cc	2010-11-19 08:53:52 +0000
@@ -753,9 +753,9 @@ MDL_context::MDL_context()
 
 void MDL_context::destroy()
 {
-  DBUG_ASSERT(m_tickets[MDL_STATEMENT].is_empty() &&
-              m_tickets[MDL_TRANSACTION].is_empty() &&
-              m_tickets[MDL_EXPLICIT].is_empty());
+  DBUG_ASSERT(m_tickets[MDL_STATEMENT].is_empty());
+  DBUG_ASSERT(m_tickets[MDL_TRANSACTION].is_empty());
+  DBUG_ASSERT(m_tickets[MDL_EXPLICIT].is_empty());
 
   mysql_prlock_destroy(&m_LOCK_waiting_for);
 }

=== modified file 'unittest/gunit/mdl-t.cc'
--- a/unittest/gunit/mdl-t.cc	2010-11-18 16:34:56 +0000
+++ b/unittest/gunit/mdl-t.cc	2010-11-19 08:53:52 +0000
@@ -292,8 +292,9 @@ TEST_F(MDL_DeathTest, die_when_m_tickets
                  MDL_TRANSACTION);
 
   EXPECT_FALSE(m_mdl_context.try_acquire_lock(&m_request));
-  EXPECT_DEATH(m_mdl_context.destroy(), ".*Assertion .*m_tickets.is_empty.*");
-  m_mdl_context.release_all_locks_for_name(m_request.ticket);
+  EXPECT_DEATH(m_mdl_context.destroy(),
+               ".*Assertion.*MDL_TRANSACTION.*is_empty.*");
+  m_mdl_context.release_transactional_locks();
 }
 #endif  // GTEST_HAS_DEATH_TEST && !defined(DBUG_OFF)
 
@@ -326,7 +327,7 @@ void MDL_test::test_one_simple_shared_lo
   EXPECT_FALSE(m_mdl_context.try_acquire_lock(&request_2));
   EXPECT_EQ(m_request.ticket, request_2.ticket);
 
-  m_mdl_context.release_all_locks_for_name(m_request.ticket);
+  m_mdl_context.release_transactional_locks();
   EXPECT_FALSE(m_mdl_context.has_locks());
 }
 
@@ -391,8 +392,7 @@ TEST_F(MDL_test, one_exclusive)
               is_lock_owner(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE));
   EXPECT_TRUE(m_request.ticket->is_upgradable_or_exclusive());
 
-  m_mdl_context.release_all_locks_for_name(m_request.ticket);
-  m_mdl_context.release_lock(m_global_request.ticket);
+  m_mdl_context.release_transactional_locks();
   EXPECT_FALSE(m_mdl_context.has_locks());
 }
 
@@ -404,10 +404,8 @@ TEST_F(MDL_test, one_exclusive)
 TEST_F(MDL_test, two_shared)
 {
   MDL_request request_2;
-  m_request.init(MDL_key::TABLE, db_name, table_name1, MDL_SHARED,
-                 MDL_TRANSACTION);
-  request_2.init(MDL_key::TABLE, db_name, table_name2, MDL_SHARED,
-                 MDL_TRANSACTION);
+  m_request.init(MDL_key::TABLE, db_name, table_name1, MDL_SHARED, MDL_EXPLICIT);
+  request_2.init(MDL_key::TABLE, db_name, table_name2, MDL_SHARED, MDL_EXPLICIT);
 
   EXPECT_FALSE(m_mdl_context.try_acquire_lock(&m_request));
   EXPECT_FALSE(m_mdl_context.try_acquire_lock(&request_2));
@@ -457,8 +455,8 @@ TEST_F(MDL_test, shared_locks_between_co
   EXPECT_TRUE(mdl_context2.
               is_lock_owner(MDL_key::TABLE, db_name, table_name1, MDL_SHARED));
 
-  m_mdl_context.release_all_locks_for_name(m_request.ticket);
-  mdl_context2.release_all_locks_for_name(request_2.ticket);
+  m_mdl_context.release_transactional_locks();
+  mdl_context2.release_transactional_locks();
 }
 
 
@@ -483,8 +481,7 @@ TEST_F(MDL_test, upgrade_shared_upgradab
                upgrade_shared_lock_to_exclusive(m_request.ticket, long_timeout));
   EXPECT_EQ(MDL_EXCLUSIVE, m_request.ticket->get_type());
 
-  m_mdl_context.release_all_locks_for_name(m_request.ticket);
-  m_mdl_context.release_lock(m_global_request.ticket);
+  m_mdl_context.release_transactional_locks();
 }
 
 
@@ -589,7 +586,7 @@ TEST_F(MDL_test, concurrent_shared)
   release_locks.notify();
   mdl_thread.join();
 
-  m_mdl_context.release_all_locks_for_name(m_request.ticket);
+  m_mdl_context.release_transactional_locks();
 }
 
 
@@ -627,8 +624,7 @@ TEST_F(MDL_test, concurrent_shared_exclu
   EXPECT_FALSE(m_mdl_context.acquire_locks(&m_request_list, zero_timeout));
   EXPECT_NE(m_null_ticket, m_request.ticket);
 
-  m_mdl_context.release_all_locks_for_name(m_request.ticket);
-  m_mdl_context.release_lock(m_global_request.ticket);
+  m_mdl_context.release_transactional_locks();
 }
 
 
@@ -659,7 +655,7 @@ TEST_F(MDL_test, concurrent_exclusive_sh
   EXPECT_NE(m_null_ticket, m_request.ticket);
 
   mdl_thread.join();
-  m_mdl_context.release_all_locks_for_name(m_request.ticket);
+  m_mdl_context.release_transactional_locks();
 }
 
 


Attachment: [text/bzr-bundle] bzr/tor.didriksen@oracle.com-20101119085352-nl8lklzit6s8ketd.bundle
Thread
bzr commit into mysql-trunk branch (tor.didriksen:3358) Tor Didriksen19 Nov
  • Re: bzr commit into mysql-trunk branch (tor.didriksen:3358)Dmitry Lenev19 Nov