summary refs log tree commit diff
path: root/synapse/storage/schema
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-11-09 14:37:28 +0000
committerMark Haines <mark.haines@matrix.org>2015-11-09 17:26:27 +0000
commitc6a01f2ed0da9f0db169307e7d1649021f0c2123 (patch)
tree63388432618617dfaad3abf6c5f328075cb322f5 /synapse/storage/schema
parentMerge pull request #353 from matrix-org/daniel/oops (diff)
downloadsynapse-c6a01f2ed0da9f0db169307e7d1649021f0c2123.tar.xz
Add storage module for tracking background updates.
The progress for each background update is stored as a JSON blob in the
database. Each background update is broken up into separate batches.
The batch size is automatically tuned to try avoid blocking single
threaded databases for too long.
Diffstat (limited to 'synapse/storage/schema')
-rw-r--r--synapse/storage/schema/delta/25/00background_updates.sql21
1 files changed, 21 insertions, 0 deletions
diff --git a/synapse/storage/schema/delta/25/00background_updates.sql b/synapse/storage/schema/delta/25/00background_updates.sql
new file mode 100644
index 0000000000..41a9b59b1b
--- /dev/null
+++ b/synapse/storage/schema/delta/25/00background_updates.sql
@@ -0,0 +1,21 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+CREATE TABLE IF NOT EXISTS background_updates(
+    update_name TEXT NOT NULL, -- The name of the background update.
+    progress_json TEXT NOT NULL, -- The current progress of the update as JSON.
+    CONSTRAINT background_updates_uniqueness UNIQUE (update_name)
+);