stonedb icon indicating copy to clipboard operation
stonedb copied to clipboard

bug: (Primary-Secondary) After the instance restarts abnormally,it maybe return error 12 or 1032.

Open haitaoguan opened this issue 1 year ago • 3 comments

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • [X] I confirm there is no existing issue for this

Describe the problem

mysql> show slave status\G
,,,,,,
Last_Errno: 12
Last_Error: Could not execute Write_rows event on table ex_tam.tb_name; Insert duplicate key on row: 27646021, pk: 3834315243877708593, Error_code: 12; Got error 1 from storage engine, Error_code: 1030; handler error No Error!; the event's master log mysql-bin.000256, end_log_pos 623463544
......
		
[2023-04-17 11:09:32.251904] [36973] [INFO] [tianmu_table.cpp:1476] MSG: Insert duplicate key on row 27646022, key: 1324f965121a458e8c8a9b75512ea89a
[2023-04-17 11:09:32.332045] [36973] [WARN] [exception.cpp:42] MSG: Exception: Insert duplicate key on row: 27646022, pk: 3834315243877708593.

STACK TRACE BEGIN
        /stonedb57/install/bin/mysqld(+0x8c6a3f) [0x5577923aea3f]
        /stonedb57/install/bin/mysqld(Tianmu::core::Engine::InsertToDelta(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<Tianmu::core::TableShare>&, TABLE*)+0x91) [0x55779305a5a1]
        /stonedb57/install/bin/mysqld(Tianmu::core::Engine::InsertRow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Tianmu::core::Transaction*, TABLE*, std::shared_ptr<Tianmu::core::TableShare>&)+0x118) [0x5
5779305a888]
        /stonedb57/install/bin/mysqld(Tianmu::DBHandler::ha_tianmu::write_row(unsigned char*)+0xa3) [0x557793115213]
        /stonedb57/install/bin/mysqld(handler::ha_write_row(unsigned char*)+0x198) [0x5577924aab68]
        /stonedb57/install/bin/mysqld(write_record(THD*, TABLE*, COPY_INFO*, COPY_INFO*)+0x66d) [0x557792b9cfad]
        /stonedb57/install/bin/mysqld(Sql_cmd_insert::mysql_insert(THD*, TABLE_LIST*)+0x865) [0x557792b9dfa5]
        /stonedb57/install/bin/mysqld(Sql_cmd_insert::execute(THD*)+0xfa) [0x557792b9e98a]
        /stonedb57/install/bin/mysqld(mysql_execute_command(THD*, bool)+0xb3b) [0x557792a1d51b]
        /stonedb57/install/bin/mysqld(mysql_parse(THD*, Parser_state*)+0x445) [0x557792a238d5]
        /stonedb57/install/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0xdc2) [0x557792a24712]
        /stonedb57/install/bin/mysqld(do_command(THD*)+0x227) [0x557792a25cc7]
        /stonedb57/install/bin/mysqld(handle_connection+0x2c8) [0x557792ae5f58]
        /stonedb57/install/bin/mysqld(pfs_spawn_thread+0x168) [0x557792fec3e8]
        /lib/x86_64-linux-gnu/libpthread.so.0(+0x8609) [0x7f7435bde609]
        /lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f74359b2133]
STACK TRACE END

[2023-04-17 11:09:32.332265] [36973] [ERROR] [engine.cpp:1754] MSG: delayed inserting failed: Insert duplicate key on row: 27646022, pk: 3834315243877708593
[2023-04-17 11:09:32.332397] [36973] [ERROR] [engine.cpp:940] MSG: Roll back query 'INSERT INTO `ex_tam`.`tb_name` values
('1324f965121a458e8c8a9b75512ea89a','2023-04-17 09:14:16','b28e2f92248340499f9538f0a04f789f','e2d927d4389d4913bb80d4e201cd05b9',
'0a7bf2b53bf24e14b7cc799984b549fa','ABC','ABC',1,20,1,0)'

Expected behavior

No response

How To Reproduce

No response

Environment

./mysqld Ver 5.7.36-StoneDB-v1.0.3 for Linux on x86_64 (build-) build information as follow: Repository address: https://github.com/stoneatom/stonedb:stonedb-5.7-dev Branch name: stonedb-5.7-dev Last commit ID: 758bce8a5 Last commit time: Date: Mon Apr 10 19:46:20 2023 +0800 Build time: Date: Tue 11 Apr 2023 03:30:57 AM UTC

Are you interested in submitting a PR to solve the problem?

  • [X] Yes, I will!

haitaoguan avatar Apr 17 '23 08:04 haitaoguan

This issue should be related to a system crash

konghaiya avatar Apr 18 '23 12:04 konghaiya

If the instance restarts abnormally,maybe return Errno 1032、Last_ Errno 12.Because the transaction is commited on the storage engine layer, but the server layer is rolled back and will reapply the binlog. Therefore, when inserting data, there will be primary key conflicts and errors, and when deleting or updating, there will be errors where the data cannot be found.

haitaoguan avatar Apr 19 '23 06:04 haitaoguan

Currently, it does not support crash safety capabilities

konghaiya avatar Apr 21 '23 01:04 konghaiya