Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#6 | 2252871-workbench_moderation-db_update-6.patch | 1.27 KB | alansaviolobo |
#5 | 2252871-workbench_moderation-db_update-5.patch | 1.59 KB | tracker2k |
#1 | 2252871-workbench_moderation-db_update-1.patch | 1.58 KB | hefox |
Comments
Comment #1
hefox CreditAttribution: hefox commentedPatch against stable, but code in dev looks same so hopefully applies to -dev also
Comment #2
hefox CreditAttribution: hefox commentedActually, this patch may fix the deadlock -- see this blog for that update on empty rows followed by insert can deadlock.
Comment #3
hefox CreditAttribution: hefox commentedReproduced 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.
Comment #4
beeradb CreditAttribution: beeradb commented+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.
Comment #5
tracker2k CreditAttribution: tracker2k commentedHere is updated patch for latest version.
Comment #6
alansaviolobo CreditAttribution: alansaviolobo at Axelerant commentedupdating patch for version 7.x-3.x