[Commits] Rev 4595: MDEV-4155, MDEV-4157 in file:///data0/psergey/dev2/mysql-5.6-leveldb/

Sergey Petrunya psergey at askmonty.org
Fri Feb 8 21:01:28 EET 2013


At file:///data0/psergey/dev2/mysql-5.6-leveldb/

------------------------------------------------------------
revno: 4595
revision-id: psergey at askmonty.org-20130208190127-uq98t2n3jl85c50r
parent: psergey at askmonty.org-20130206161208-el5wrruvdz7krsp9
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: mysql-5.6-leveldb
timestamp: Fri 2013-02-08 23:01:27 +0400
message:
  MDEV-4155, MDEV-4157
  - Use correct #ifdef for compiling variants of ldb_locks.cc for unit test and for linking into server.
=== modified file 'storage/leveldb/ha_leveldb.cc'
--- a/storage/leveldb/ha_leveldb.cc	2013-02-06 16:12:08 +0000
+++ b/storage/leveldb/ha_leveldb.cc	2013-02-08 19:01:27 +0000
@@ -109,6 +109,18 @@
   return (uchar*) share->table_name;
 }
 
+/* 
+  The following is needed as an argument for thd_enter_cond, irrespectively of
+  whether we're compiling with P_S or not.
+*/
+PSI_stage_info stage_waiting_on_row_lock= { 0, "Waiting for row lock", 0};
+
+static PSI_stage_info *all_leveldb_stages[]=
+{
+  & stage_waiting_on_row_lock
+};
+
+
 #ifdef HAVE_PSI_INTERFACE
 static PSI_mutex_key ex_key_mutex_example, ex_key_mutex_LEVELDB_SHARE_mutex;
 
@@ -118,16 +130,6 @@
   { &ex_key_mutex_LEVELDB_SHARE_mutex, "LEVELDB_SHARE::mutex", 0}
 };
 
-#ifdef HAVE_PSI_INTERFACE
-PSI_stage_info stage_waiting_on_row_lock= { 0, "Waiting for row lock", 0};
-
-static PSI_stage_info *all_leveldb_stages[]=
-{
-  & stage_waiting_on_row_lock
-};
-#endif
-
-
 static void init_leveldb_psi_keys()
 {
   const char* category= "leveldb";

=== modified file 'storage/leveldb/ha_leveldb.h'
--- a/storage/leveldb/ha_leveldb.h	2013-02-06 14:26:15 +0000
+++ b/storage/leveldb/ha_leveldb.h	2013-02-08 19:01:27 +0000
@@ -29,7 +29,7 @@
 
 #include "sql_string.h"
 
-#ifdef HAVE_PSI_INTERFACE
+//#ifdef HAVE_PSI_INTERFACE
 extern PSI_stage_info stage_waiting_on_row_lock;
 
 extern "C"
@@ -38,7 +38,7 @@
 extern "C"
 void thd_exit_cond(MYSQL_THD thd, const PSI_stage_info *stage);
 
-#endif
+//#endif
 
 /** @brief
   LEVELDB_SHARE is a structure that will be shared among all open handlers.

=== modified file 'storage/leveldb/ldb_locks.cc'
--- a/storage/leveldb/ldb_locks.cc	2013-02-06 14:26:15 +0000
+++ b/storage/leveldb/ldb_locks.cc	2013-02-08 19:01:27 +0000
@@ -6,6 +6,7 @@
 #endif
 
 #include <mysql/plugin.h>
+
 #include "ha_leveldb.h"  // TODO: this is too much
 
 #include "ldb_locks.h"
@@ -195,7 +196,7 @@
 
       struct timespec wait_timeout;
       set_timespec(wait_timeout, timeout_sec);
-#ifdef HAVE_PSI_INTERFACE
+#ifndef STANDALONE_UNITTEST
       THD *thd= current_thd;
       PSI_stage_info old_stage;
       thd_enter_cond(thd, &found_lock->cond, &found_lock->mutex,
@@ -206,7 +207,7 @@
         res= mysql_cond_timedwait(&found_lock->cond, &found_lock->mutex, 
                                   &wait_timeout);
         bool killed= false;
-#ifdef HAVE_PSI_INTERFACE
+#ifndef STANDALONE_UNITTEST
         killed= thd_killed(thd);
 #endif
         if (res == ETIMEDOUT || killed)
@@ -232,8 +233,7 @@
       found_lock->busy= 1;
       found_lock->owner_data= pins;
       found_lock->waiters--; // we're not waiting anymore
-#ifdef HAVE_PSI_INTERFACE
-      // caller_thd->EXIT_COND(&old_stage);
+#ifndef STANDALONE_UNITTEST
       thd_exit_cond(thd, &old_stage);
 #else
       mysql_mutex_unlock(&found_lock->mutex);

=== modified file 'storage/leveldb/unittest/CMakeLists.txt'
--- a/storage/leveldb/unittest/CMakeLists.txt	2013-01-14 12:26:08 +0000
+++ b/storage/leveldb/unittest/CMakeLists.txt	2013-02-08 19:01:27 +0000
@@ -3,6 +3,8 @@
                     ${CMAKE_SOURCE_DIR}/unittest/mytap)
 LINK_LIBRARIES(mytap mysys dbug strings)
 
+ADD_DEFINITIONS(-DSTANDALONE_UNITTEST)
+
 ADD_EXECUTABLE(test_rowlocks
         test_rowlocks.cc ../ldb_locks.cc ../ldb_locks.h)
 #MY_ADD_TEST(test_rowlocks)



More information about the commits mailing list