Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericliang/2964943 to your computer and use it in GitHub Desktop.
Save ericliang/2964943 to your computer and use it in GitHub Desktop.
SysBench patch for MemSQL benchmark, which skips the storage engine detection.
From 81ac1ad630b4d466bdeec58fe367dbf2de595fc2 Mon Sep 17 00:00:00 2001
From: Eric Liang <eric.l.2046@gmail.com>
Date: Thu, 21 Jun 2012 17:44:20 +0800
Subject: [PATCH] memsql would not satisfy the engine test, so skip the detection and use innodb as default
---
sysbench/drivers/mysql/drv_mysql.c | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/sysbench/drivers/mysql/drv_mysql.c b/sysbench/drivers/mysql/drv_mysql.c
index a48e6f6..0f578d8 100644
--- a/sysbench/drivers/mysql/drv_mysql.c
+++ b/sysbench/drivers/mysql/drv_mysql.c
@@ -318,19 +318,26 @@ int mysql_drv_describe(drv_caps_t *caps, const char * table_name)
DEBUG("mysql_num_fields(%p) = %d", res, num_fields);
fields = mysql_fetch_fields(res);
DEBUG("mysql_fetch_fields(%p) = %p", res, fields);
- for (i = 0; i < num_fields; i++)
- if (!strcasecmp(fields[i].name, "type") ||
- !strcasecmp(fields[i].name, "engine"))
- break;
- if (i >= num_fields)
- goto error;
-
- row = mysql_fetch_row(res);
- DEBUG("mysql_fetch_row(%p) = %p", res, row);
- if (row == NULL || row[i] == NULL)
- goto error;
+
+ if ( 3 == num_fields ){ //memsql
+ rc = parse_table_engine("InnoDB");
+ }else{
+ for (i = 0; i < num_fields; i++)
+ if (!strcasecmp(fields[i].name, "type") ||
+ !strcasecmp(fields[i].name, "engine"))
+ break;
+
+ if (i >= num_fields)
+ goto error;
+
+ row = mysql_fetch_row(res);
+ DEBUG("mysql_fetch_row(%p) = %p", res, row);
+ if (row == NULL || row[i] == NULL)
+ goto error;
+
+ rc = parse_table_engine(row[i]);
+ }
- rc = parse_table_engine(row[i]);
*caps = mysql_drv_caps;
goto exit;
--
1.7.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment