summary refs log tree commit diff
path: root/synapse/storage/schema/delta/44
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2017-11-21 11:03:21 +0000
committerRichard van der Hoff <richard@matrix.org>2017-11-21 11:14:17 +0000
commit7098b65cb8c7e0b41a3bcb8ac7d2cc9e63f06f82 (patch)
treedfc20c195c9a648338997095e974436b45463158 /synapse/storage/schema/delta/44
parentdon't double-invite in sync_room_to_group.pl (diff)
downloadsynapse-7098b65cb8c7e0b41a3bcb8ac7d2cc9e63f06f82.tar.xz
Fix error on sqlite 3.7
Create the url_cache index on local_media_repository as a background update, so
that we can detect whether we are on sqlite or not and create a partial or
complete index accordingly.

To avoid running the cleanup job before we have built the index, add a bailout
which will defer the cleanup if the bg updates are still running.

Fixes https://github.com/matrix-org/synapse/issues/2572.
Diffstat (limited to 'synapse/storage/schema/delta/44')
-rw-r--r--synapse/storage/schema/delta/44/expire_url_cache.sql5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/storage/schema/delta/44/expire_url_cache.sql b/synapse/storage/schema/delta/44/expire_url_cache.sql
index e2b775f038..b12f9b2ebf 100644
--- a/synapse/storage/schema/delta/44/expire_url_cache.sql
+++ b/synapse/storage/schema/delta/44/expire_url_cache.sql
@@ -13,7 +13,10 @@
  * limitations under the License.
  */
 
-CREATE INDEX local_media_repository_url_idx ON local_media_repository(created_ts) WHERE url_cache IS NOT NULL;
+-- this didn't work on SQLite 3.7 (because of lack of partial indexes), so was
+-- removed and replaced with 46/local_media_repository_url_idx.sql.
+--
+-- CREATE INDEX local_media_repository_url_idx ON local_media_repository(created_ts) WHERE url_cache IS NOT NULL;
 
 -- we need to change `expires` to `expires_ts` so that we can index on it. SQLite doesn't support
 -- indices on expressions until 3.9.