mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 16:44:49 -04:00
Remove Postgres 9.4 support (#5448)
This commit is contained in:
parent
6840ebeef8
commit
eba7caf09f
10 changed files with 50 additions and 79 deletions
|
@ -45,6 +45,10 @@ class PostgresEngine(object):
|
|||
# together. For example, version 8.1.5 will be returned as 80105
|
||||
self._version = db_conn.server_version
|
||||
|
||||
# Are we on a supported PostgreSQL version?
|
||||
if self._version < 90500:
|
||||
raise RuntimeError("Synapse requires PostgreSQL 9.5+ or above.")
|
||||
|
||||
db_conn.set_isolation_level(
|
||||
self.module.extensions.ISOLATION_LEVEL_REPEATABLE_READ
|
||||
)
|
||||
|
@ -64,9 +68,9 @@ class PostgresEngine(object):
|
|||
@property
|
||||
def can_native_upsert(self):
|
||||
"""
|
||||
Can we use native UPSERTs? This requires PostgreSQL 9.5+.
|
||||
Can we use native UPSERTs?
|
||||
"""
|
||||
return self._version >= 90500
|
||||
return True
|
||||
|
||||
def is_deadlock(self, error):
|
||||
if isinstance(error, self.module.DatabaseError):
|
||||
|
|
|
@ -341,29 +341,7 @@ class SearchStore(BackgroundUpdateStore):
|
|||
for entry in entries
|
||||
)
|
||||
|
||||
# inserts to a GIN index are normally batched up into a pending
|
||||
# list, and then all committed together once the list gets to a
|
||||
# certain size. The trouble with that is that postgres (pre-9.5)
|
||||
# uses work_mem to determine the length of the list, and work_mem
|
||||
# is typically very large.
|
||||
#
|
||||
# We therefore reduce work_mem while we do the insert.
|
||||
#
|
||||
# (postgres 9.5 uses the separate gin_pending_list_limit setting,
|
||||
# so doesn't suffer the same problem, but changing work_mem will
|
||||
# be harmless)
|
||||
#
|
||||
# Note that we don't need to worry about restoring it on
|
||||
# exception, because exceptions will cause the transaction to be
|
||||
# rolled back, including the effects of the SET command.
|
||||
#
|
||||
# Also: we use SET rather than SET LOCAL because there's lots of
|
||||
# other stuff going on in this transaction, which want to have the
|
||||
# normal work_mem setting.
|
||||
|
||||
txn.execute("SET work_mem='256kB'")
|
||||
txn.executemany(sql, args)
|
||||
txn.execute("RESET work_mem")
|
||||
|
||||
elif isinstance(self.database_engine, Sqlite3Engine):
|
||||
sql = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue