summary refs log tree commit diff
path: root/synapse/storage/databases/main/transactions.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Replace `or_ignore` in `simple_insert` with `simple_upsert` (#10442)Erik Johnston2021-07-221-3/+5
| | | | | | | | Now that we have `simple_upsert` that should be used in preference to trying to insert and looking for an exception. The main benefit is that we ERROR message don't get written to postgres logs. We also have tidy up the return value on `simple_upsert`, rather than having a tri-state of inserted/not-inserted/unknown.
* Don't hammer the database for destination retry timings every ~5mins (#10036)Erik Johnston2021-05-211-29/+37
|
* Revert "Experimental Federation Speedup (#9702)"Andrew Morgan2021-04-281-12/+16
| | | | This reverts commit 05e8c70c059f8ebb066e029bc3aa3e0cefef1019.
* Experimental Federation Speedup (#9702)Jonathan de Jong2021-04-141-16/+12
| | | | | This basically speeds up federation by "squeezing" each individual dual database call (to destinations and destination_rooms), which previously happened per every event, into one call for an entire batch (100 max). Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Fix federation stall on concurrent access errors (#9639)Jonathan de Jong2021-03-231-36/+9
|
* Don't go into federation catch up mode so easily (#9561)Erik Johnston2021-03-151-5/+5
| | | | | | | | | | Federation catch up mode is very inefficient if the number of events that the remote server has missed is small, since handling gaps can be very expensive, c.f. #9492. Instead of going into catch up mode whenever we see an error, we instead do so only if we've backed off from trying the remote for more than an hour (the assumption being that in such a case it is more than a transient failure).
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-6/+13
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Fix some typos.Patrick Cloke2021-02-121-1/+1
|
* Fix get destinations to catch up query. (#9114)Erik Johnston2021-01-141-13/+11
| | | | t was doing a sequential scan on `destination_rooms`, which took minutes.
* Use autocommit mode for single statement DB functions. (#8542)Erik Johnston2020-10-141-31/+45
| | | | | | | | | | | | | Autocommit means that we don't wrap the functions in transactions, and instead get executed directly. Introduced in #8456. This will help: 1. reduce the number of `could not serialize access due to concurrent delete` errors that we see (though there are a few functions that often cause serialization errors that we don't fix here); 2. improve the DB performance, as it no longer needs to deal with the overhead of `REPEATABLE READ` isolation levels; and 3. improve wall clock speed of these functions, as we no longer need to send `BEGIN` and `COMMIT` to the DB. Some notes about the differences between autocommit mode and our default `REPEATABLE READ` transactions: 1. Currently `autocommit` only applies when using PostgreSQL, and is ignored when using SQLite (due to silliness with [Twisted DB classes](https://twistedmatrix.com/trac/ticket/9998)). 2. Autocommit functions may get retried on error, which means they can get applied *twice* (or more) to the DB (since they are not in a transaction the previous call would not get rolled back). This means that the functions need to be idempotent (or otherwise not care about being called multiple times). Read queries, simple deletes, and updates/upserts that replace rows (rather than generating new values from existing rows) are all idempotent. 3. Autocommit functions no longer get executed in [`REPEATABLE READ`](https://www.postgresql.org/docs/current/transaction-iso.html) isolation level, and so data can change queries, which is fine for single statement queries.
* Move additional tasks to the background worker (#8458)Patrick Cloke2020-10-071-20/+22
|
* Catch-up after Federation Outage (bonus): Catch-up on Synapse Startup (#8322)reivilibre2020-09-181-2/+64
| | | | | | | | | | Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> * Fix _set_destination_retry_timings This came about because the code assumed that retry_interval could not be NULL — which has been challenged by catch-up.
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-1/+1
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Catch-up after Federation Outage (split, 4): catch-up loop (#8272)reivilibre2020-09-151-1/+42
|
* Catch up after Federation Outage (split, 2): Track last successful stream ↵reivilibre2020-09-041-0/+38
| | | | | ordering after transmission (#8247) Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Catch-up after Federation Outage (split, 1) (#8230)reivilibre2020-09-041-3/+63
| | | Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
* Convert additional database code to async/await. (#8195)Patrick Cloke2020-08-281-16/+23
|
* Convert calls of async database methods to async (#8166)Patrick Cloke2020-08-271-8/+10
|
* Convert appservice, group server, profile and more databases to async (#8066)Patrick Cloke2020-08-121-5/+2
|
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-051-0/+269