clear-code / redmine_full_text_search

Full text search for Redmine
MIT License
61 stars 24 forks source link

database errors #87

Closed petemcdonnell closed 4 years ago

petemcdonnell commented 4 years ago

OS: CentOS 7 MariaDB version: 5.5.56 Redmine version: 4.1.1

I cloned a VM in which we have redmine 3.4.1 running with this full_text_search plugin. Everything works well.

I then did a characterset migration to utf8mb4 as per: http://blog.andriylesyuk.com/4-byte-utf-8-problem-in-redmine-and-how-to-fix-it/

I then upgraded redmine to 4.1.1 and am trying to see if I can get this plugin to work again. We REALLY LOVE the ability to sort search results by most recently updates. To be honest, that's primarily why we use this plugin.

The issue I'm currently faced with is that when I try to run:

[user@hostname redmine]# bundle exec rake redmine:plugins:migrate RAILS_ENV=production
== 20170630063557 EnablePgroonga: migrating ===================================
== 20170630063557 EnablePgroonga: migrated (0.0001s) ==========================

== 20170630063657 CreateSearcherRecords: migrating ============================
-- create_table(:searcher_records, {:options=>"ENGINE=Mroonga", :id=>:integer})
   -> 0.3728s
== 20170630063657 CreateSearcherRecords: migrated (0.3730s) ===================

== 20170630063757 CopyRecordsToSearcherRecords: migrating =====================
== 20170630063757 CopyRecordsToSearcherRecords: migrated (0.0000s) ============

== 20170630075027 LoadCommentsFromChangesets: migrating =======================
== 20170630075027 LoadCommentsFromChangesets: migrated (0.0000s) ==============

== 20170630075028 AddIndexToSearcherRecords: migrating ========================
== 20170630075028 AddIndexToSearcherRecords: migrated (0.0000s) ===============

== 20170810045914 CreateIssueContents: migrating ==============================
-- create_table(:issue_contents, {:options=>"ENGINE=Mroonga DEFAULT CHARSET=utf8mb4", :id=>:integer})
   -> 0.0371s
== 20170810045914 CreateIssueContents: migrated (0.0373s) =====================

== 20170810052427 AddIndexToIssueContents: migrating ==========================
== 20170810052427 AddIndexToIssueContents: migrated (0.0000s) =================

== 20190226093842 ExtendContentSize: migrating ================================
== 20190226093842 ExtendContentSize: migrated (0.0000s) =======================

== 20190226093843 AddMissingIndexesToSearcherRecords: migrating ===============
== 20190226093843 AddMissingIndexesToSearcherRecords: migrated (0.0000s) ======

== 20190603054615 DropSearcherRecords: migrating ==============================
-- drop_table(:searcher_records)
   -> 0.0621s
== 20190603054615 DropSearcherRecords: migrated (0.0622s) =====================

== 20190603060948 CreateFtsTypes: migrating ===================================
-- create_table(:fts_types)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE TABLE `fts_types` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) NOT NULL, UNIQUE INDEX `index_fts_types_on_name`  (`name`))
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603060948_create_fts_types.rb:5:in `change'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:510:in `up'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:542:in `migrate_plugin'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:483:in `migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:497:in `block in migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:496:in `each'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:496:in `migrate'
/var/www/html/redmine-4.1.1/lib/tasks/redmine.rake:135:in `block (3 levels) in <top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE TABLE `fts_types` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) NOT NULL, UNIQUE INDEX `index_fts_types_on_name`  (`name`))
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603060948_create_fts_types.rb:5:in `change'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:510:in `up'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:542:in `migrate_plugin'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:483:in `migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:497:in `block in migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:496:in `each'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:496:in `migrate'
/var/www/html/redmine-4.1.1/lib/tasks/redmine.rake:135:in `block (3 levels) in <top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'

Caused by:
Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603060948_create_fts_types.rb:5:in `change'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:510:in `up'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:542:in `migrate_plugin'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:483:in `migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:497:in `block in migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:496:in `each'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:496:in `migrate'
/var/www/html/redmine-4.1.1/lib/tasks/redmine.rake:135:in `block (3 levels) in <top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
Tasks: TOP => redmine:plugins:migrate
(See full trace by running task with --trace)

Since the database came from an environment where the plugin was previously used, I thought I'd try to run the uninstall command, but it's trying to create tables and coming up with the following error:

[user@hostname redmine]# bundle exec rake redmine:plugins:migrate NAME=full_text_search VERSION=0 RAILS_ENV=production
== 20190603054615 DropSearcherRecords: reverting ==============================
-- create_table(:searcher_records)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: The used table type doesn't support FULLTEXT indexes: CREATE TABLE `searcher_records` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `project_id` int NOT NULL, `project_name` varchar(255) NOT NULL, `original_id` int NOT NULL, `original_type` varchar(255) NOT NULL, `original_created_on` timestamp NULL, `original_updated_on` timestamp NULL, `name` varchar(255), `description` text, `identifier` varchar(255), `status` int, `title` varchar(255), `summary` varchar(255), `subject` varchar(255), `author_id` int, `is_private` tinyint(1), `status_id` int, `tracker_id` int, `issue_id` int, `comments` text, `short_comments` text, `long_comments` text, `content` text, `notes` text, `private_notes` tinyint(1), `text` text, `value` text, `custom_field_id` int, `container_id` int, `container_type` varchar(255), `filename` varchar(255), fulltext INDEX `index_searcher_records_on_original_type`  (`original_type`), fulltext INDEX `index_searcher_records_on_project_name`  (`project_name`), fulltext INDEX `index_searcher_records_on_name`  (`name`), fulltext INDEX `index_searcher_records_on_identifier`  (`identifier`), fulltext INDEX `index_searcher_records_on_description`  (`description`), fulltext INDEX `index_searcher_records_on_title`  (`title`), fulltext INDEX `index_searcher_records_on_summary`  (`summary`), fulltext INDEX `index_searcher_records_on_subject`  (`subject`), fulltext INDEX `index_searcher_records_on_comments`  (`comments`), fulltext INDEX `index_searcher_records_on_content`  (`content`), fulltext INDEX `index_searcher_records_on_notes`  (`notes`), fulltext INDEX `index_searcher_records_on_text`  (`text`), fulltext INDEX `index_searcher_records_on_value`  (`value`), fulltext INDEX `index_searcher_records_on_container_type`  (`container_type`), fulltext INDEX `index_searcher_records_on_filename`  (`filename`),  INDEX `index_searcher_records_on_original_type_perfect_matching`  (`original_type`),  INDEX `index_searcher_records_on_project_id`  (`project_id`),  INDEX `index_searcher_records_on_issue_id`  (`issue_id`), fulltext INDEX `index_searcher_records_on_short_comments`  (`short_comments`), fulltext INDEX `index_searcher_records_on_long_comments`  (`long_comments`))
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603054615_drop_searcher_records.rb:8:in `block (2 levels) in change'
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603054615_drop_searcher_records.rb:7:in `block in change'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:520:in `down'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:542:in `migrate_plugin'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:483:in `migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:494:in `migrate'
/var/www/html/redmine-4.1.1/lib/tasks/redmine.rake:135:in `block (3 levels) in <top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: Mysql2::Error: The used table type doesn't support FULLTEXT indexes: CREATE TABLE `searcher_records` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `project_id` int NOT NULL, `project_name` varchar(255) NOT NULL, `original_id` int NOT NULL, `original_type` varchar(255) NOT NULL, `original_created_on` timestamp NULL, `original_updated_on` timestamp NULL, `name` varchar(255), `description` text, `identifier` varchar(255), `status` int, `title` varchar(255), `summary` varchar(255), `subject` varchar(255), `author_id` int, `is_private` tinyint(1), `status_id` int, `tracker_id` int, `issue_id` int, `comments` text, `short_comments` text, `long_comments` text, `content` text, `notes` text, `private_notes` tinyint(1), `text` text, `value` text, `custom_field_id` int, `container_id` int, `container_type` varchar(255), `filename` varchar(255), fulltext INDEX `index_searcher_records_on_original_type`  (`original_type`), fulltext INDEX `index_searcher_records_on_project_name`  (`project_name`), fulltext INDEX `index_searcher_records_on_name`  (`name`), fulltext INDEX `index_searcher_records_on_identifier`  (`identifier`), fulltext INDEX `index_searcher_records_on_description`  (`description`), fulltext INDEX `index_searcher_records_on_title`  (`title`), fulltext INDEX `index_searcher_records_on_summary`  (`summary`), fulltext INDEX `index_searcher_records_on_subject`  (`subject`), fulltext INDEX `index_searcher_records_on_comments`  (`comments`), fulltext INDEX `index_searcher_records_on_content`  (`content`), fulltext INDEX `index_searcher_records_on_notes`  (`notes`), fulltext INDEX `index_searcher_records_on_text`  (`text`), fulltext INDEX `index_searcher_records_on_value`  (`value`), fulltext INDEX `index_searcher_records_on_container_type`  (`container_type`), fulltext INDEX `index_searcher_records_on_filename`  (`filename`),  INDEX `index_searcher_records_on_original_type_perfect_matching`  (`original_type`),  INDEX `index_searcher_records_on_project_id`  (`project_id`),  INDEX `index_searcher_records_on_issue_id`  (`issue_id`), fulltext INDEX `index_searcher_records_on_short_comments`  (`short_comments`), fulltext INDEX `index_searcher_records_on_long_comments`  (`long_comments`))
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603054615_drop_searcher_records.rb:8:in `block (2 levels) in change'
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603054615_drop_searcher_records.rb:7:in `block in change'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:520:in `down'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:542:in `migrate_plugin'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:483:in `migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:494:in `migrate'
/var/www/html/redmine-4.1.1/lib/tasks/redmine.rake:135:in `block (3 levels) in <top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'

Caused by:
Mysql2::Error: The used table type doesn't support FULLTEXT indexes
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603054615_drop_searcher_records.rb:8:in `block (2 levels) in change'
/var/www/html/redmine-4.1.1/plugins/full_text_search/db/migrate/20190603054615_drop_searcher_records.rb:7:in `block in change'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:520:in `down'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:542:in `migrate_plugin'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:483:in `migrate'
/var/www/html/redmine-4.1.1/lib/redmine/plugin.rb:494:in `migrate'
/var/www/html/redmine-4.1.1/lib/tasks/redmine.rake:135:in `block (3 levels) in <top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
Tasks: TOP => redmine:plugins:migrate
(See full trace by running task with --trace)

What can I do to resolve this?

Thanks!

-Pete McDonnell

kou commented 4 years ago

You can't use the create_table_patch.rb patch in the blog post with this plugin.

You should upgrade your MariaDB because MariaDB 5.5 reached EOL at 2020-04-11: https://mariadb.org/about/#maintenance-policy

petemcdonnell commented 4 years ago

I upgraded to MariaDB 10.4 and the current groonga and the error is no longer present. Thanks for your advice.