Trying to track down a deadlock and noticed that workbench does an update on insert, and might as well not do that (likely doesn't cause the deadlock, which is on workbench_moderation_node_history, but might as well eliminate the possibility).

To reproduce
1) Set up workbench moderation
2) Create a draft
Actual: db_update issue before any records for that nid inserted
Desired: db_update only on update

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hefox’s picture

Status: Active » Needs review
FileSize
1.58 KB

Patch against stable, but code in dev looks same so hopefully applies to -dev also

hefox’s picture

Actually, this patch may fix the deadlock -- see this blog for that update on empty rows followed by insert can deadlock.

hefox’s picture

Title: Only update workbench_moderation_node_history in workbench_moderation_moderate on node update » Deadlock Fix: Only update workbench_moderation_node_history in workbench_moderation_moderate on node update

Reproduced it via command line

T1: UPDATE workbench_moderation_node_history set published = 0 where nid = 4701;

T2: UPDATE workbench_moderation_node_history set published = 0 where nid = 4711;

T1: INSERT INTO workbench_moderation_node_history (vid, nid, from_state, state, uid, stamp, published, current) VALUES ('8031', '4701', 'draft', 'published', '1', '1398368911', '1', '1')

T2: INSERT INTO workbench_moderation_node_history (vid, nid, from_state, state, uid, stamp, published, current) VALUES ('8031', '4711', 'draft', 'published', '1', '1398368911', '1', '1')

Where t1 and t2 are separate transactions. The last statements results in a deadlock.

beeradb’s picture

+1 from me. We were getting deadlocks in workbench_moderation_node_history during automation runs a few times a day and this patch has fixed the issue.

tracker2k’s picture

alansaviolobo’s picture

updating patch for version 7.x-3.x

Status: Needs review » Needs work

The last submitted patch, 6: 2252871-workbench_moderation-db_update-6.patch, failed testing.

The last submitted patch, 6: 2252871-workbench_moderation-db_update-6.patch, failed testing.