stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
867 stars 141 forks source link

bug: oltp_read_write.lua sysbench returned error 12 #1384

Open haitaoguan opened 1 year ago

haitaoguan commented 1 year ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

Initializing worker threads...

Threads started!

[ 5s ] thds: 4 tps: 71.97 qps: 433.19 (r/w/o: 0.00/288.46/144.73) lat (ms,95%): 150.29 err/s: 0.00 reconn/s: 0.00
[ 10s ] thds: 4 tps: 67.80 qps: 408.03 (r/w/o: 0.00/272.42/135.61) lat (ms,95%): 153.02 err/s: 0.00 reconn/s: 0.00
[ 15s ] thds: 4 tps: 80.00 qps: 479.20 (r/w/o: 0.00/319.20/160.00) lat (ms,95%): 112.67 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: 4 tps: 71.60 qps: 429.19 (r/w/o: 0.00/286.00/143.20) lat (ms,95%): 137.35 err/s: 0.00 reconn/s: 0.00
[ 25s ] thds: 4 tps: 78.60 qps: 472.01 (r/w/o: 0.00/314.81/157.20) lat (ms,95%): 125.52 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: 4 tps: 74.78 qps: 448.08 (r/w/o: 0.00/298.72/149.36) lat (ms,95%): 130.13 err/s: 0.00 reconn/s: 0.00
[ 35s ] thds: 4 tps: 71.82 qps: 431.71 (r/w/o: 0.00/287.47/144.24) lat (ms,95%): 134.90 err/s: 0.00 reconn/s: 0.00
[ 40s ] thds: 4 tps: 75.40 qps: 452.58 (r/w/o: 0.00/301.79/150.79) lat (ms,95%): 127.81 err/s: 0.00 reconn/s: 0.00
[ 45s ] thds: 4 tps: 66.00 qps: 395.82 (r/w/o: 0.00/263.61/132.21) lat (ms,95%): 137.35 err/s: 0.00 reconn/s: 0.00
[ 50s ] thds: 4 tps: 76.00 qps: 455.78 (r/w/o: 0.00/303.79/151.99) lat (ms,95%): 121.08 err/s: 0.00 reconn/s: 0.00
[ 55s ] thds: 4 tps: 65.97 qps: 395.60 (r/w/o: 0.00/263.67/131.93) lat (ms,95%): 150.29 err/s: 0.00 reconn/s: 0.00
[ 60s ] thds: 4 tps: 71.84 qps: 430.63 (r/w/o: 0.00/286.95/143.68) lat (ms,95%): 132.49 err/s: 0.00 reconn/s: 0.00
[ 65s ] thds: 4 tps: 72.20 qps: 433.79 (r/w/o: 0.00/289.40/144.40) lat (ms,95%): 137.35 err/s: 0.00 reconn/s: 0.00
[ 70s ] thds: 4 tps: 68.80 qps: 412.99 (r/w/o: 0.00/275.39/137.60) lat (ms,95%): 142.39 err/s: 0.00 reconn/s: 0.00
[ 75s ] thds: 4 tps: 64.40 qps: 386.42 (r/w/o: 0.00/257.61/128.81) lat (ms,95%): 144.97 err/s: 0.00 reconn/s: 0.00
[ 80s ] thds: 4 tps: 68.40 qps: 410.20 (r/w/o: 0.00/273.40/136.80) lat (ms,95%): 142.39 err/s: 0.00 reconn/s: 0.00
[ 85s ] thds: 4 tps: 67.80 qps: 406.19 (r/w/o: 0.00/270.60/135.60) lat (ms,95%): 127.81 err/s: 0.00 reconn/s: 0.00
[ 90s ] thds: 4 tps: 65.60 qps: 393.62 (r/w/o: 0.00/262.41/131.21) lat (ms,95%): 142.39 err/s: 0.00 reconn/s: 0.00
[ 95s ] thds: 4 tps: 68.20 qps: 409.39 (r/w/o: 0.00/272.99/136.40) lat (ms,95%): 134.90 err/s: 0.00 reconn/s: 0.00
FATAL: mysql_stmt_execute() returned error 12 (Insert duplicate key on row: 51426, pk: 25069) for query 'INSERT INTO sbtest5 (id, k, c, pad) VALUES (?, ?, ?, ?)'
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:489: SQL error, errno = 12, state = 'HY000': Insert duplicate key on row: 51426, pk: 25069

###tianmu.log
[2023-03-13 14:43:32.834236] [12687] [INFO] [tianmu_table.cpp:1501] MSG: Insert duplicate key on row 51426, key: ▒a
[2023-03-13 14:43:32.846563] [12687] [WARN] [exception.cpp:42] MSG: Exception: Insert duplicate key on row: 51426, pk: 25069.

STACK TRACE BEGIN
        /stonedb57/install/bin/mysqld() [0x98bc0b]
        /stonedb57/install/bin/mysqld(Tianmu::core::Engine::InsertToDelta(std::string const&, std::shared_ptr<Tianmu::core::TableSh
are>&, TABLE*)+0x7e) [0x15c621e]
        /stonedb57/install/bin/mysqld(Tianmu::core::Engine::InsertRow(std::string const&, Tianmu::core::Transaction*, TABLE*, std::
shared_ptr<Tianmu::core::TableShare>&)+0x140) [0x15c6500]
        /stonedb57/install/bin/mysqld(Tianmu::DBHandler::ha_tianmu::write_row(unsigned char*)+0x8c) [0x168208c]
        /stonedb57/install/bin/mysqld(handler::ha_write_row(unsigned char*)+0x178) [0xa857d8]
        /stonedb57/install/bin/mysqld(write_record(THD*, TABLE*, COPY_INFO*, COPY_INFO*)+0x60d) [0x11351bd]
        /stonedb57/install/bin/mysqld(Sql_cmd_insert::mysql_insert(THD*, TABLE_LIST*)+0x835) [0x1136165]
        /stonedb57/install/bin/mysqld(Sql_cmd_insert::execute(THD*)+0xd2) [0x1136b02]
        /stonedb57/install/bin/mysqld(mysql_execute_command(THD*, bool)+0xb1b) [0xfc36fb]
        /stonedb57/install/bin/mysqld(Prepared_statement::execute(String*, bool)+0x3dc) [0xfecf6c]
        /stonedb57/install/bin/mysqld(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*)+0x98) [0xfefc
18]
        /stonedb57/install/bin/mysqld(mysqld_stmt_execute(THD*, unsigned long, unsigned long, unsigned char*, unsigned long)+0xfb)
[0xfeff2b]
        /stonedb57/install/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0xdfc) [0xfca7cc]
        /stonedb57/install/bin/mysqld(do_command(THD*)+0x207) [0xfcbc87]
        /stonedb57/install/bin/mysqld(handle_connection+0x2b8) [0x10846c8]
        /stonedb57/install/bin/mysqld(pfs_spawn_thread+0x164) [0x155bc04]
        /lib64/libpthread.so.0(+0x81a3) [0x7f1173e231a3]
        /lib64/libc.so.6(clone+0x6d) [0x7f11712b2fad]
STACK TRACE END

[2023-03-13 14:43:32.846659] [12687] [ERROR] [engine.cpp:1745] MSG: delayed inserting failed: Insert duplicate key on row: 51426, p
k: 25069
[2023-03-13 14:43:32.846694] [12687] [ERROR] [engine.cpp:931] MSG: Roll back query 'INSERT INTO sbtest5 (id, k, c, pad) VALUES (250
69, 24920, '51003160257-29355954760-74985139406-80839266316-66731994301-70519914439-53086604072-05695699764-14268756181-60534188639
', '67085251900-58511274900-14729264387-11594671630-37338909862')'
[2023-03-13 14:43:32.846707] [12687] [INFO] [transaction.cpp:90] MSG: rollback transaction 640e8dfb0000afdd.
[2023-03-13 14:43:32.846714] [12687] [INFO] [tianmu_table.cpp:702] MSG: roll back table zz../zz/sbtest5.tianmu
[2023-03-13 14:43:32.879947] [12687] [WARN] [MYSQL:0] MSG: Aborted connection 21053 to db: 'zz' user: 'root' host: '192.168.30.34'
(Got an error reading communication packets)
[2023-03-13 14:43:32.880210] [12687] [ERROR] [engine.cpp:931] MSG: Roll back query '(null)'

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.git:stonedb-5.7-dev Branch name: stonedb-5.7-dev Last commit ID: f5cd1f9 Last commit time: Date: Tue Mar 7 10:50:50 2023 +0800 Build time: Date: Sun Mar 12 09:22:26 CST 2023

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

konghaiya commented 1 year ago

To solve this problem, row locks need to be added New requirements: