I recently scaled a high volume drupal site by adding more than one web server. Clients connect to a load balancer with IP stickiness.
Sporadically I find the following watchdog entries
Duplicate entry '5371-1179274926' for key 'PRIMARY' query: taxonomy_node_save INSERT INTO term_node (nid, tid) VALUES (1179274926, 5371) in /storage/slx/drupal/drupal-5.19/includes/database.mysql.inc on line 174.
which I think to have narrowed down to the taxonomy.module taxonomy_node_save function that loops over an array passed into the function checking for duplicates with a locally scoped hash variable.
// Defend against duplicate, differently cased tags
if (!isset($inserted[$typed_term_tid])) {
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $typed_term_tid);
$inserted[$typed_term_tid] = TRUE;
}
A secondary user tagging the same node at approximately the same time (even on the same server) can create INSERT statements that will fail because of DUPLICATE PRIMARY.
Comments
Comment #1
dpearcefl commentedConsidering the lack of activity on this issue and that Drupal v5 is no longer supported by fixes or patches, I am going to close this ticket.