Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
099c96b8
Unverified
Commit
099c96b8
authored
5 years ago
by
Erik Johnston
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Revert `get_auth_chain_ids` changes (#6951)
parent
2fb7794e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/6951.misc
+1
-0
1 addition, 0 deletions
changelog.d/6951.misc
synapse/storage/data_stores/main/event_federation.py
+0
-28
0 additions, 28 deletions
synapse/storage/data_stores/main/event_federation.py
with
1 addition
and
28 deletions
changelog.d/6951.misc
0 → 100644
+
1
−
0
View file @
099c96b8
Revert #6937.
This diff is collapsed.
Click to expand it.
synapse/storage/data_stores/main/event_federation.py
+
0
−
28
View file @
099c96b8
...
@@ -26,7 +26,6 @@ from synapse.storage._base import SQLBaseStore, make_in_list_sql_clause
...
@@ -26,7 +26,6 @@ from synapse.storage._base import SQLBaseStore, make_in_list_sql_clause
from
synapse.storage.data_stores.main.events_worker
import
EventsWorkerStore
from
synapse.storage.data_stores.main.events_worker
import
EventsWorkerStore
from
synapse.storage.data_stores.main.signatures
import
SignatureWorkerStore
from
synapse.storage.data_stores.main.signatures
import
SignatureWorkerStore
from
synapse.storage.database
import
Database
from
synapse.storage.database
import
Database
from
synapse.storage.engines
import
PostgresEngine
from
synapse.util.caches.descriptors
import
cached
from
synapse.util.caches.descriptors
import
cached
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -67,33 +66,6 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas
...
@@ -67,33 +66,6 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas
else
:
else
:
results
=
set
()
results
=
set
()
if
isinstance
(
self
.
database_engine
,
PostgresEngine
):
# For efficiency we make the database do this if we can.
# We need to be a little careful with querying large amounts at
# once, for some reason postgres really doesn't like it. We do this
# by only asking for auth chain of 500 events at a time.
event_ids
=
list
(
event_ids
)
chunks
=
[
event_ids
[
x
:
x
+
500
]
for
x
in
range
(
0
,
len
(
event_ids
),
500
)]
for
chunk
in
chunks
:
sql
=
"""
WITH RECURSIVE auth_chain(event_id) AS (
SELECT auth_id FROM event_auth WHERE event_id = ANY(?)
UNION
SELECT auth_id FROM event_auth
INNER JOIN auth_chain USING (event_id)
)
SELECT event_id FROM auth_chain
"""
txn
.
execute
(
sql
,
(
chunk
,))
results
.
update
(
event_id
for
event_id
,
in
txn
)
return
list
(
results
)
# Database doesn't necessarily support recursive CTE, so we fall
# back to do doing it manually.
base_sql
=
"
SELECT auth_id FROM event_auth WHERE
"
base_sql
=
"
SELECT auth_id FROM event_auth WHERE
"
front
=
set
(
event_ids
)
front
=
set
(
event_ids
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment