- Affected version
- 2.2.6 Patch 2
When merging posts the
This is notable on a very busy forum when merging posts in the same thread, as this can cause deadlocks and cause replying to faill, for the entire node the thread lives in.
Additionally;
In
updateSourceData
function ends up doing a lot of work inside a transaction which likely is not required.This is notable on a very busy forum when merging posts in the same thread, as this can cause deadlocks and cause replying to faill, for the entire node the thread lives in.
Thread::rebuildCounters
is called twice, once in updateTargetData
and once in updateSourceData
.Additionally;
In
updateTargetData
- The call to
Thread::rebuildCounters
is redundant- When source thread != target thread; the target post doesn't move it's position in the thread.
- When source thread = target thread, then the thread metadata is updated when the source post(s) are deleted.
updateSourceData
:Thread::rebuildCounters
is called even if source thread is the same as the target thread, which causes un-needed scans of the xf_post table and possible other extensive rebuild operation depending on add-ons.- This information is updated when the source posts are deleted, so again; completely redundant.
- Calls to
rebuildThreadPostPositions
/rebuildThreadUserPostCounters
/Forum::rebuildCounters
are redundant as the deleting the source post(s) updates this information.
cleanupActions
- Querying indexing the deleted posts isn't required, as this is done in source post's
Post::Delete
method. - Calls to
rebuildThreadPostPositions
/rebuildThreadUserPostCounters
is redundant;- When source thread != target thread; the target post doesn't move it's position in the thread.
- When source thread = target thread, then the thread metadata is updated when the source post(s) are deleted.
updateTargetData
and updateSourceData
are now holding write locks on all posts in the source & target thread, and the source forum(s).
Last edited: