Fixed Post position is not correct

au lait

Well-known member
Affected version
2.1
In XF1 the positions were still correct.

Code:
            SELECT post_id, user_id, username, post_date, message_state, position
            FROM xf_post
            WHERE thread_id = ?
            ORDER BY post_date, post_id

PostId was taken into consideration here


In XF2 this is no longer considered.
Code:
UPDATE xf_post
SET position = (@position := IF(message_state = 'visible', @position + 1, GREATEST(@position, 0)))
WHERE thread_id = ?
ORDER BY post_date

Why? We are wondering for days - despite "Position Rebuild" why this is so.
YES! A thread was merged and now it contains 2 posts with the same timestamp

Only a check of the code of XF1 vs XF2 resulted in the solution. Here too (as in other areas) a step backwards was taken.
 
Without an explicit order by clause for what happens with with identical post_dates, the sort order is not stable.
 
So we are happy about a small change in the next version.
May someone has a function to calculate how often this will happen per 1.000.000 posts?
Maybe we can talk instead about the LD and the long list of things that should be added, done, corrected or changed there?
 
Without an explicit order by clause for what happens with with identical post_dates, the sort order is not stable.

I know! But nevertheless the current procedure is simply wrong.

A higher PostID becomes position 0. and the joke in the thread itself stands as firtst post id the correct one!
And already the confusion is complete!

Screen_20191028112336.png

Screen_20191028112327.png



i counted it once...

about 2000 threads are affected
The average is 2 posts per thread with the same timestamp.

But there are also threads with several equal timestamps. and 1- Even with well over 170 equal timestamps. The thread has about 90 000 posts.
It is not known how many of them have erroneous positions.
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.5).

Change log:
Restore the ordering by `post_date, post_id` as per XF1, so that posts with identical datestamps are ordered sequentially.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom