Vadim Tkachenko has proposed merging lp:~vadim-tk/sysbench/sysbench-stat-fix 
into lp:sysbench.

Requested reviews:
  Alexey Kopytov (akopytov)

For more details, see:
https://code.launchpad.net/~vadim-tk/sysbench/sysbench-stat-fix/+merge/59305

Make statistics available in case we use db_query instead of db_execute in 
scripts
-- 
https://code.launchpad.net/~vadim-tk/sysbench/sysbench-stat-fix/+merge/59305
Your team sysbench-developers is subscribed to branch lp:sysbench.
=== modified file 'sysbench/db_driver.c'
--- sysbench/db_driver.c	2011-01-12 10:48:20 +0000
+++ sysbench/db_driver.c	2011-04-27 22:44:39 +0000
@@ -454,6 +454,12 @@
   rs->connection = con;
 
   con->db_errno = con->driver->ops.query(con, query, rs);
+
+  if (con->db_errno == SB_DB_ERROR_DEADLOCK)
+     thread_stats[con->thread_id].deadlocks++;
+
+  db_update_thread_stats(con->thread_id, db_get_query_type(query));
+
   if (con->db_errno != SB_DB_ERROR_NONE)
     return NULL;
 

=== modified file 'sysbench/scripting/script_lua.c'
--- sysbench/scripting/script_lua.c	2010-12-24 13:46:33 +0000
+++ sysbench/scripting/script_lua.c	2011-04-27 22:44:39 +0000
@@ -611,7 +611,11 @@
   query = luaL_checkstring(L, 1);
   rs = db_query(ctxt->con, query);
   if (rs == NULL)
-    luaL_error(L, "Database query failed");
+  {
+    if (ctxt->con->db_errno == SB_DB_ERROR_DEADLOCK)
+      lua_pushnumber(L, SB_DB_RESTART_TRANSACTION);
+    lua_error(L);
+  }
 
   db_store_results(rs);
   db_free_results(rs);

_______________________________________________
Mailing list: https://launchpad.net/~sysbench-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sysbench-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to