Not a bug Primary key error with thread view table

HWS

Well-known member
XenForo 1.4.8, listeners disabled:

Code:
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry '794909' for key 'PRIMARY' - library/Zend/Db/Statement/Mysqli.php:214
Generated By: XX, 5 Minutes ago
Stack Trace
#0 /var/www/xxxxxx/library/Zend/Db/Statement.php(317): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /var/www/xxxxxx/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /var/www/xxxxxx/library/XenForo/Model/Thread.php(2422): Zend_Db_Adapter_Abstract->query('\n\t\t\tINSERT INT...', 794909)
#3 /var/www/xxxxxx/library/XenForo/ControllerPublic/Thread.php(159): XenForo_Model_Thread->logThreadView(794909)
#4 /var/www/xxxxxx/library/XenForo/FrontController.php(347): XenForo_ControllerPublic_Thread->actionIndex()
#5 /var/www/xxxxxx/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#6 /var/www/xxxxxx/index.php(13): XenForo_FrontController->run()
#7 {main}
Request State
array(3) {
["url"] => string(47) "http://xxxxxx/forum/signature.794909/"
["_GET"] => array(1) {
["/forum/signature_794909/"] => string(0) ""
}
["_POST"] => array(0) {
}
}

I cannot reproduce it here at xenforo.com, but on my brandnew installed test forum when I reload a page without loading another one between the reloads...

Can someone give me a hint why this happens?
 
Seems like a bug in XenForo.

The error only appears if I disable "Enable Delayed Insert SQL Queries" (which is enabled by default, but have been disabled by me).

Could this be the reason why some people here have been complaining about long lasting delayed queries in their installations? The error is simply not triggered if "Enable Delayed Insert SQL Queries" is activated, maybe causing the queries to never go away.
 
There must be something with your server configuration or a bad export/import of the data. That table doesn't even have a primary key. It's a single column with an ID. That ID can be inserted many times. The only time I've seen things like this is when a dump has been generated by a program incorrectly.

Also, seeing connections "waiting for insert" are totally normal with delayed inserts. It's how MySQL implements that function and if it concerns people, they can adjust the timeout in MySQL's config.
 
There must be something with your server configuration or a bad export/import of the data. That table doesn't even have a primary key. It's a single column with an ID. That ID can be inserted many times. The only time I've seen things like this is when a dump has been generated by a program incorrectly.

Also, seeing connections "waiting for insert" are totally normal with delayed inserts. It's how MySQL implements that function and if it concerns people, they can adjust the timeout in MySQL's config.

Thank you Mike, this helps a lot.
We are using a Galera cluster and converted the Memory tables to InnoDb. To be able to synchronize between the servers all tables have to have a primary key. It seems it was not a wise choice by our database admin to just make the only field in that table the primary key….
 
Back
Top Bottom