Skip to content
Snippets Groups Projects
  1. Feb 01, 2023
    • Patrick Cloke's avatar
      Attempt to delete more duplicate rows in receipts_linearized table. (#14915) · 230a831c
      Patrick Cloke authored
      The previous assumption was that the stream_id column was unique
      (for a room ID, receipt type, user ID tuple), but this turned out to be
      incorrect.
      
      Now find the max stream ID, then map this back to a database-specific
      row identifier and delete other rows which match the (room ID, receipt type,
      user ID) tuple, but *not* the row ID.
      230a831c
  2. Dec 09, 2022
  3. Nov 16, 2022
    • Sean Quah's avatar
      Fix background updates failing to add unique indexes on receipts (#14453) · 88227700
      Sean Quah authored
      
      As part of the database migration to support threaded receipts, there is
      a possible window in between
      `73/08thread_receipts_non_null.sql.postgres` removing the original
      unique constraints on `receipts_linearized` and `receipts_graph` and the
      `reeipts_linearized_unique_index` and `receipts_graph_unique_index`
      background updates from `72/08thread_receipts.sql` completing where
      the unique constraints on `receipts_linearized` and `receipts_graph` are
      missing. Any emulated upserts on these tables must therefore be
      performed with a lock held, otherwise duplicate rows can end up in the
      tables when there are concurrent emulated upserts. Fix the missing lock.
      
      Note that emulated upserts no longer happen by default on sqlite, since
      the minimum supported version of sqlite supports native upserts by
      default now.
      
      Finally, clean up any duplicate receipts that may have crept in before
      trying to create the `receipts_graph_unique_index` and
      `receipts_linearized_unique_index` unique indexes.
      
      Signed-off-by: default avatarSean Quah <seanq@matrix.org>
      88227700
Loading