Skip to content

Commit 45ab00f

Browse files
author
Jacob Mathew
committed
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
1 parent 9d1f3bf commit 45ab00f

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

storage/spider/scripts/install_spider.sql

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,18 @@ delimiter //
297297
create procedure mysql.spider_plugin_installer()
298298
begin
299299
set @win_plugin := IF(@@version_compile_os like 'Win%', 1, 0);
300+
set @have_spider_i_s_plugin := 0;
301+
select @have_spider_i_s_plugin := 1 from INFORMATION_SCHEMA.plugins where PLUGIN_NAME = 'SPIDER';
300302
set @have_spider_plugin := 0;
301-
select @have_spider_plugin := 1 from INFORMATION_SCHEMA.plugins where PLUGIN_NAME = 'SPIDER';
302-
if @have_spider_plugin = 0 then
303+
select @have_spider_plugin := 1 from mysql.plugin where name = 'spider';
304+
if @have_spider_i_s_plugin = 0 then
305+
if @have_spider_plugin = 1 then
306+
-- spider plugin is present in mysql.plugin but not in
307+
-- information_schema.plugins. Remove spider plugin entry
308+
-- in mysql.plugin first.
309+
delete from mysql.plugin where name = 'spider';
310+
end if;
311+
-- Install spider plugin
303312
if @win_plugin = 0 then
304313
install plugin spider soname 'ha_spider.so';
305314
else
@@ -308,7 +317,16 @@ begin
308317
end if;
309318
set @have_spider_i_s_alloc_mem_plugin := 0;
310319
select @have_spider_i_s_alloc_mem_plugin := 1 from INFORMATION_SCHEMA.plugins where PLUGIN_NAME = 'SPIDER_ALLOC_MEM';
311-
if @have_spider_i_s_alloc_mem_plugin = 0 then
320+
set @have_spider_alloc_mem_plugin := 0;
321+
select @have_spider_alloc_mem_plugin := 1 from mysql.plugin where name = 'spider_alloc_mem';
322+
if @have_spider_i_s_alloc_mem_plugin = 0 then
323+
if @have_spider_alloc_mem_plugin = 1 then
324+
-- spider_alloc_mem plugin is present in mysql.plugin but not in
325+
-- information_schema.plugins. Remove spider_alloc_mem plugin entry
326+
-- in mysql.plugin first.
327+
delete from mysql.plugin where name = 'spider_alloc_mem';
328+
end if;
329+
-- Install spider_alloc_mem plugin
312330
if @win_plugin = 0 then
313331
install plugin spider_alloc_mem soname 'ha_spider.so';
314332
else

0 commit comments

Comments
 (0)