summary refs log tree commit diff
path: root/synapse/storage/prepare_database.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-09-07 13:36:02 +0100
committerGitHub <noreply@github.com>2020-09-07 13:36:02 +0100
commit0dae7d80bfb497d417a53e52b8353bbcd6d10d58 (patch)
treedfd723493a93ce2e78c20cc13767ee379bc0ed50 /synapse/storage/prepare_database.py
parentRefuse to upgrade database on worker processes (#8266) (diff)
downloadsynapse-0dae7d80bfb497d417a53e52b8353bbcd6d10d58.tar.xz
Add more logging to debug slow startup (#8264)
I'm hoping this will provide some pointers for debugging
https://github.com/matrix-org/synapse/issues/7968.
Diffstat (limited to 'synapse/storage/prepare_database.py')
-rw-r--r--synapse/storage/prepare_database.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/storage/prepare_database.py b/synapse/storage/prepare_database.py
index 93dca96476..ee60e2a718 100644
--- a/synapse/storage/prepare_database.py
+++ b/synapse/storage/prepare_database.py
@@ -82,10 +82,18 @@ def prepare_database(db_conn, database_engine, config, databases=["main", "state
 
     try:
         cur = db_conn.cursor()
+
+        logger.info("%r: Checking existing schema version", databases)
         version_info = _get_or_create_schema_state(cur, database_engine)
 
         if version_info:
             user_version, delta_files, upgraded = version_info
+            logger.info(
+                "%r: Existing schema is %i (+%i deltas)",
+                databases,
+                user_version,
+                len(delta_files),
+            )
 
             # config should only be None when we are preparing an in-memory SQLite db,
             # which should be empty.
@@ -111,6 +119,8 @@ def prepare_database(db_conn, database_engine, config, databases=["main", "state
                 databases=databases,
             )
         else:
+            logger.info("%r: Initialising new database", databases)
+
             # if it's a worker app, refuse to upgrade the database, to avoid multiple
             # workers doing it at once.
             if config and config.worker_app is not None: