diff options
author | Neil Johnson <neil@matrix.org> | 2019-01-30 10:28:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-30 10:28:08 +0000 |
commit | ee4df7fd7a8d4ce7732ded1736f52d200d645f25 (patch) | |
tree | 79dfebdef9ce6951a7f6e3b2b657a768ddf86ffc /synapse/storage/_base.py | |
parent | define room dispositions for use in exposing room capabilities (diff) | |
parent | Merge pull request #4486 from xperimental/workaround-4216 (diff) | |
download | synapse-ee4df7fd7a8d4ce7732ded1736f52d200d645f25.tar.xz |
Merge branch 'develop' into neilj/room_capabilities
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r-- | synapse/storage/_base.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index f62f70b9f1..4872ff55b6 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -27,7 +27,7 @@ from twisted.internet import defer from synapse.api.errors import StoreError from synapse.metrics.background_process_metrics import run_as_background_process -from synapse.storage.engines import PostgresEngine +from synapse.storage.engines import PostgresEngine, Sqlite3Engine from synapse.util.caches.descriptors import Cache from synapse.util.logcontext import LoggingContext, PreserveLoggingContext from synapse.util.stringutils import exception_to_unicode @@ -196,6 +196,12 @@ class SQLBaseStore(object): # A set of tables that are not safe to use native upserts in. self._unsafe_to_upsert_tables = {"user_ips"} + # We add the user_directory_search table to the blacklist on SQLite + # because the existing search table does not have an index, making it + # unsafe to use native upserts. + if isinstance(self.database_engine, Sqlite3Engine): + self._unsafe_to_upsert_tables.add("user_directory_search") + if self.database_engine.can_native_upsert: # Check ASAP (and then later, every 1s) to see if we have finished # background updates of tables that aren't safe to update. @@ -230,7 +236,7 @@ class SQLBaseStore(object): self._unsafe_to_upsert_tables.discard("user_ips") # If there's any tables left to check, reschedule to run. - if self._unsafe_to_upsert_tables: + if updates: self._clock.call_later( 15.0, run_as_background_process, |