summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-10-02 16:09:02 +0100
committerGitHub <noreply@github.com>2019-10-02 16:09:02 +0100
commit5d8ffdfe6111227bd46a434c33a379fedfa7b78a (patch)
tree9799e907b14d8a4ef784db52ee0ba6156ddbef66 /synapse/storage
parentMerge pull request #6152 from matrix-org/erikj/fix_room_list (diff)
parentNewsfile (diff)
downloadsynapse-5d8ffdfe6111227bd46a434c33a379fedfa7b78a.tar.xz
Merge pull request #6148 from matrix-org/erikj/find_next_generated
Bound find_next_generated_user_id DB query.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/registration.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 241a7be51e..1a859352b6 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -493,7 +493,9 @@ class RegistrationWorkerStore(SQLBaseStore):
         """
 
         def _find_next_generated_user_id(txn):
-            txn.execute("SELECT name FROM users")
+            # We bound between '@1' and '@a' to avoid pulling the entire table
+            # out.
+            txn.execute("SELECT name FROM users WHERE '@1' <= name AND name < '@a'")
 
             regex = re.compile(r"^@(\d+):")