From 318162f5debc595d3381337fe363fa7936cc7843 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Fri, 10 Sep 2021 10:54:38 +0100 Subject: Easy refactors of the user directory (#10789) No functional changes here. This came out as I was working to tackle #5677 --- docs/user_directory.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'docs') diff --git a/docs/user_directory.md b/docs/user_directory.md index d4f38d2cf1..07fe954891 100644 --- a/docs/user_directory.md +++ b/docs/user_directory.md @@ -10,3 +10,40 @@ DB corruption) get stale or out of sync. If this happens, for now the solution to fix it is to execute the SQL [here](https://github.com/matrix-org/synapse/blob/master/synapse/storage/schema/main/delta/53/user_dir_populate.sql) and then restart synapse. This should then start a background task to flush the current tables and regenerate the directory. + +Data model +---------- + +There are five relevant tables that collectively form the "user directory". +Three of them track a master list of all the users we could search for. +The last two (collectively called the "search tables") track who can +see who. + +From all of these tables we exclude three types of local user: + - support users + - appservice users + - deactivated users + +* `user_directory`. This contains the user_id, display name and avatar we'll + return when you search the directory. + - Because there's only one directory entry per user, it's important that we only + ever put publicly visible names here. Otherwise we might leak a private + nickname or avatar used in a private room. + - Indexed on rooms. Indexed on users. + +* `user_directory_search`. To be joined to `user_directory`. It contains an extra + column that enables full text search based on user ids and display names. + Different schemas for SQLite and Postgres with different code paths to match. + - Indexed on the full text search data. Indexed on users. + +* `user_directory_stream_pos`. When the initial background update to populate + the directory is complete, we record a stream position here. This indicates + that synapse should now listen for room changes and incrementally update + the directory where necessary. + +* `users_in_public_rooms`. Contains associations between users and the public rooms they're in. + Used to determine which users are in public rooms and should be publicly visible in the directory. + +* `users_who_share_private_rooms`. Rows are triples `(L, M, room id)` where `L` + is a local user and `M` is a local or remote user. `L` and `M` should be + different, but this isn't enforced by a constraint. -- cgit 1.5.1 From ceab5a4bfa5a447b674a7e593217849770bfa7d5 Mon Sep 17 00:00:00 2001 From: reivilibre <38398653+reivilibre@users.noreply.github.com> Date: Fri, 10 Sep 2021 16:33:36 +0100 Subject: Fix 2 typos in docs/log_contexts.md (#10795) --- changelog.d/10795.doc | 1 + docs/log_contexts.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/10795.doc (limited to 'docs') diff --git a/changelog.d/10795.doc b/changelog.d/10795.doc new file mode 100644 index 0000000000..3a0b622825 --- /dev/null +++ b/changelog.d/10795.doc @@ -0,0 +1 @@ +Correct 2 typographical errors in the *Log Contexts* documentation. diff --git a/docs/log_contexts.md b/docs/log_contexts.md index d49dce8830..cb15dbe158 100644 --- a/docs/log_contexts.md +++ b/docs/log_contexts.md @@ -10,7 +10,7 @@ Logcontexts are also used for CPU and database accounting, so that we can track which requests were responsible for high CPU use or database activity. -The `synapse.logging.context` module provides a facilities for managing +The `synapse.logging.context` module provides facilities for managing the current log context (as well as providing the `LoggingContextFilter` class). @@ -351,7 +351,7 @@ and the awaitable chain is now orphaned, and will be garbage-collected at some point. Note that `await_something_interesting` is a coroutine, which Python implements as a generator function. When Python garbage-collects generator functions, it gives them a chance to -clean up by making the `async` (or `yield`) raise a `GeneratorExit` +clean up by making the `await` (or `yield`) raise a `GeneratorExit` exception. In our case, that means that the `__exit__` handler of `PreserveLoggingContext` will carefully restore the request context, but there is now nothing waiting for its return, so the request context is -- cgit 1.5.1 From 9f111075e8204dd55e141f04d78e06c718892956 Mon Sep 17 00:00:00 2001 From: BramvdnHeuvel <43719024+BramvdnHeuvel@users.noreply.github.com> Date: Mon, 13 Sep 2021 14:58:34 +0200 Subject: Fix copy-paste error in the password section of the sample-config. (#10804) --- changelog.d/10804.doc | 1 + docs/sample_config.yaml | 2 +- synapse/config/auth.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/10804.doc (limited to 'docs') diff --git a/changelog.d/10804.doc b/changelog.d/10804.doc new file mode 100644 index 0000000000..5d57af3b5f --- /dev/null +++ b/changelog.d/10804.doc @@ -0,0 +1 @@ +Fixed a wording mistake in the sample configuration. Contributed by @bramvdnheuvel:nltrix.net. diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index e15a832220..95cca16552 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -2086,7 +2086,7 @@ password_config: # #require_lowercase: true - # Whether a password must contain at least one lowercase letter. + # Whether a password must contain at least one uppercase letter. # Defaults to 'false'. # #require_uppercase: true diff --git a/synapse/config/auth.py b/synapse/config/auth.py index 53809cee2e..ba8bf9cbe7 100644 --- a/synapse/config/auth.py +++ b/synapse/config/auth.py @@ -88,7 +88,7 @@ class AuthConfig(Config): # #require_lowercase: true - # Whether a password must contain at least one lowercase letter. + # Whether a password must contain at least one uppercase letter. # Defaults to 'false'. # #require_uppercase: true -- cgit 1.5.1