mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
disable optimisation for searching for state groups
when type filter includes wildcards on state_key
This commit is contained in:
parent
b2aba9e430
commit
865377a70d
@ -264,11 +264,13 @@ class StateGroupWorkerStore(SQLBaseStore):
|
|||||||
else:
|
else:
|
||||||
where_args = []
|
where_args = []
|
||||||
where_clauses = []
|
where_clauses = []
|
||||||
|
wildcard_types = False
|
||||||
if types is not None:
|
if types is not None:
|
||||||
for typ in types:
|
for typ in types:
|
||||||
if typ[1] is None:
|
if typ[1] is None:
|
||||||
where_clauses.append("(type = ?)")
|
where_clauses.append("(type = ?)")
|
||||||
where_args.extend(typ[0])
|
where_args.extend(typ[0])
|
||||||
|
wildcard_types = True
|
||||||
else:
|
else:
|
||||||
where_clauses.append("(type = ? AND state_key = ?)")
|
where_clauses.append("(type = ? AND state_key = ?)")
|
||||||
where_args.extend([typ[0], typ[1]])
|
where_args.extend([typ[0], typ[1]])
|
||||||
@ -302,9 +304,17 @@ class StateGroupWorkerStore(SQLBaseStore):
|
|||||||
if (typ, state_key) not in results[group]
|
if (typ, state_key) not in results[group]
|
||||||
)
|
)
|
||||||
|
|
||||||
# If the lengths match then we must have all the types,
|
# If the number of entries inthe (type,state_key)->event_id dict
|
||||||
# so no need to go walk further down the tree.
|
# matches the number of (type,state_keys) types we were searching
|
||||||
if types is not None and len(results[group]) == len(types):
|
# for, then we must have found them all, so no need to go walk
|
||||||
|
# further down the tree... UNLESS our types filter contained
|
||||||
|
# wildcards (i.e. Nones) in which case we have to do an exhaustive
|
||||||
|
# search
|
||||||
|
if (
|
||||||
|
types is not None and
|
||||||
|
not wildcard_types and
|
||||||
|
len(results[group]) == len(types)
|
||||||
|
):
|
||||||
break
|
break
|
||||||
|
|
||||||
next_group = self._simple_select_one_onecol_txn(
|
next_group = self._simple_select_one_onecol_txn(
|
||||||
|
Loading…
Reference in New Issue
Block a user