Page MenuHomePhabricator

Fix an issue where paginating notifications could fail a GROUP BY test
ClosedPublic

Authored by epriestley on Feb 26 2021, 6:45 PM.
Tags
None
Referenced Files
F18336473: D21577.diff
Mon, Aug 25, 2:53 PM
F18106508: D21577.id51365.diff
Sun, Aug 10, 11:06 PM
F18106507: D21577.id.diff
Sun, Aug 10, 11:06 PM
F17815748: D21577.id51377.diff
Jul 25 2025, 10:13 PM
F17796521: D21577.diff
Jul 25 2025, 1:01 AM
F17698110: D21577.id51365.diff
Jul 15 2025, 6:57 PM
F17680002: D21577.diff
Jul 13 2025, 3:04 PM
Unknown Object (File)
Jun 5 2025, 5:08 PM
Subscribers
None

Details

Summary

Ref T13623. When paginating notifications, we may currently construct a query which:

  • loads from non-unique rows; and
  • returns multiple results.

In particular, chronologicalKey isn't unique across the whole table (only for a given viewer). We can get away with this because no user-facing view of notifications is truly "every notification for every viewer" today.

One fix would be to implicitly force the paging query to include withUserPHIDs(viewerPHID), but puruse a slightly more general fix:

  • Load only unique stories.
  • Explictly limit the pagination subquery to one result.
Test Plan
  • Set page size to 1, inserted duplicate notifications of all stories for another user, clicked "Next", got the GROUP BY error.
  • Applied the "only load unique stories" part of the change, got a "expected one row" error instead.
  • Applied the "limit 1" part of the change, got a second page of notifications.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable