MyRocks crash when inserting into table with unique key and TTL
General
Escalation
General
Escalation
Description
Environment
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 143
Server version: 8.0.28-19 Percona Server (GPL), Release 19, Revision 31e88966cd3
Centos7
Smart Checklist
Activity
Show:

Boden Garman August 10, 2022 at 11:54 PM
Thank you very much for the fix and release

Luis Donoso June 20, 2022 at 6:29 AM
The PR has been merged by FB https://github.com/facebook/mysql-5.6/commit/d32eb091b52bd974cd4dc6f16fbb1bed0f6c97cd.
Now that we know the solution has been accepted by FB, I will port it to PS 8.0.

Luis Donoso June 10, 2022 at 7:35 AM
The PR to fix the problem in FB: https://github.com/facebook/mysql-5.6/pull/1192

Luis Donoso June 9, 2022 at 1:15 PM
The issue is happening in the upstream branch fb-myql-8.0.23.
It is reasonably easy to fix.
We will create a patch and a PR for the Facebook repo and for PS server.

Luis Donoso June 9, 2022 at 1:14 PM
Thank you for the info.
Done
Details
Details
Assignee

Reporter

Regression Issue
Yes
Components
Fix versions
Affects versions
Priority
Smart Checklist
Open Smart Checklist
Smart Checklist

Open Smart Checklist
Created June 8, 2022 at 1:14 AM
Updated March 6, 2024 at 10:06 AM
Resolved June 20, 2022 at 8:07 AM
The following table and insert will reliably crash Percona server
```
CREATE TABLE `data_usage` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL,
`date` date NOT NULL,
`hour` tinyint unsigned NOT NULL,
`ipv4` varchar(15) NOT NULL,
`ipv6` varchar(39) NOT NULL,
`acctinputoctets` bigint DEFAULT NULL,
`acctoutputoctets` bigint DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username_day_hour` (`username`,`date`,`hour`)
) ENGINE=ROCKSDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COMMENT='ttl_duration=604800;'
```
INSERT INTO `data_usage` (`username`, `date`, `hour`, `ipv4`, `ipv6`, `acctinputoctets`, `acctoutputoctets`) VALUES ('100002992184', '2022-06-08', '10', '192.168.1.70', '', '1', '2')
```
However changing the table so the unique key is the primary key and dropping the ID column works fine.
The previously worked in Percona Server for MySQL 8.0.20-11 (2020-07-21)
Crash log
mysqld[6112]: 00:44:17 UTC - mysqld got signal 11 ;
mysqld[6112]: Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
mysqld[6112]: Build ID: eefd03d24ddd1edf2cac88ad6d4ebe9f899a956a
mysqld[6112]: Server Version: 8.0.28-19 Percona Server (GPL), Release 19, Revision 31e88966cd3
mysqld[6112]: Thread pointer: 0x7f6c77457000
mysqld[6112]: Attempting backtrace. You can use the following information to find out
mysqld[6112]: where mysqld died. If you see no messages after this, something went
mysqld[6112]: terribly wrong...
mysqld[6112]: stack_bottom = 7f6d5edf8c30 thread_stack 0x100000
mysqld[6112]: /usr/sbin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x3d) [0x204149d]
mysqld[6112]: /usr/sbin/mysqld(print_fatal_signal(int)+0x323) [0x1131b53]
mysqld[6112]: /usr/sbin/mysqld(handle_fatal_signal+0xb5) [0x1131c15]
mysqld[6112]: /lib64/libpthread.so.0(+0xf630) [0x7f6d799cf630]
mysqld[6112]: /usr/lib64/mysql/plugin/ha_rocksdb.so(myrocks::rdb_should_hide_ttl_rec(myrocks::Rdb_key_def const&, rocksdb::Slice const&, myrocks::Rdb_transaction*)+0x79) [0x7f6c75532a69]
mysqld[6112]: /usr/lib64/mysql/plugin/ha_rocksdb.so(myrocks::Rdb_iterator_base::get(rocksdb::Slice const*, rocksdb::PinnableSlice*, myrocks::Rdb_lock_type, bool, bool)+0x1bb) [0x7f6c7558258b]
mysqld[6112]: /usr/lib64/mysql/plugin/ha_rocksdb.so(myrocks::ha_rocksdb::check_and_lock_sk(unsigned int, myrocks::ha_rocksdb::update_row_info const&, bool*, bool)+0x355) [0x7f6c7556a2b5]
mysqld[6112]: /usr/lib64/mysql/plugin/ha_rocksdb.so(myrocks::ha_rocksdb::check_uniqueness_and_lock(myrocks::ha_rocksdb::update_row_info const&, bool, bool)+0xbc) [0x7f6c7556a5ac]
mysqld[6112]: /usr/lib64/mysql/plugin/ha_rocksdb.so(myrocks::ha_rocksdb::update_write_row(unsigned char const*, unsigned char const*, bool)+0x1f1) [0x7f6c7556aeb1]
mysqld[6112]: /usr/lib64/mysql/plugin/ha_rocksdb.so(myrocks::ha_rocksdb::write_row(unsigned char*)+0x61) [0x7f6c7556af31]
mysqld[6112]: /usr/sbin/mysqld(handler::ha_write_row(unsigned char*)+0x1b8) [0xcc50c8]
mysqld[6112]: /usr/sbin/mysqld(write_record(THD*, TABLE*, COPY_INFO*, COPY_INFO*)+0x12a) [0xf9289a]
mysqld[6112]: /usr/sbin/mysqld(Sql_cmd_insert_values::execute_inner(THD*)+0xa35) [0xf94855]
mysqld[6112]: /usr/sbin/mysqld(Sql_cmd_dml::execute(THD*)+0x186) [0x1027b36]
mysqld[6112]: /usr/sbin/mysqld(mysql_execute_command(THD*, bool)+0x9f0) [0xfc9e60]
mysqld[6112]: /usr/sbin/mysqld(sp_instr_stmt::exec_core(THD*, unsigned int*)+0x4f) [0xf10d1f]
mysqld[6112]: /usr/sbin/mysqld(sp_lex_instr::reset_lex_and_exec_core(THD*, unsigned int*, bool)+0x172) [0xf130e2]
mysqld[6112]: /usr/sbin/mysqld(sp_lex_instr::validate_lex_and_execute_core(THD*, unsigned int*, bool)+0xb5) [0xf13e55]
mysqld[6112]: /usr/sbin/mysqld(sp_instr_stmt::execute(THD*, unsigned int*)+0xf9) [0xf157e9]
mysqld[6112]: /usr/sbin/mysqld(sp_head::execute(THD*, bool)+0x5e7) [0xf0a0d7]
mysqld[6112]: /usr/sbin/mysqld(sp_head::execute_trigger(THD*, MYSQL_LEX_CSTRING const&, MYSQL_LEX_CSTRING const&, GRANT_INFO*)+0x29d) [0xf0aafd]
mysqld[6112]: /usr/sbin/mysqld(Trigger::execute(THD*)+0x10c) [0x10f827c]
mysqld[6112]: /usr/sbin/mysqld(Trigger_chain::execute_triggers(THD*)+0x18) [0x10f9618]
mysqld[6112]: /usr/sbin/mysqld(Table_trigger_dispatcher::process_triggers(THD*, enum_trigger_event_type, enum_trigger_action_time_type, bool)+0x46) [0x10f2fb6]
mysqld[6112]: /usr/sbin/mysqld(Sql_cmd_update::update_single_table(THD*)+0x1d16) [0x10b4a36]
mysqld[6112]: /usr/sbin/mysqld(Sql_cmd_dml::execute(THD*)+0x186) [0x1027b36]
mysqld[6112]: /usr/sbin/mysqld(mysql_execute_command(THD*, bool)+0x9f0) [0xfc9e60]
mysqld[6112]: /usr/sbin/mysqld(dispatch_sql_command(THD*, Parser_state*, bool)+0x4f8) [0xfcdc88]
mysqld[6112]: /usr/sbin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x14be) [0xfcf67e]
mysqld[6112]: /usr/sbin/mysqld(do_command(THD*)+0x189) [0xfd1189]
mysqld[6112]: /usr/sbin/mysqld() [0x11224a0]
mysqld[6112]: /usr/sbin/mysqld() [0x24e6860]
mysqld[6112]: /lib64/libpthread.so.0(+0x7ea5) [0x7f6d799c7ea5]
mysqld[6112]: /lib64/libc.so.6(clone+0x6d) [0x7f6d77d5eb0d]
mysqld[6112]: Trying to get some variables.
mysqld[6112]: Some pointers may be invalid and cause the dump to abort.
mysqld[6112]: Query (7f6c63654030): INSERT INTO `data_usage` SET `username` = SPLIT_STR(NEW.username, '@', 1), `date` = DATE(NEW.acctupdatetime), `hour` = HOUR(NEW.acctupdatetime), `ipv4` = NEW.framedipaddress, `ipv6` = NEW.delegatedipv6prefix, `acctinputoctets` = (NEW.acctinputoctets - OLD.acctinputoctets), `acctoutputoctets` = (NEW.acctoutputoctets - OLD.acctoutputoctets) ON DUPLICATE KEY UPDATE `data_usage`.acctinputoctets = COALESCE(`data_usage`.acctinputoctets, 0) + (NEW.acctinputoctets - OLD.acctinputoctets), `data_usage`.acctoutputoctets = COALESCE(`data_usage`.acctoutputoctets, 0) + (NEW.acctoutputoctets - OLD.acctoutputoctets)
mysqld[6112]: Connection ID (thread ID): 14
mysqld[6112]: Status: NOT_KILLED
mysqld[6112]: Please help us make Percona Server better by reporting any
mysqld[6112]: bugs at https://bugs.percona.com/
mysqld[6112]: You may download the Percona Server operations manual by visiting
mysqld[6112]: http://www.percona.com/software/percona-server/. You may find information
mysqld[6112]: in the manual which will help you identify the cause of the crash.