summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-10-16 13:02:50 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-10-16 13:02:50 +0530
commit1dacd5f299be63b8dea8f6ff802739abba96b4e1 (patch)
tree6c3b89f7262e5deee84f1f98681b841f6809a994
parent3c5f6aa21c54e2f93c96162a23f2e32772cf50bf (diff)
downloadmariadb-git-1dacd5f299be63b8dea8f6ff802739abba96b4e1.tar.gz
MDEV-12547: InnoDB FULLTEXT index has too strict innodb_ft_result_cache_limit max limit
- Backported the MYSQL_SYSVAR_SIZE_T to 10.0 - The parameter innodb_ft_result_cache_limit was only 32 bits wide also on 64-bit systems. Make it size_t, so that it will be 64 bits on 64-bit systems. - Added a test case that show how innodb_ft_result_cache_limit variables behaves in 32bit and 64 bit system.
-rw-r--r--include/mysql/plugin.h12
-rw-r--r--mysql-test/include/have_32bit.inc9
-rw-r--r--mysql-test/include/have_64bit.inc9
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_32.result7
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_64.result5
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_32.test9
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_64.test9
-rw-r--r--storage/innobase/fts/fts0fts.cc4
-rw-r--r--storage/innobase/fts/fts0que.cc6
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/include/fts0fts.h2
-rw-r--r--storage/innobase/include/fts0types.h4
-rw-r--r--storage/xtradb/fts/fts0fts.cc4
-rw-r--r--storage/xtradb/fts/fts0que.cc6
-rw-r--r--storage/xtradb/handler/ha_innodb.cc4
-rw-r--r--storage/xtradb/include/fts0fts.h2
-rw-r--r--storage/xtradb/include/fts0types.h4
17 files changed, 80 insertions, 20 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index ceb6ac93ff5..307138ad4db 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -383,6 +383,18 @@ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
+#ifdef _WIN64
+#define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+#else
+#define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+#endif
+
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
diff --git a/mysql-test/include/have_32bit.inc b/mysql-test/include/have_32bit.inc
new file mode 100644
index 00000000000..d62093d8be4
--- /dev/null
+++ b/mysql-test/include/have_32bit.inc
@@ -0,0 +1,9 @@
+disable_query_log;
+disable_warnings;
+let $VERSION_COMPILE_64BIT=
+ `SELECT IF(@@version_compile_machine like '%64%', 1, 0)`;
+enable_warnings;
+enable_query_log;
+if ($VERSION_COMPILE_64BIT) {
+ skip Need a 32 bit machine/binary;
+}
diff --git a/mysql-test/include/have_64bit.inc b/mysql-test/include/have_64bit.inc
new file mode 100644
index 00000000000..38c11156a53
--- /dev/null
+++ b/mysql-test/include/have_64bit.inc
@@ -0,0 +1,9 @@
+disable_query_log;
+disable_warnings;
+let $VERSION_COMPILE_64BIT=
+ `SELECT IF(@@version_compile_machine like '%64%', 1, 0)`;
+enable_warnings;
+enable_query_log;
+if (!$VERSION_COMPILE_64BIT) {
+ skip Need a 64 bit machine/binary;
+}
diff --git a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_32.result b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_32.result
new file mode 100644
index 00000000000..b3bec1eecdd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_32.result
@@ -0,0 +1,7 @@
+set global innodb_ft_result_cache_limit=5000000000;
+Warnings:
+Warning 1292 Truncated incorrect innodb_ft_result_cache_limit value: '5000000000'
+select @@innodb_ft_result_cache_limit;
+@@innodb_ft_result_cache_limit
+4294967295
+set global innodb_ft_result_cache_limit=2000000000;
diff --git a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_64.result b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_64.result
new file mode 100644
index 00000000000..c86331a8a1c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_64.result
@@ -0,0 +1,5 @@
+set global innodb_ft_result_cache_limit=5000000000;
+select @@innodb_ft_result_cache_limit;
+@@innodb_ft_result_cache_limit
+5000000000
+set global innodb_ft_result_cache_limit=2000000000;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_32.test b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_32.test
new file mode 100644
index 00000000000..d9defc7447b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_32.test
@@ -0,0 +1,9 @@
+--source include/have_32bit.inc
+--source include/have_innodb.inc
+
+let $innodb_ft_result_cache_limit_orig=`select @@innodb_ft_result_cache_limit`;
+
+set global innodb_ft_result_cache_limit=5000000000;
+select @@innodb_ft_result_cache_limit;
+
+eval set global innodb_ft_result_cache_limit=$innodb_ft_result_cache_limit_orig;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_64.test b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_64.test
new file mode 100644
index 00000000000..2606d2b5ca8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_64.test
@@ -0,0 +1,9 @@
+--source include/have_64bit.inc
+--source include/have_innodb.inc
+
+let $innodb_ft_result_cache_limit_orig=`select @@innodb_ft_result_cache_limit`;
+
+set global innodb_ft_result_cache_limit=5000000000;
+select @@innodb_ft_result_cache_limit;
+
+eval set global innodb_ft_result_cache_limit=$innodb_ft_result_cache_limit_orig;
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 6044abd8e79..4891e572741 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -67,7 +67,7 @@ UNIV_INTERN ulong fts_max_total_cache_size;
/** This is FTS result cache limit for each query and would be
a configurable variable */
-UNIV_INTERN ulong fts_result_cache_limit;
+UNIV_INTERN size_t fts_result_cache_limit;
/** Variable specifying the maximum FTS max token size */
UNIV_INTERN ulong fts_max_token_size;
@@ -4308,7 +4308,7 @@ fts_sync_begin(
if (fts_enable_diag_print) {
ib_logf(IB_LOG_LEVEL_INFO,
"FTS SYNC for table %s, deleted count: %ld size: "
- "%lu bytes",
+ "%zu bytes",
sync->table->name,
ib_vector_size(cache->deleted_doc_ids),
cache->total_size);
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 78521df75d9..7983181c23a 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -76,7 +76,7 @@ struct fts_query_t {
fts_table_t fts_index_table;/*!< FTS auxiliary index table def */
- ulint total_size; /*!< total memory size used by query */
+ size_t total_size; /*!< total memory size used by query */
fts_doc_ids_t* deleted; /*!< Deleted doc ids that need to be
filtered from the output */
@@ -4039,7 +4039,7 @@ fts_query(
/* Log memory consumption & result size */
ib_logf(IB_LOG_LEVEL_INFO,
"Full Search Memory: "
- "%lu (bytes), Row: %lu .",
+ "%zu (bytes), Row: %lu .",
query.total_size,
(*result)->rankings_by_id
? rbt_size((*result)->rankings_by_id)
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 58060cd2edb..2092cd113a5 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -16931,10 +16931,10 @@ static MYSQL_SYSVAR_ULONG(ft_total_cache_size, fts_max_total_cache_size,
"Total memory allocated for InnoDB Fulltext Search cache",
NULL, NULL, 640000000, 32000000, 1600000000, 0);
-static MYSQL_SYSVAR_ULONG(ft_result_cache_limit, fts_result_cache_limit,
+static MYSQL_SYSVAR_SIZE_T(ft_result_cache_limit, fts_result_cache_limit,
PLUGIN_VAR_RQCMDARG,
"InnoDB Fulltext search query result cache limit in bytes",
- NULL, NULL, 2000000000L, 1000000L, 4294967295UL, 0);
+ NULL, NULL, 2000000000L, 1000000L, SIZE_T_MAX, 0);
static MYSQL_SYSVAR_ULONG(ft_min_token_size, fts_min_token_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 4c2d247e0a6..ce30a17c4b4 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -355,7 +355,7 @@ extern ulong fts_max_cache_size;
extern ulong fts_max_total_cache_size;
/** Variable specifying the FTS result cache limit for each query */
-extern ulong fts_result_cache_limit;
+extern size_t fts_result_cache_limit;
/** Variable specifying the maximum FTS max token size */
extern ulong fts_max_token_size;
diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h
index 0dad75d8f1b..9ecd9080881 100644
--- a/storage/innobase/include/fts0types.h
+++ b/storage/innobase/include/fts0types.h
@@ -161,7 +161,7 @@ struct fts_cache_t {
the document from the table. Each
element is of type fts_doc_t */
- ulint total_size; /*!< total size consumed by the ilist
+ size_t total_size; /*!< total size consumed by the ilist
field of all nodes. SYNC is run
whenever this gets too big */
fts_sync_t* sync; /*!< sync structure to sync data to
@@ -243,7 +243,7 @@ struct fts_fetch_t {
fts_sql_callback
read_record; /*!< Callback for reading index
record */
- ulint total_memory; /*!< Total memory used */
+ size_t total_memory; /*!< Total memory used */
};
/** For horizontally splitting an FTS auxiliary index */
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index 2f9e331219b..e2a479bf0ae 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -67,7 +67,7 @@ UNIV_INTERN ulong fts_max_total_cache_size;
/** This is FTS result cache limit for each query and would be
a configurable variable */
-UNIV_INTERN ulong fts_result_cache_limit;
+UNIV_INTERN size_t fts_result_cache_limit;
/** Variable specifying the maximum FTS max token size */
UNIV_INTERN ulong fts_max_token_size;
@@ -4308,7 +4308,7 @@ fts_sync_begin(
if (fts_enable_diag_print) {
ib_logf(IB_LOG_LEVEL_INFO,
"FTS SYNC for table %s, deleted count: %ld size: "
- "%lu bytes",
+ "%zu bytes",
sync->table->name,
ib_vector_size(cache->deleted_doc_ids),
cache->total_size);
diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc
index 9966656e772..b9ad43c626a 100644
--- a/storage/xtradb/fts/fts0que.cc
+++ b/storage/xtradb/fts/fts0que.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -76,7 +76,7 @@ struct fts_query_t {
fts_table_t fts_index_table;/*!< FTS auxiliary index table def */
- ulint total_size; /*!< total memory size used by query */
+ size_t total_size; /*!< total memory size used by query */
fts_doc_ids_t* deleted; /*!< Deleted doc ids that need to be
filtered from the output */
@@ -4058,7 +4058,7 @@ fts_query(
/* Log memory consumption & result size */
ib_logf(IB_LOG_LEVEL_INFO,
"Full Search Memory: "
- "%lu (bytes), Row: %lu .",
+ "%zu (bytes), Row: %lu .",
query.total_size,
(*result)->rankings_by_id
? rbt_size((*result)->rankings_by_id)
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index e32d928d45e..6bc4c76f88e 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -18460,10 +18460,10 @@ static MYSQL_SYSVAR_ULONG(ft_total_cache_size, fts_max_total_cache_size,
"Total memory allocated for InnoDB Fulltext Search cache",
NULL, NULL, 640000000, 32000000, 1600000000, 0);
-static MYSQL_SYSVAR_ULONG(ft_result_cache_limit, fts_result_cache_limit,
+static MYSQL_SYSVAR_SIZE_T(ft_result_cache_limit, fts_result_cache_limit,
PLUGIN_VAR_RQCMDARG,
"InnoDB Fulltext search query result cache limit in bytes",
- NULL, NULL, 2000000000L, 1000000L, 4294967295UL, 0);
+ NULL, NULL, 2000000000L, 1000000L, SIZE_T_MAX, 0);
static MYSQL_SYSVAR_ULONG(ft_min_token_size, fts_min_token_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
diff --git a/storage/xtradb/include/fts0fts.h b/storage/xtradb/include/fts0fts.h
index 4c2d247e0a6..ce30a17c4b4 100644
--- a/storage/xtradb/include/fts0fts.h
+++ b/storage/xtradb/include/fts0fts.h
@@ -355,7 +355,7 @@ extern ulong fts_max_cache_size;
extern ulong fts_max_total_cache_size;
/** Variable specifying the FTS result cache limit for each query */
-extern ulong fts_result_cache_limit;
+extern size_t fts_result_cache_limit;
/** Variable specifying the maximum FTS max token size */
extern ulong fts_max_token_size;
diff --git a/storage/xtradb/include/fts0types.h b/storage/xtradb/include/fts0types.h
index 0dad75d8f1b..9ecd9080881 100644
--- a/storage/xtradb/include/fts0types.h
+++ b/storage/xtradb/include/fts0types.h
@@ -161,7 +161,7 @@ struct fts_cache_t {
the document from the table. Each
element is of type fts_doc_t */
- ulint total_size; /*!< total size consumed by the ilist
+ size_t total_size; /*!< total size consumed by the ilist
field of all nodes. SYNC is run
whenever this gets too big */
fts_sync_t* sync; /*!< sync structure to sync data to
@@ -243,7 +243,7 @@ struct fts_fetch_t {
fts_sql_callback
read_record; /*!< Callback for reading index
record */
- ulint total_memory; /*!< Total memory used */
+ size_t total_memory; /*!< Total memory used */
};
/** For horizontally splitting an FTS auxiliary index */