Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALERT: Error 1062 Duplicate entry 'xxxx' for key 'PRIMARY' #23

Closed
seanlook opened this issue Mar 17, 2016 · 3 comments
Closed

ALERT: Error 1062 Duplicate entry 'xxxx' for key 'PRIMARY' #23

seanlook opened this issue Mar 17, 2016 · 3 comments

Comments

@seanlook
Copy link

I use --oltp-skip-trx=on option to avoid BEGIN statement that will start one transaction because I need to do performance test in read-write spilt scenario. But when I set num-threads up to 12, errors ocur:

ALERT: Error 1062 Duplicate entry '38262' for key 'PRIMARY'
FATAL: failed to execute function `event': (null)

My sysbench version: 0.5
Work statement:

sysbench --mysql-host=mysql_host --mysql-port=mysql_port--mysql-user=ecuser --mysql-password=ecuser \
--test=/usr/share/doc/sysbench/tests/db/oltp.lua --report-interval=10 --rand-type=uniform --rand-init=on --max-requests=0 \
 --mysql-db=dbtest1a --oltp_tables_count=5 --oltp-table-size=50000 --oltp-read-only=off --max-time=60 --oltp-skip-trx=on --num-threads=12 run

And does this patch work: ignoreduplicates.patch ?

THANK YOU!

@akopytov
Copy link
Owner

Yes, with --oltp-skip-trx=on duplicate key errors are expected for the oltp.lua script, because nothing prevents multiple connections inserting and committing a row with the same key. Without that option each transaction is idempotent, because it inserts and then deletes a row with the same key.

Looking at the patch, that would work, but it seems like your are looking at some fairly old code snapshot. The current source tree supports the --mysql-ignore-errors option that has been implemented for precisely this purpose.

Can you try --mysql-ignore-errors=1042 on the current git HEAD?

@seanlook
Copy link
Author

OK, --mysql-ignore-errors=1062 ignore the duplicate entry error successfully! Actualy, I have modified that patch to ignore this error, but --mysql-ignore-errors seems more general.

This is the problem. Before this, I have tried ./bin/sysbench --test=oltp help and ./bin/sysbench --test=dir/oltp.lua to get help. No help text:

PANIC: unprotected error in call to Lua API (cannot open oltp: No such file or directory)

mysql-ignore-errors option should be mentioned.

@akopytov
Copy link
Owner

Glad --mysql-ignore-errors works for you. But I agree, while documentation is long overdue, there should be at least a way to discover them with sysbench help. I reported #25. Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants