Skip to content
Snippets Groups Projects
  1. Nov 29, 2022
  2. Nov 28, 2022
    • vlorentz's avatar
    • vlorentz's avatar
      storage: Insert from temporary tables in consistent order · f7833b7e
      vlorentz authored
      This avoids having a transaction inserting row A then B, while another
      inserts row B then A; which (probably) leads to deadlocks like this:
      
      ```
      DeadlockDetected: deadlock detected
      DETAIL:  Process 1842336 waits for ShareLock on transaction 1051957280; blocked by process 64261.
      Process 64261 waits for ShareLock on transaction 1051957281; blocked by process 1842336.
      HINT:  See server log for query details.
      CONTEXT:  while inserting index tuple (1972253,5) in relation "origin_extrinsic_metadata"
      SQL statement "insert into origin_extrinsic_metadata (id, metadata, indexer_configuration_id, from_remd_id, metadata_tsvector, mappings)
      ```
      
      https://sentry.softwareheritage.org/share/issue/52b06caae89f4235a758887fd6817656/
      
      This was already mitigating by sorting before inserting in temporary
      tables, then expecting postgresql to read from temporary tables in the
      same order rows where inserted. This is often true, but not guaranteed.
      
      No test for this, because I do not see a way to replicate this more than
      existing deadlock tests do.
      f7833b7e
  3. Nov 23, 2022
  4. Nov 21, 2022
  5. Nov 03, 2022
  6. Nov 02, 2022
  7. Oct 27, 2022
  8. Oct 26, 2022
  9. Oct 25, 2022
  10. Oct 24, 2022
  11. Oct 18, 2022
  12. Oct 07, 2022
  13. Sep 28, 2022
  14. Sep 27, 2022
  15. Sep 12, 2022
Loading