Duplicate keys with table_open_cache_instances > 1
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC | Status tracked in 5.6 | |||||
5.5 |
Invalid
|
Undecided
|
Unassigned | |||
5.6 |
Fix Committed
|
High
|
Unassigned |
Bug Description
If all the nodes are written, and table_open_
# sysbench --test=
WARNING: Both max-requests and max-time are 0, running endless test
sysbench 0.5: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 32
Report intermediate results every 1 second(s)
Random number generator seed is 0 and will be ignored
Threads started!
[ 1s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 267.06, response time: 158.38ms (95%)
[ 2s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 219.00, response time: 202.14ms (95%)
[ 3s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 244.00, response time: 167.30ms (95%)
[ 4s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 253.00, response time: 140.89ms (95%)
[ 5s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 280.00, response time: 141.01ms (95%)
[ 6s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 271.00, response time: 150.66ms (95%)
[ 7s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 270.00, response time: 152.70ms (95%)
[ 8s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 272.00, response time: 147.67ms (95%)
[ 9s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 295.00, response time: 138.17ms (95%)
[ 10s] threads: 32, tps: 0.00, reads/s: 0.00, writes/s: 250.00, response time: 149.71ms (95%)
ALERT: failed to execute MySQL query: `INSERT INTO sbtest1 (k, c, pad) VALUES (50004, '89929769380-
ALERT: Error 1062 Duplicate entry '342031' for key 'PRIMARY'
FATAL: failed to execute function `event': (null)
It doesn't happen if table_open_
# cat sysbench/
pathtest = string.match(test, "(.*/)") or ""
dofile(pathtest .. "common.lua")
function thread_
set_vars()
end
function event(thread_id)
local table_name
local i
local c_val
local k_val
local pad_val
table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count)
if (oltp_auto_inc) then
i = 0
else
i = sb_rand_uniq(1, oltp_table_size)
end
k_val = sb_rand(1, oltp_table_size)
c_val = sb_rand_str([[
#######
pad_val = sb_rand_str([[
#######
rs = db_query("INSERT INTO " .. table_name .. " (k, c, pad) VALUES " .. string.format("(%d, '%s', '%s')", k_val, c_val, pad_val))
db_disconnect()
end
There are 2 changes compared to insert.lua:
- The id column is removed from it and we let auto_increment to handle that.
- db_disconnect is at the end, so sysbench will reconnect for every transaction.
Locally, I had to set
echo 1000 > /proc/sys/
so I don't run into TCP/IP port exhaustion.
The Test.java produces the bug earlier then sysbench.
Usage: download mysql connector jar ./mysql- connector- java-5. 1.25.jar Test
javac Test.java (creates Test.class and Test$Worker.class)
jar cvf test.jar Test*.*
java -cp test.jar: