[MDEV-27316] Assertion `!(index)->is_spatial()' failed. Created: 2021-12-20  Updated: 2021-12-27  Resolved: 2021-12-27

Status: Closed
Project: MariaDB Server
Component/s: GIS, Storage Engine - InnoDB
Affects Version/s: 10.7, 10.8
Fix Version/s: 10.8.0, 10.7.2

Type: Bug Priority: Critical
Reporter: Roel Van de Paar Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: not-10.2, not-10.3, not-10.4, not-10.5, not-10.6, regression

Issue Links:
Duplicate
duplicates MDEV-27220 Assertion `!(index)->is_spatial()' fa... Closed
Problem/Incident
is caused by MDEV-24621 In bulk insert, pre-sort and build in... Closed

 Description   

SET sql_mode='';
SET SESSION foreign_key_checks=0;
CREATE TABLE t (c POLYGON NOT NULL) ENGINE=InnoDB;
CREATE SPATIAL INDEX i ON t (c ASC) KEY_BLOCK_SIZE=2;
SET unique_checks=0;
INSERT INTO t VALUES (ST_GEOMFROMTEXT('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'));

Leads to:

10.8.0 ccdf5711a8fff0cd610a91fdcf37c8ff1182878c (Debug)

mysqld: /test/10.8_dbg/storage/innobase/include/btr0bulk.h:293: BtrBulk::BtrBulk(dict_index_t*, const trx_t*): Assertion `!(index)->is_spatial()' failed.

10.8.0 ccdf5711a8fff0cd610a91fdcf37c8ff1182878c (Debug)

Core was generated by `/test/MD121221-mariadb-10.8.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x1523500a7700 (LWP 1346050))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000152352864859 in __GI_abort () at abort.c:79
#2  0x0000152352864729 in __assert_fail_base (fmt=0x1523529fa588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55611da2ec70 "!(index)->is_spatial()", file=0x55611da69dc8 "/test/10.8_dbg/storage/innobase/include/btr0bulk.h", line=293, function=<optimized out>) at assert.c:92
#3  0x0000152352875f36 in __GI___assert_fail (assertion=assertion@entry=0x55611da2ec70 "!(index)->is_spatial()", file=file@entry=0x55611da69dc8 "/test/10.8_dbg/storage/innobase/include/btr0bulk.h", line=line@entry=293, function=function@entry=0x55611da69e00 "BtrBulk::BtrBulk(dict_index_t*, const trx_t*)") at assert.c:101
#4  0x000055611d343376 in BtrBulk::BtrBulk (trx=0x15233d9551e0, index=0x1522a8037508, this=0x1523500a5370) at /test/10.8_dbg/storage/innobase/include/dict0mem.h:1182
#5  row_merge_bulk_t::write_to_index (this=this@entry=0x1522a803c060, index_no=index_no@entry=1, trx=trx@entry=0x15233d9551e0) at /test/10.8_dbg/storage/innobase/row/row0merge.cc:5162
#6  0x000055611d343592 in row_merge_bulk_t::write_to_table (this=0x1522a803c060, table=<optimized out>, trx=trx@entry=0x15233d9551e0) at /test/10.8_dbg/storage/innobase/row/row0merge.cc:5216
#7  0x000055611d1adc5f in trx_mod_table_time_t::write_bulk (trx=0x15233d9551e0, table=<optimized out>, this=0x1522a8021b40) at /test/10.8_dbg/storage/innobase/include/trx0trx.h:519
#8  innodb_prepare_commit_versioned (thd=<optimized out>, trx_id=<optimized out>) at /test/10.8_dbg/storage/innobase/handler/ha_innodb.cc:3710
#9  0x000055611ce24c18 in ha_commit_trans (thd=thd@entry=0x1522a8000db8, all=all@entry=false) at /test/10.8_dbg/sql/handler.h:2013
#10 0x000055611cc9d5b6 in trans_commit_stmt (thd=thd@entry=0x1522a8000db8) at /test/10.8_dbg/sql/transaction.cc:472
#11 0x000055611cb14c6b in mysql_execute_command (thd=thd@entry=0x1522a8000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.8_dbg/sql/sql_parse.cc:6049
#12 0x000055611cafae0f in mysql_parse (thd=thd@entry=0x1522a8000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1523500a6400) at /test/10.8_dbg/sql/sql_parse.cc:8028
#13 0x000055611cb09aab in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1522a8000db8, packet=packet@entry=0x1522a800b879 "INSERT INTO t VALUES (ST_GEOMFROMTEXT('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'))", packet_length=packet_length@entry=112, blocking=blocking@entry=true) at /test/10.8_dbg/sql/sql_class.h:1360
#14 0x000055611cb0ceea in do_command (thd=0x1522a8000db8, blocking=blocking@entry=true) at /test/10.8_dbg/sql/sql_parse.cc:1402
#15 0x000055611cc8689c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55612059cfe8, put_in_cache=put_in_cache@entry=true) at /test/10.8_dbg/sql/sql_connect.cc:1418
#16 0x000055611cc86ea1 in handle_one_connection (arg=arg@entry=0x55612059cfe8) at /test/10.8_dbg/sql/sql_connect.cc:1312
#17 0x000055611d108442 in pfs_spawn_thread (arg=0x5561204b0658) at /test/10.8_dbg/storage/perfschema/pfs.cc:2201
#18 0x0000152352d73609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#19 0x0000152352961293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

In terms of KEY_BLOCK_SIZE=2 for the index, note (which leads me to think the issue is with InnoDB. Issue also does not reproduce on other engines);

10.8.0 ccdf5711a8fff0cd610a91fdcf37c8ff1182878c (Debug)

10.8.0-dbg>SET sql_mode='';
Query OK, 0 rows affected (0.000 sec)
 
10.8.0-dbg>SET SESSION foreign_key_checks=0;
Query OK, 0 rows affected (0.000 sec)
 
10.8.0-dbg>CREATE TABLE t (c POLYGON NOT NULL) ENGINE=InnoDB KEY_BLOCK_SIZE=2;
ERROR 4047 (HY000): InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.

Bug confirmed present in:
MariaDB: 10.7.2 (dbg), 10.8.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.42 (dbg), 10.2.42 (opt), 10.3.33 (dbg), 10.3.33 (opt), 10.4.23 (dbg), 10.4.23 (opt), 10.5.14 (dbg), 10.5.14 (opt), 10.6.6 (dbg), 10.6.6 (opt), 10.7.2 (opt), 10.8.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.36 (dbg), 5.7.36 (opt), 8.0.27 (dbg), 8.0.27 (opt)


Generated at Thu Feb 08 09:51:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.