Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix instantiation of message retention purge jobs #6714

Merged
merged 9 commits into from
Jan 17, 2020

Conversation

babolivier
Copy link
Contributor

Fixes #6713 by fetching the first event before the stream ordering, instead of after when figuring out the topological token to run the purge job with.

When figuring out which topological token to start a purge job at, we
need to do the following:

1. Figure out a timestamp before which events will be purged
2. Select the first stream ordering after that timestamp
3. Select info about the first event after that stream ordering
4. Build a topological token from that info

In some situations (e.g. quiet rooms with a short max_lifetime), there
might not be an event after the stream ordering at step 3, therefore we
abort the purge with the error `No event found`. To mitigate that, this
patch fetches the first event _before_ the stream ordering, instead of
after.
@babolivier babolivier requested a review from a team January 15, 2020 19:40
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that the only use of get_room_event_after_stream_ordering is for purging, shouldn't we get rid of it?

@babolivier babolivier requested a review from a team January 16, 2020 20:31
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@babolivier babolivier merged commit 3b72bb7 into develop Jan 17, 2020
babolivier pushed a commit that referenced this pull request Sep 1, 2021
…event

* commit '3b72bb780':
  bump version to v1.9.0.dev1
  Precise changelog
  Fixup diff
  Remove get_room_event_after_stream_ordering entirely
  Lint
  Rename changelog
  Changelog
  Correctly order when selecting before stream ordering
  Fix typo
  Fix instantiation of message retention purge jobs
@babolivier babolivier deleted the babolivier/retention_select_event branch October 28, 2021 15:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants