From 719dd6d3f44245e935b21291a59338a819938c49 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 23 May 2019 09:51:23 -0700 Subject: [PATCH] Remove the "search_documentfield" table Summary: Ref T11741. See PHI1276. After the switch to "Ferret", this table has no remaining readers or writers. Test Plan: - Ran `bin/storage upgrade -f`, no warnings. - Grepped for class name, table name, `stemmedCorpus` column; got no relevant hits. - Did a fulltext search. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T11741 Differential Revision: https://secure.phabricator.com/D20549 --- .../20161130.search.02.rebuild.php | 35 ++--------------- .../20190523.myisam.01.documentfield.sql | 1 + src/__phutil_library_map__.php | 2 - .../PhabricatorSearchDocumentField.php | 39 ------------------- 4 files changed, 5 insertions(+), 72 deletions(-) create mode 100644 resources/sql/autopatches/20190523.myisam.01.documentfield.sql delete mode 100644 src/applications/search/storage/document/PhabricatorSearchDocumentField.php diff --git a/resources/sql/autopatches/20161130.search.02.rebuild.php b/resources/sql/autopatches/20161130.search.02.rebuild.php index d179c44c30..b6c06dabb4 100644 --- a/resources/sql/autopatches/20161130.search.02.rebuild.php +++ b/resources/sql/autopatches/20161130.search.02.rebuild.php @@ -1,34 +1,7 @@ getEngine(); - if ($engine instanceof PhabricatorMySQLFulltextStorageEngine) { - $use_mysql = true; - } -} - -if ($use_mysql) { - $field = new PhabricatorSearchDocumentField(); - $conn = $field->establishConnection('r'); - - // We're only going to require this if the index isn't empty: if you're on a - // fresh install, you don't have to do anything. - $any_documents = queryfx_one( - $conn, - 'SELECT * FROM %T LIMIT 1', - $field->getTableName()); - - if ($any_documents) { - try { - id(new PhabricatorConfigManualActivity()) - ->setActivityType(PhabricatorConfigManualActivity::TYPE_REINDEX) - ->save(); - } catch (AphrontDuplicateKeyQueryException $ex) { - // If we've already noted that this activity is required, just move on. - } - } -} +// Later, in T12974, we switched from "InnoDB FULLTEXT" to "Ferret", mostly +// mooting this. The underlying tables and engines were later removed entirely. diff --git a/resources/sql/autopatches/20190523.myisam.01.documentfield.sql b/resources/sql/autopatches/20190523.myisam.01.documentfield.sql new file mode 100644 index 0000000000..c34364b8f2 --- /dev/null +++ b/resources/sql/autopatches/20190523.myisam.01.documentfield.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS {$NAMESPACE}_search.search_documentfield; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 428d4832b6..d10ec7d420 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4530,7 +4530,6 @@ phutil_register_library_map(array( 'PhabricatorSearchDefaultController' => 'applications/search/controller/PhabricatorSearchDefaultController.php', 'PhabricatorSearchDeleteController' => 'applications/search/controller/PhabricatorSearchDeleteController.php', 'PhabricatorSearchDocument' => 'applications/search/storage/document/PhabricatorSearchDocument.php', - 'PhabricatorSearchDocumentField' => 'applications/search/storage/document/PhabricatorSearchDocumentField.php', 'PhabricatorSearchDocumentFieldType' => 'applications/search/constants/PhabricatorSearchDocumentFieldType.php', 'PhabricatorSearchDocumentQuery' => 'applications/search/query/PhabricatorSearchDocumentQuery.php', 'PhabricatorSearchDocumentRelationship' => 'applications/search/storage/document/PhabricatorSearchDocumentRelationship.php', @@ -10874,7 +10873,6 @@ phutil_register_library_map(array( 'PhabricatorSearchDefaultController' => 'PhabricatorSearchBaseController', 'PhabricatorSearchDeleteController' => 'PhabricatorSearchBaseController', 'PhabricatorSearchDocument' => 'PhabricatorSearchDAO', - 'PhabricatorSearchDocumentField' => 'PhabricatorSearchDAO', 'PhabricatorSearchDocumentFieldType' => 'Phobject', 'PhabricatorSearchDocumentQuery' => 'PhabricatorPolicyAwareQuery', 'PhabricatorSearchDocumentRelationship' => 'PhabricatorSearchDAO', diff --git a/src/applications/search/storage/document/PhabricatorSearchDocumentField.php b/src/applications/search/storage/document/PhabricatorSearchDocumentField.php deleted file mode 100644 index 9c5b839f1a..0000000000 --- a/src/applications/search/storage/document/PhabricatorSearchDocumentField.php +++ /dev/null @@ -1,39 +0,0 @@ - false, - self::CONFIG_IDS => self::IDS_MANUAL, - self::CONFIG_COLUMN_SCHEMA => array( - 'phidType' => 'text4', - 'field' => 'text4', - 'auxPHID' => 'phid?', - 'corpus' => 'fulltext?', - 'stemmedCorpus' => 'fulltext?', - ), - self::CONFIG_KEY_SCHEMA => array( - 'key_phid' => null, - 'phid' => array( - 'columns' => array('phid'), - ), - 'key_corpus' => array( - 'columns' => array('corpus', 'stemmedCorpus'), - 'type' => 'FULLTEXT', - ), - ), - ) + parent::getConfiguration(); - } - - public function getIDKey() { - return 'phid'; - } - -} -- 2.51.2