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

Commit 8748af6

Browse files
committed
Move clear_partial_state_room to RoomStore since it's not usable on workers for now
1 parent 1e0e9c2 commit 8748af6

File tree

1 file changed

+0
-64
lines changed
  • synapse/storage/databases/main

1 file changed

+0
-64
lines changed

synapse/storage/databases/main/room.py

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,70 +1238,6 @@ async def get_partial_state_room_resync_info(
12381238

12391239
return room_servers
12401240

1241-
async def clear_partial_state_room(self, room_id: str) -> bool:
1242-
"""Clears the partial state flag for a room.
1243-
1244-
Args:
1245-
room_id: The room whose partial state flag is to be cleared.
1246-
1247-
Returns:
1248-
`True` if the partial state flag has been cleared successfully.
1249-
1250-
`False` if the partial state flag could not be cleared because the room
1251-
still contains events with partial state.
1252-
"""
1253-
try:
1254-
await self.db_pool.runInteraction(
1255-
"clear_partial_state_room", self._clear_partial_state_room_txn, room_id
1256-
)
1257-
return True
1258-
except self.db_pool.engine.module.IntegrityError as e:
1259-
# Assume that any `IntegrityError`s are due to partial state events.
1260-
logger.info(
1261-
"Exception while clearing lazy partial-state-room %s, retrying: %s",
1262-
room_id,
1263-
e,
1264-
)
1265-
return False
1266-
1267-
def _clear_partial_state_room_txn(
1268-
self, txn: LoggingTransaction, room_id: str
1269-
) -> None:
1270-
DatabasePool.simple_delete_txn(
1271-
txn,
1272-
table="partial_state_rooms_servers",
1273-
keyvalues={"room_id": room_id},
1274-
)
1275-
DatabasePool.simple_delete_one_txn(
1276-
txn,
1277-
table="partial_state_rooms",
1278-
keyvalues={"room_id": room_id},
1279-
)
1280-
self._invalidate_cache_and_stream(txn, self.is_partial_state_room, (room_id,))
1281-
self._invalidate_cache_and_stream(
1282-
txn, self.get_partial_state_servers_at_join, (room_id,)
1283-
)
1284-
1285-
# We now delete anything from `device_lists_remote_pending` with a
1286-
# stream ID less than the minimum
1287-
# `partial_state_rooms.device_lists_stream_id`, as we no longer need them.
1288-
device_lists_stream_id = DatabasePool.simple_select_one_onecol_txn(
1289-
txn,
1290-
table="partial_state_rooms",
1291-
keyvalues={},
1292-
retcol="MIN(device_lists_stream_id)",
1293-
allow_none=True,
1294-
)
1295-
if device_lists_stream_id is None:
1296-
# There are no rooms being currently partially joined, so we delete everything.
1297-
txn.execute("DELETE FROM device_lists_remote_pending")
1298-
else:
1299-
sql = """
1300-
DELETE FROM device_lists_remote_pending
1301-
WHERE stream_id <= ?
1302-
"""
1303-
txn.execute(sql, (device_lists_stream_id,))
1304-
13051241
@cached()
13061242
async def is_partial_state_room(self, room_id: str) -> bool:
13071243
"""Checks if this room has partial state.

0 commit comments

Comments
 (0)