Skip to content
Snippets Groups Projects
  1. Sep 24, 2020
    • Erik Johnston's avatar
      Fix MultiWriteIdGenerator's handling of restarts. (#8374) · f112cfe5
      Erik Johnston authored
      On startup `MultiWriteIdGenerator` fetches the maximum stream ID for
      each instance from the table and uses that as its initial "current
      position" for each writer. This is problematic as a) it involves either
      a scan of events table or an index (neither of which is ideal), and b)
      if rows are being persisted out of order elsewhere while the process
      restarts then using the maximum stream ID is not correct. This could
      theoretically lead to race conditions where e.g. events that are
      persisted out of order are not sent down sync streams.
      
      We fix this by creating a new table that tracks the current positions of
      each writer to the stream, and update it each time we finish persisting
      a new entry. This is a relatively small overhead when persisting events.
      However for the cache invalidation stream this is a much bigger relative
      overhead, so instead we note that for invalidation we don't actually
      care about reliability over restarts (as there's no caches to
      invalidate) and simply don't bother reading and writing to the new table
      in that particular case.
      Unverified
      f112cfe5
    • Richard van der Hoff's avatar
    • Erik Johnston's avatar
      Unverified
      6fdf5775
    • Erik Johnston's avatar
      Add EventStreamPosition type (#8388) · ac11fcbb
      Erik Johnston authored
      The idea is to remove some of the places we pass around `int`, where it can represent one of two things:
      
      1. the position of an event in the stream; or
      2. a token that partitions the stream, used as part of the stream tokens.
      
      The valid operations are then:
      
      1. did a position happen before or after a token;
      2. get all events that happened before or after a token; and
      3. get all events between two tokens.
      
      (Note that we don't want to allow other operations as we want to change the tokens to be vector clocks rather than simple ints)
      Unverified
      ac11fcbb
    • Patrick Cloke's avatar
  2. Sep 23, 2020
  3. Sep 22, 2020
  4. Sep 21, 2020
  5. Sep 18, 2020
Loading