HomePhabricator
Diffusion Comm 23d980beaf38

[keyserver] Use message ID as tiebreaker in message-fetchers code

Description

[keyserver] Use message ID as tiebreaker in message-fetchers code

Summary:
In D4675, @tomek pointed out that our results may be inconsistent in the case where two messages have the same timestamp. While this scenario is unlikely, it is technically possible.

To make the results consistent we can add a "tiebreaker" as a second ORDER BY parameter. This diff adds id as the tiebreaker for all message-fetchers.js functions that return ordered lists.

Tracked in ENG-1488.

Test Plan:

  1. I compared the web inbox in my local environment between master and with this diff to make sure the same chats appeared in the same order with the same set of messages inside them.
  2. First, I ran the query with the PREDICATE manually in MariaDB to make sure it worked, since that was a special case.
  3. Then I patched this diff onto prod and deployed it to make sure that the queries still worked without issue (including without performance issues).

Reviewers: tomek, atul

Reviewed By: atul

Subscribers: adrian, abosh, tomek

Differential Revision: https://phab.comm.dev/D4722

Details

Provenance
ashoatAuthored on Aug 2 2022, 12:35 PM
Reviewer
atul
Differential Revision
D4722: [keyserver] Use message ID as tiebreaker in message-fetchers code
Parents
rCOMM8d121152a74e: [tunnelbroker] Removed unused include directives
Branches
Unknown
Tags
Unknown