mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 04:23:01 +08:00
This commit fixes an undesirable geometric query memory usage introduced in b908abe35a
(#29539)
I have been unable to figure out a way of testing this usefully (as I fear it would require creating several thousands of objects), but existing tests pass and a manual test with ~400k topics succeeds after the fix, while it would hang indefinitely and/or consume all disk space before the fix. I have reported the initial problem and my findings in https://meta.discourse.org/t/topic-reset-all-highest-exhausts-all-available-disk-space/333837
This commit is contained in:
parent
f4865a4288
commit
725d2411e5
|
@ -881,7 +881,8 @@ class Topic < ActiveRecord::Base
|
|||
WHERE
|
||||
topics.archetype <> 'private_message' AND
|
||||
X.topic_id = topics.id AND
|
||||
Y.topic_id = topics.id AND (
|
||||
Y.topic_id = topics.id AND
|
||||
Z.topic_id = topics.id AND (
|
||||
topics.highest_staff_post_number <> X.highest_post_number OR
|
||||
topics.highest_post_number <> Y.highest_post_number OR
|
||||
topics.last_posted_at <> Y.last_posted_at OR
|
||||
|
@ -926,7 +927,8 @@ class Topic < ActiveRecord::Base
|
|||
WHERE
|
||||
topics.archetype = 'private_message' AND
|
||||
X.topic_id = topics.id AND
|
||||
Y.topic_id = topics.id AND (
|
||||
Y.topic_id = topics.id AND
|
||||
Z.topic_id = topics.id AND (
|
||||
topics.highest_staff_post_number <> X.highest_post_number OR
|
||||
topics.highest_post_number <> Y.highest_post_number OR
|
||||
topics.last_posted_at <> Y.last_posted_at OR
|
||||
|
|
Loading…
Reference in New Issue
Block a user