-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug#1634932: Assertion failure in thread x in file fts0que.cc #1297
Conversation
Same comment re. Launchpad bug handling as in the other PRs |
The commit message should be slightly more descriptive ("foo and bar allocated but did not free baz in the case of error") |
Can you tell why the testcase is time and resource consuming? Is it possible to reduce it? |
storage/innobase/fts/fts0que.cc
Outdated
@@ -953,6 +953,18 @@ fts_query_free_doc_ids( | |||
query->total_size -= SIZEOF_RBT_CREATE; | |||
} | |||
|
|||
|
|||
/*******************************************************************//** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New InnoDB code should use the new InnoDB function header comment style (see e.g. fts_ast_string_create, innobase_mysql_tmpfile, fil_rename_tablespace_check for examples)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
storage/innobase/fts/fts0que.cc
Outdated
static | ||
void | ||
fts_query_free_intersection( | ||
fts_query_t* query) /*!< in: query instance */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either here, either in the function body the indentation is wrong (should be tabs everywhere)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
storage/innobase/fts/fts0que.cc
Outdated
@@ -1311,6 +1323,7 @@ fts_query_intersect( | |||
/* error is passed by 'query->error' */ | |||
if (query->error != DB_SUCCESS) { | |||
ut_ad(query->error == DB_FTS_EXCEED_RESULT_CACHE_LIMIT); | |||
fts_query_free_intersection(query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation (should be tabs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
storage/innobase/fts/fts0que.cc
Outdated
@@ -1557,6 +1572,10 @@ fts_merge_doc_ids( | |||
query, ranking->doc_id, ranking->rank); | |||
|
|||
if (query->error != DB_SUCCESS) { | |||
if (query->oper == FTS_EXIST && query->intersection != NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query->oper == FTS_EXIST check looks redundant: the function asserts query->intersection == NULL at the start and only sets it to something if that check passes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can replace with an ut_ad(query->oper == FTS_EXIST) if the branch is taken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
d677ed4
to
d419459
Compare
@@ -0,0 +1,50 @@ | |||
--echo # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use upstream bug number for upstream bugs (ie. bug83648.test). After the Percona Server merge the next step is to send the bugfix to Oracle (get your Percona OCA sorted out meanwhile)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
-- source include/have_innodb.inc | ||
|
||
# Must have debug code to use SET SESSION debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
delimiter ;// | ||
|
||
call populate_t1; | ||
SET autocommit=1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COMMIT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, from documentation: "If autocommit is 0 and you change it to 1, MySQL performs an automatic COMMIT of any open transaction"
call populate_t1; | ||
SET autocommit=1; | ||
|
||
let @saved_session_debug= @@session.debug; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to save and restore session variables - MTR will disconnect the session at the end of the testcase. Only global variables have to be saved and restored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE.
SET autocommit=1; | ||
|
||
let @saved_session_debug= @@session.debug; | ||
SET SESSION debug="d,fts_instrument_result_cache_limit"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But here you want to enable some debug setting and later disable it, so for that here use "+d,fts_...", and below "-d,fts_..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, removed.
# Must have debug code to use SET SESSION debug | ||
--source include/have_debug.inc | ||
|
||
create table `t1` ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistent case for SQL keywords, suggesting uppercase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
sql/sql_optimizer.cc
Outdated
@@ -765,7 +765,8 @@ JOIN::optimize() | |||
if (!(select_options & SELECT_DESCRIBE) && | |||
!select_lex->materialized_table_count) | |||
{ | |||
init_ftfuncs(thd, select_lex, order); | |||
if (init_ftfuncs(thd, select_lex, order)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the other callers of init_ftfuncs do not check its return code - are they affected by this bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were. This was fixed in 5.7 by bug fix:21140111. I have ported this bug into 5.6. The bug fix is not completely correct - needed to move check for errors from init_ftfuncs bit higher in sql_delete.cc, otherwise error from init_ftfuncs caused assertion problem.
d419459
to
a1811e2
Compare
The problem here is missing error check in Item_func_match::init_search() after the handler call ft_init_ext_with_hints(), and missing error propagation in the call stack. The fix also includes a new inlined query block property function has_ft_funcs() that is used to avoid an unnecessary and costly function call to optimize full-text searches. (cherry picked from commit e78f3cb)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er, no, please check Jenkins results - the debug build crashes constantly
a1811e2
to
4c4b851
Compare
Jenkins run => http://jenkins.percona.com/job/percona-server-5.6-param/1641/ There are some tests failing, but I have run them locally and all pass fine. |
@@ -0,0 +1,55 @@ | |||
--echo # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this test be put into innod_fts
test suite rather than innodb
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
`text_content` MEDIUMTEXT, PRIMARY KEY (`FTS_DOC_ID`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; | ||
|
||
CREATE UNIQUE INDEX FTS_DOC_ID_INDEX ON t1(FTS_DOC_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is additional index really needed? FTS_DOC_ID
is already the primary key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is taken from here: https://dev.mysql.com/doc/refman/5.6/en/optimizing-innodb-bulk-data-loading.html . To speed up the inserts.
DELETE FROM t1 | ||
WHERE MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); | ||
|
||
SET GLOBAL innodb_ft_result_cache_limit=default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Store @@global.innodb_ft_result_cache_limit
at the beginning of the test and restore it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
storage/innobase/fts/fts0que.cc
Outdated
@@ -1339,7 +1352,9 @@ fts_query_intersect( | |||
|
|||
ut_a(!query->multi_exist || (query->multi_exist | |||
&& rbt_size(query->doc_ids) <= n_doc_ids)); | |||
} | |||
} else if (query->intersection != NULL) { | |||
fts_query_free_intersection(query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
storage/innobase/fts/fts0que.cc
Outdated
} | ||
} else if (query->intersection != NULL) { | ||
fts_query_free_intersection(query); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
4c4b851
to
e85f501
Compare
--source include/have_innodb.inc | ||
--source include/have_debug.inc | ||
|
||
SET @saved_innodb_ft_result_cache_limit= @@innodb_ft_result_cache_limit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to save GLOBAL variable here, e.g.
SET @saved_innodb_ft_result_cache_limit= @@global.innodb_ft_result_cache_limit;
@@ -953,6 +953,18 @@ fts_query_free_doc_ids( | |||
query->total_size -= SIZEOF_RBT_CREATE; | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InnoDB code (everything in storage/innobase*
) requires InnoDB-style code formatting:
- Tab characters must be used for indentation
- Blocks must be indented by 1 tab
- 1 tab = 8 spaces (set this in your editor)
SQL code (for instance sql/*
and include/*
) requires MySQL-style code formatting:
- Using spaces only for indentation.
- Blocks must be indented by 2 spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The bug was caused by three problems: 1) query->intersection was not freed in case of error caused by exceeding innodb_ft_result_cache_limit. 2) errors from init_ftfuncs were not propagated - this was fixed in 5.7 by bug fix 21140111. This was ported into 5.6 3) bug fix 21140111 was causing assertion failure when innodb_ft_result_cache was exceeded in DELETE command. This was also fixed.
e85f501
to
ef2c0bc
Compare
Summary: Add ddst_dict_init handler api support for rocksdb dd Currently rocksdb ddst_dict_init() doesn't add any rocksdb specific tables and tablespace during ddse initialize. Pull Request resolved: facebook/mysql-5.6#1297 Test Plan: CI Differential Revision: D46700996 fbshipit-source-id: fbb80035b54cc068c845e63fe6903c8488fce1d3
Summary: Add ddst_dict_init handler api support for rocksdb dd Currently rocksdb ddst_dict_init() doesn't add any rocksdb specific tables and tablespace during ddse initialize. Pull Request resolved: facebook/mysql-5.6#1297 Test Plan: CI Differential Revision: D46700996 fbshipit-source-id: fbb80035b54cc068c845e63fe6903c8488fce1d3
No test case for this bug as it is very time and resource consuming.