forked from MirrorHub/synapse
Don't de-delta state groups we're about to delete
This commit is contained in:
parent
b64d312421
commit
8e345ce465
1 changed files with 9 additions and 11 deletions
|
@ -2080,19 +2080,14 @@ class EventsStore(SQLBaseStore):
|
||||||
)
|
)
|
||||||
|
|
||||||
state_rows = txn.fetchall()
|
state_rows = txn.fetchall()
|
||||||
state_groups_to_delete = [sg for sg, in state_rows]
|
state_groups_to_delete = set([sg for sg, in state_rows])
|
||||||
|
|
||||||
logger.debug(
|
|
||||||
"[purge] finding state groups which depend on redundant state groups"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Now we get all the state groups that rely on these state groups
|
# Now we get all the state groups that rely on these state groups
|
||||||
|
logger.debug("[purge] finding state groups which depend on redundant"
|
||||||
|
" state groups")
|
||||||
new_state_edges = []
|
new_state_edges = []
|
||||||
chunks = [
|
for i in xrange(0, len(state_rows), 100):
|
||||||
state_groups_to_delete[i:i + 100]
|
chunk = [sg for sg, in state_rows[i:i + 100]]
|
||||||
for i in xrange(0, len(state_groups_to_delete), 100)
|
|
||||||
]
|
|
||||||
for chunk in chunks:
|
|
||||||
rows = self._simple_select_many_txn(
|
rows = self._simple_select_many_txn(
|
||||||
txn,
|
txn,
|
||||||
table="state_group_edges",
|
table="state_group_edges",
|
||||||
|
@ -2101,7 +2096,10 @@ class EventsStore(SQLBaseStore):
|
||||||
retcols=["state_group"],
|
retcols=["state_group"],
|
||||||
keyvalues={},
|
keyvalues={},
|
||||||
)
|
)
|
||||||
new_state_edges.extend(row["state_group"] for row in rows)
|
new_state_edges.extend(
|
||||||
|
row["state_group"] for row in rows
|
||||||
|
if row["state_group"] not in state_groups_to_delete
|
||||||
|
)
|
||||||
|
|
||||||
# Now we turn the state groups that reference to-be-deleted state groups
|
# Now we turn the state groups that reference to-be-deleted state groups
|
||||||
# to non delta versions.
|
# to non delta versions.
|
||||||
|
|
Loading…
Reference in a new issue