Merge pull request #923 from matrix-org/erikj/purge_history

Various purge_history fixes
This commit is contained in:
Erik Johnston 2016-07-15 13:23:29 +01:00 committed by GitHub
commit a2d288c6a9
2 changed files with 13 additions and 2 deletions

View File

@ -92,7 +92,8 @@ class DataStore(RoomMemberStore, RoomStore,
extra_tables=[("local_invites", "stream_id")]
)
self._backfill_id_gen = StreamIdGenerator(
db_conn, "events", "stream_ordering", step=-1
db_conn, "events", "stream_ordering", step=-1,
extra_tables=[("ex_outlier_stream", "event_stream_ordering")]
)
self._receipts_id_gen = StreamIdGenerator(
db_conn, "receipts_linearized", "stream_id"

View File

@ -1411,11 +1411,21 @@ class EventsStore(SQLBaseStore):
to_delete
)
txn.execute(
"SELECT event_id FROM event_backward_extremities WHERE room_id = ?",
(room_id,)
)
cur_back_event_ids = [event_id for event_id, in txn.fetchall()]
# Update backward extremeties
txn.executemany(
"INSERT INTO event_backward_extremities (room_id, event_id)"
" VALUES (?, ?)",
[(room_id, event_id) for event_id, in new_backwards_extrems]
[
(room_id, event_id) for event_id, in new_backwards_extrems
if event_id not in cur_back_event_ids
]
)
txn.executemany(