[MDEV-33242] SPIDER plugin initialization failed at 'create table if not exists mysql.spider_tables ... with 'Specified key was too long; max key length is 1000 bytes', Warning: Memory not freed: 10720 Created: 2024-01-15  Updated: 2024-02-06  Resolved: 2024-02-06

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.6, 10.11, 11.0, 11.1, 11.2, 11.3, 11.4
Fix Version/s: 11.3.2, 10.6.18, 10.11.8, 11.0.6, 11.1.5, 11.2.4

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Yuchen Pei
Resolution: Fixed Votes: 0
Labels: memory_not_freed, regression-10.11

Issue Links:
Relates
relates to MDEV-32753 Spider engine does not load in ORACLE... Closed

 Description   

SET GLOBAL old_mode=4;
INSTALL PLUGIN Spider SONAME 'ha_spider.so';

Leads to:

11.4.0 9bd95e914f3f12d0d9d93e7a1f2c49e6e8841f17 (Debug)

2024-01-15 14:27:31 0 [Note] /test/MD271223-mariadb-11.4.0-linux-x86_64-dbg/bin/mariadbd: ready for connections.
Version: '11.4.0-MariaDB-debug'  socket: '/test/MD271223-mariadb-11.4.0-linux-x86_64-dbg/socket.sock'  port: 10292  MariaDB Server
[ERROR] SPIDER plugin initialization failed at 'create table if not exists mysql.spider_tables(  db_name char(64) not null default '',  table_name char(199) not null default '',  link_id int not null default 0,  priority bigint not null default 0,  server char(64) default null,  scheme char(64) default null,  host char(64) default null,  port char(5) default null,  socket text,  username char(64) default null,  password char(64) default null,  ssl_ca text,  ssl_capath text,  ssl_cert text,  ssl_cipher char(64) default null,  ssl_key text,  ssl_verify_server_cert tinyint not null default 0,  monitoring_binlog_pos_at_failing tinyint not null default 0,  default_file text,  default_group char(64) default null,  dsn char(64) default null,  filedsn text default null,  driver char(64) default null,  tgt_db_name char(64) default null,  tgt_table_name char(64) default null,  link_status tinyint not null default 1,  block_status tinyint not null default 0,  static_link_id char(64) default null,  primary key (db_name, table_name, link_id),  key idx1 (priority),  unique key uidx1 (db_name, table_name, static_link_id)) engine=MyISAM default charset=utf8 collate=utf8_bin' by 'Specified key was too long; max key length is 1000 bytes'
2024-01-15 14:27:33 4 [ERROR] Plugin 'SPIDER' registration as a STORAGE ENGINE failed.

And

11.4.0 9bd95e914f3f12d0d9d93e7a1f2c49e6e8841f17 (Debug)

2024-01-15 14:27:34 0 [Note] /test/MD271223-mariadb-11.4.0-linux-x86_64-dbg/bin/mariadbd: Shutdown complete
Warning: Memory not freed: 10720

The memory loss is the same in all versions. 10.11 To 11.4 are affected. Occurs in both dbg+opt builds.



 Comments   
Comment by Yuchen Pei [ 2024-01-16 ]

I could reproduce in 10.6 d06b6de3050180ec2f96ef00963d1beab8e1b47a
too (in mtr, not mysql client), but not in 10.4 or 10.5.

For 10.11 d0c80c211c1fe3370b68be540bb9113028c6746f I could reproduce
in the client.

The output can vary but the log always reveals

[ERROR] SPIDER plugin initialization failed at 'create table if not exists mysql.spider_tables ... engine=MyISAM default charset=utf8 collate=utf8_bin' by 'Specified key was too long; max key length is 1000 bytes'

Comment by Yuchen Pei [ 2024-01-16 ]

Hi holyfoot, ptal thanks

bb-10.6-mdev-33242 686b3ad052219e5c4de291e6f7e6dd45a6b3bb9d
MDEV-33242 Make Spider init queries compatible with non-default old_mode
 
Add UTF8_IS_UTF8MB3 to the (session) old_mode in connections made with
sql service to run init queries
 
The connection is new and the global variable value takes effect
rather than the session value from the caller of spider_db_init

It's the same kind of issue as MDEV-32753

Comment by Alexey Botchkov [ 2024-02-04 ]

ok to push.

Comment by Yuchen Pei [ 2024-02-06 ]

pushed 1031c8848dd40672c7d90c946a188f0c4f2c0578 to 10.6 yesterday

Generated at Thu Feb 08 10:37:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.