[MDEV-31920] Assertion failure or wrong result with fractional seconds in Mroonga Created: 2023-08-14  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - Mroonga, Temporal Types
Affects Version/s: 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

INSTALL SONAME 'ha_mroonga';
 
CREATE TABLE t (a INT, b INT, c INT, d DATETIME(1), e INT, KEY(a,b,c,d,e)) ENGINE=Mroonga;
INSERT INTO t VALUES (1,2,3,'1900-01-01 00:00:00.1',4),(5,6,7,'1900-01-01 00:00:00.2',8);
SELECT * FROM t;
 
# Cleanup
DROP TABLE t;
UNINSTALL SONAME 'ha_mroonga';

10.4 b2e312b0

mysqld: /data/src/10.4/sql/compat56.cc:256: longlong TIME_to_longlong_datetime_packed(const MYSQL_TIME*): Assertion `!check_datetime_range(ltime)' failed.
230814 18:12:36 [ERROR] mysqld got signal 6 ;
 
6, function=0x56446fe632e0 "longlong TIME_to_longlong_datetime_packed(const MYSQL_TIME*)") at ./assert/assert.c:101
#10 0x000056446e1c9b8e in TIME_to_longlong_datetime_packed (ltime=0x7fc9e02a76d0) at /data/src/10.4/sql/compat56.cc:256
#11 0x00007fc9df0146c0 in mrn::MultipleColumnKeyCodec::decode (this=0x7fc9e02a7cb0, grn_key=0x621000113198 "", grn_key_length=29, mysql_key=0x7fc9e02a81b0 "", mysql_key_length=0x7fc9e02a7c40) at /data/src/10.4/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp:296
#12 0x00007fc9def8f1bb in ha_mroonga::storage_store_fields_by_index (this=0x6250000ff128, buf=0x619000088eb8 "\377") at /data/src/10.4/storage/mroonga/ha_mroonga.cpp:11545
#13 0x00007fc9def79350 in ha_mroonga::storage_get_next_record (this=0x6250000ff128, buf=0x619000088eb8 "\377") at /data/src/10.4/storage/mroonga/ha_mroonga.cpp:9981
#14 0x00007fc9def607e6 in ha_mroonga::storage_index_first (this=0x6250000ff128, buf=0x619000088eb8 "\377") at /data/src/10.4/storage/mroonga/ha_mroonga.cpp:8274
#15 0x00007fc9def60b2b in ha_mroonga::index_first (this=0x6250000ff128, buf=0x619000088eb8 "\377") at /data/src/10.4/storage/mroonga/ha_mroonga.cpp:8286
#16 0x000056446e283af4 in handler::ha_index_first (this=0x6250000ff128, buf=0x619000088eb8 "\377") at /data/src/10.4/sql/handler.cc:3053
#17 0x000056446dc19a49 in join_read_first (tab=0x62b0000653f8) at /data/src/10.4/sql/sql_select.cc:21902
#18 0x000056446dc11e3d in sub_select (join=0x62b000063998, join_tab=0x62b0000653f8, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20886
#19 0x000056446dc0fe48 in do_select (join=0x62b000063998, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:20412
#20 0x000056446db9ecd7 in JOIN::exec_inner (this=0x62b000063998) at /data/src/10.4/sql/sql_select.cc:4605
#21 0x000056446db9c2de in JOIN::exec (this=0x62b000063998) at /data/src/10.4/sql/sql_select.cc:4387
#22 0x000056446dba0370 in mysql_select (thd=0x62b00005b208, tables=0x62b0000628f8, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000063968, unit=0x62b00005f140, select_lex=0x62b0000622b0) at /data/src/10.4/sql/sql_select.cc:4826
#23 0x000056446db70faf in handle_select (thd=0x62b00005b208, lex=0x62b00005f080, result=0x62b000063968, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:442
#24 0x000056446dae04d7 in execute_sqlcom_select (thd=0x62b00005b208, all_tables=0x62b0000628f8) at /data/src/10.4/sql/sql_parse.cc:6473
#25 0x000056446dacd9ec in mysql_execute_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:3976
#26 0x000056446dae9727 in mysql_parse (thd=0x62b00005b208, rawbuf=0x62b000062228 "SELECT * FROM t", length=15, parser_state=0x7fc9e02ac860, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8010
#27 0x000056446dabf9f2 in dispatch_command (command=COM_QUERY, thd=0x62b00005b208, packet=0x629000230209 "", packet_length=15, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
#28 0x000056446dabc561 in do_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:1378
#29 0x000056446debbac0 in do_handle_one_connection (connect=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1420
#30 0x000056446debb3d7 in handle_one_connection (arg=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1324
#31 0x000056446eb2b3ce in pfs_spawn_thread (arg=0x615000003508) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#32 0x00007fc9e80a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#33 0x00007fc9e81285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Non-debug build returns a wrong result (note the fractional part in the datetime values):

10.4 e146940a

CREATE TABLE t (a INT, b INT, c INT, d DATETIME(1), e INT, KEY(a,b,c,d,e)) ENGINE=Mroonga;
INSERT INTO t VALUES (1,2,3,'1900-01-01 00:00:00.1',4),(5,6,7,'1900-01-01 00:00:00.2',8);
SELECT * FROM t;
a	b	c	d	e
1	2	3	1900-01-01 00:00:00.5	4
5	6	7	1900-01-01 00:00:00.6	8

Reproducible on all existing versions.


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