Opened 9 years ago
Closed 9 years ago
#34838 closed defect (bug) (fixed)
Comment descendant queries do not have determinate order
Reported by: | boonebgorges | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.4 | Priority: | high |
Severity: | major | Version: | |
Component: | Comments | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
[34546] introduced hierarchical comment queries. For efficiency, each level of the hierarchy is fetched in a single SQL query, of the form SELECT ... WHERE comment_parent IN ( p1, p2, p3...)
. However, an ORDER BY
clause was not included in this query, with the result that in certain environments (such as sites with large numbers of comments) MySQL could return results in unexpected order. This was discovered by @tellyworth on certain wordpress.com sites.
The proper fix is to add an ORDER BY
clause to the descendant query. The order can always be ASC
, because non-top-level comments have always been displayed in ascending order.
Attachments (2)
Change History (7)
#2
follow-up:
↓ 3
@
9 years ago
Should it be ordered by comment_ID
or comment_date
, for if the comment date has been edited?
#3
in reply to:
↑ 2
@
9 years ago
Replying to pento:
Should it be ordered by
comment_ID
orcomment_date
, for if the comment date has been edited?
Oh right, I forgot that this might be edited. Two things:
- I like to have
comment_ID
as at least the secondary sort, because comment timestamps can be shared, in which case we don't have a determinate order. comment_date
does not have an index, so we should usecomment_date_gmt
.
See 34838.2.diff
34838.diff adds the ORDER BY clause. @pento Can I get an RC review please?