From e51bd421a6996e0a2794799c9475ef115bcf7673 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 9 Apr 2020 10:23:02 +1200 Subject: [PATCH] FIX InnoDB FULLTEXT compat in tests > InnoDB FULLTEXT indexes have special transaction handling characteristics due its caching and batch processing behavior. Specifically, updates and insertions on a FULLTEXT index are processed at transaction commit time, which means that a FULLTEXT search can only see committed data. The following example demonstrates this behavior. The FULLTEXT search only returns a result after the inserted lines are committed. https://dev.mysql.com/doc/refman/5.6/en/innodb-fulltext-index.html#innodb-fulltext-index-transaction --- tests/php/Search/DatabaseSearchEngineTest.php | 6 +++++- tests/php/Search/SearchFormTest.php | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/php/Search/DatabaseSearchEngineTest.php b/tests/php/Search/DatabaseSearchEngineTest.php index 22ca9383..e4046304 100644 --- a/tests/php/Search/DatabaseSearchEngineTest.php +++ b/tests/php/Search/DatabaseSearchEngineTest.php @@ -13,6 +13,11 @@ class DatabaseSearchEngineTest extends SapphireTest { protected $usesDatabase = true; + /** + * @var bool InnoDB doesn't update indexes until transactions are committed + */ + protected $usesTransactions = false; + public static function setUpBeforeClass() { parent::setUpBeforeClass(); @@ -46,5 +51,4 @@ class DatabaseSearchEngineTest extends SapphireTest $results->First()->Title ); } - } diff --git a/tests/php/Search/SearchFormTest.php b/tests/php/Search/SearchFormTest.php index 65932e96..96d47219 100644 --- a/tests/php/Search/SearchFormTest.php +++ b/tests/php/Search/SearchFormTest.php @@ -44,6 +44,11 @@ class ZZZSearchFormTest extends FunctionalTest */ protected $mockController; + /** + * @var bool InnoDB doesn't update indexes until transactions are committed + */ + protected $usesTransactions = false; + public function waitUntilIndexingFinished() { $schema = DB::get_schema();