summaryrefslogtreecommitdiff
path: root/storage/spider
diff options
context:
space:
mode:
authorJacob Mathew <jacob.mathew@mariadb.com>2018-03-19 12:49:22 -0700
committerJacob Mathew <jacob.mathew@mariadb.com>2018-03-19 12:49:22 -0700
commit7cf2428db31f0f3812e7c1b0923f61077717bb23 (patch)
treeb89f0673beb470a421380edbe245204b7c249b08 /storage/spider
parent24b353162f0fe5fe231d643ba570e6bb4cf87d72 (diff)
downloadmariadb-git-7cf2428db31f0f3812e7c1b0923f61077717bb23.tar.gz
MDEV-10991: Server crashes in spider_udf_direct_sql_create_conn - tests in spider/oracle* suites crash the server
The crash occurs due to code that is #ifdef'd out with HAVE_ORACLE_OCI that pertains to the use of Spider with an Oracle data tier. Enabling this code eliminates the crash. The reason that MariaDB needs to support Oracle storage at the data tier is to help customers migrate from Oracle. It is necessary to build Spider with the additional build flag -DHAVE_ORACLE_OCI, and install and start Oracle before running the Oracle test suite or any tests within it. Nevertheless, if Spider is built normally and Oracle has not been started, these tests should not cause the MariaDB server to crash. The bug fix replaces the crash with the following error: ERROR 12501 (HY000) at line 4: The connect info 'ORACLE' is invalid Author: Jacob Mathew. Reviewer: Kentoku Shiba.
Diffstat (limited to 'storage/spider')
-rw-r--r--storage/spider/spd_db_oracle.cc6
-rw-r--r--storage/spider/spd_direct_sql.cc16
2 files changed, 21 insertions, 1 deletions
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
index c3dfe8b8cf2..8d7b9126570 100644
--- a/storage/spider/spd_db_oracle.cc
+++ b/storage/spider/spd_db_oracle.cc
@@ -29,6 +29,10 @@
#endif
#ifdef HAVE_ORACLE_OCI
+#if (defined(WIN32) || defined(_WIN32) || defined(WINDOWS) || defined(_WINDOWS))
+#include <Shlwapi.h>
+#define strcasestr StrStr
+#endif
#include <oci.h>
#include "spd_err.h"
#include "spd_param.h"
@@ -3817,7 +3821,7 @@ int spider_db_oracle_util::open_item_func(
{
Item_func_conv_charset *item_func_conv_charset =
(Item_func_conv_charset *)item_func;
- CHARSET_INFO *conv_charset = item_func_conv_charset->conv_charset;
+ CHARSET_INFO *conv_charset = item_func_conv_charset->collation.collation;
uint cset_length = strlen(conv_charset->csname);
if (str->reserve(SPIDER_SQL_USING_LEN + cset_length))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc
index 8f892869679..5c3ef9cabdf 100644
--- a/storage/spider/spd_direct_sql.cc
+++ b/storage/spider/spd_direct_sql.cc
@@ -371,6 +371,14 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
if (direct_sql->access_mode == 0)
{
#endif
+ if (direct_sql->dbton_id == SPIDER_DBTON_SIZE)
+ {
+ /* Invalid target wrapper */
+ *error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM;
+ my_printf_error(*error_num, ER_SPIDER_INVALID_CONNECT_INFO_STR,
+ MYF(0), direct_sql->tgt_wrapper);
+ goto error_alloc_conn;
+ }
if (!(conn = (SPIDER_CONN *)
spider_bulk_malloc(spider_current_trx, 32, MYF(MY_WME | MY_ZEROFILL),
&conn, sizeof(*conn),
@@ -398,6 +406,14 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
conn->default_database.init_calc_mem(138);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
} else {
+ if (direct_sql->dbton_id == SPIDER_DBTON_SIZE)
+ {
+ /* Invalid target wrapper */
+ *error_num = ER_SPIDER_NOSQL_WRAPPER_IS_INVALID_NUM;
+ my_printf_error(*error_num, ER_SPIDER_NOSQL_WRAPPER_IS_INVALID_STR,
+ MYF(0), direct_sql->tgt_wrapper);
+ goto error_alloc_conn;
+ }
if (!(conn = (SPIDER_CONN *)
spider_bulk_malloc(spider_current_trx, 33, MYF(MY_WME | MY_ZEROFILL),
&conn, sizeof(*conn),