Opened 10 years ago
Closed 10 years ago
#34838 closed defect (bug) (fixed)
Comment descendant queries do not have determinate order
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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
@
10 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
@
10 years ago
Replying to pento:
Should it be ordered by
comment_IDorcomment_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_IDas at least the secondary sort, because comment timestamps can be shared, in which case we don't have a determinate order. comment_datedoes 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?