mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-06 14:25:00 -04:00
Replace device_27_unique_idx bg update with a fg one (#7562)
The bg update never managed to complete, because it kept being interrupted by transactions which want to take a lock. Just doing it in the foreground isn't that bad, and is a good deal simpler.
This commit is contained in:
parent
04729b86f8
commit
edd9a7214c
7 changed files with 104 additions and 65 deletions
|
@ -19,10 +19,12 @@ import logging
|
|||
import os
|
||||
import re
|
||||
from collections import Counter
|
||||
from typing import TextIO
|
||||
|
||||
import attr
|
||||
|
||||
from synapse.storage.engines.postgres import PostgresEngine
|
||||
from synapse.storage.types import Cursor
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -479,8 +481,7 @@ def _apply_module_schema_files(cur, database_engine, modname, names_and_streams)
|
|||
)
|
||||
|
||||
logger.info("applying schema %s for %s", name, modname)
|
||||
for statement in get_statements(stream):
|
||||
cur.execute(statement)
|
||||
execute_statements_from_stream(cur, stream)
|
||||
|
||||
# Mark as done.
|
||||
cur.execute(
|
||||
|
@ -538,8 +539,12 @@ def get_statements(f):
|
|||
|
||||
def executescript(txn, schema_path):
|
||||
with open(schema_path, "r") as f:
|
||||
for statement in get_statements(f):
|
||||
txn.execute(statement)
|
||||
execute_statements_from_stream(txn, f)
|
||||
|
||||
|
||||
def execute_statements_from_stream(cur: Cursor, f: TextIO):
|
||||
for statement in get_statements(f):
|
||||
cur.execute(statement)
|
||||
|
||||
|
||||
def _get_or_create_schema_state(txn, database_engine):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue