diff options
author | Jacob Mathew <jacob.mathew@mariadb.com> | 2018-07-23 14:14:23 -0700 |
---|---|---|
committer | Jacob Mathew <jacob.mathew@mariadb.com> | 2018-07-23 14:14:23 -0700 |
commit | 45ab00f097be0f77d7087182244218f036c3f113 (patch) | |
tree | 376bc458fc51dfcd6034d1b80d5a411e10f358a9 /storage/spider/scripts | |
parent | 9d1f3bf2e9425db8e352ee80e7b456dd6ef73fcb (diff) | |
download | mariadb-git-45ab00f097be0f77d7087182244218f036c3f113.tar.gz |
MDEV-15786: ERROR 1062 (23000) at line 365: Duplicate entry 'spider' for key 'PRIMARY'
The problem occurs on Ubuntu where a Spider package is installed on the system
separately from the MariaDB package. MariaDB and Spider upgrades leave the
Spider plugin improperly installed. Spider is present in the mysql.plugin
table but is not present in information_schema.
The problem has been corrected in Spider's installation script. Logic has
been added to check for Spider entries in both information_schema and
mysql.plugin. If Spider is present in mysql.plugin but is not present in
information_schema, then Spider is first removed from mysql.plugin. The
subsequent plugin install of Spider will insert entries in both mysql.plugin
and information_schema.
Author:
Jacob Mathew.
Reviewer:
Kentoku Shiba.
Cherry-Picked:
Commit 0897d81 on branch bb-10.3-MDEV-15786
Diffstat (limited to 'storage/spider/scripts')
-rw-r--r-- | storage/spider/scripts/install_spider.sql | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/storage/spider/scripts/install_spider.sql b/storage/spider/scripts/install_spider.sql index dbafe95bdbf..9c9eaacdf60 100644 --- a/storage/spider/scripts/install_spider.sql +++ b/storage/spider/scripts/install_spider.sql @@ -297,9 +297,18 @@ delimiter // create procedure mysql.spider_plugin_installer() begin set @win_plugin := IF(@@version_compile_os like 'Win%', 1, 0); + set @have_spider_i_s_plugin := 0; + select @have_spider_i_s_plugin := 1 from INFORMATION_SCHEMA.plugins where PLUGIN_NAME = 'SPIDER'; set @have_spider_plugin := 0; - select @have_spider_plugin := 1 from INFORMATION_SCHEMA.plugins where PLUGIN_NAME = 'SPIDER'; - if @have_spider_plugin = 0 then + select @have_spider_plugin := 1 from mysql.plugin where name = 'spider'; + if @have_spider_i_s_plugin = 0 then + if @have_spider_plugin = 1 then + -- spider plugin is present in mysql.plugin but not in + -- information_schema.plugins. Remove spider plugin entry + -- in mysql.plugin first. + delete from mysql.plugin where name = 'spider'; + end if; + -- Install spider plugin if @win_plugin = 0 then install plugin spider soname 'ha_spider.so'; else @@ -308,7 +317,16 @@ begin end if; set @have_spider_i_s_alloc_mem_plugin := 0; select @have_spider_i_s_alloc_mem_plugin := 1 from INFORMATION_SCHEMA.plugins where PLUGIN_NAME = 'SPIDER_ALLOC_MEM'; - if @have_spider_i_s_alloc_mem_plugin = 0 then + set @have_spider_alloc_mem_plugin := 0; + select @have_spider_alloc_mem_plugin := 1 from mysql.plugin where name = 'spider_alloc_mem'; + if @have_spider_i_s_alloc_mem_plugin = 0 then + if @have_spider_alloc_mem_plugin = 1 then + -- spider_alloc_mem plugin is present in mysql.plugin but not in + -- information_schema.plugins. Remove spider_alloc_mem plugin entry + -- in mysql.plugin first. + delete from mysql.plugin where name = 'spider_alloc_mem'; + end if; + -- Install spider_alloc_mem plugin if @win_plugin = 0 then install plugin spider_alloc_mem soname 'ha_spider.so'; else |