Erik Johnston
4d70d1f80e
Add some invalidations to a cache_stream
2016-08-15 11:15:17 +01:00
Erik Johnston
99bbd90b0d
Always run txn.after_callbacks
2016-08-15 09:45:44 +01:00
Richard van der Hoff
053e83dafb
More doc-comments
...
Fix some more comments on some things
2016-07-20 16:40:28 +01:00
Erik Johnston
f328d95cef
Feature: Add deactivate account admin API
...
Allows server admins to "deactivate" accounts, which:
- Revokes all access tokens
- Removes all threepids
- Removes password
The API is a POST to `/admin/deactivate/<user_id>`
2016-06-30 15:40:58 +01:00
Mark Haines
80f34d7b57
Fix setting the _clock in SQLBaseStore
2016-06-02 15:23:56 +01:00
David Baker
d4503e25ed
Make deleting push actions more efficient
...
There's no index on received_ts, so manually binary search using the stream_ordering index, and only update it once an hour.
2016-05-20 17:56:10 +01:00
Erik Johnston
0c11c1be88
Spelling
2016-05-13 14:42:25 +01:00
Erik Johnston
13d37c3c56
Fixup add_pusher
2016-05-13 11:25:02 +01:00
Mark Haines
7e2f971c08
Remove some unused functions ( #711 )
...
* Remove some unused functions
* get_room_events_stream is only used in tests
* is_exclusive_room might actually be something we want
2016-04-08 14:01:56 +01:00
Mark Haines
a1e0d316ea
Move _get_cache_dict into the SQLBaseStore
2016-04-06 13:05:19 +01:00
Erik Johnston
acdfef7b14
Intern all the things
2016-03-23 16:25:54 +00:00
Erik Johnston
b591277620
Make stateGroupCache honour CACHE_SIZE_FACTOR
2016-03-22 10:32:50 +00:00
Mark Haines
a1cf9e3bf3
Add a stream for push rule updates
2016-03-01 18:16:37 +00:00
Erik Johnston
2c1fbea531
Fix up logcontexts
2016-02-08 14:26:45 +00:00
Daniel Wagner-Hall
d83d004ccd
Fix flake8 warnings for new flake8
2016-02-02 17:18:50 +00:00
Erik Johnston
87f9477b10
Add a Homeserver.setup method.
...
This is for setting up dependencies that require work on startup. This
is useful for the DataStore that wants to read a bunch from the database
before initiliazing.
2016-01-26 15:51:06 +00:00
Erik Johnston
aea5da0ef6
Guard against empty iterables
2016-01-25 15:59:29 +00:00
Erik Johnston
1ebf5e3d03
Correct docstring
2016-01-25 15:53:36 +00:00
Erik Johnston
ddd25def01
Implement a _simple_select_many_batch
2016-01-25 13:36:02 +00:00
Matthew Hodgson
6c28ac260c
copyrights
2016-01-07 04:26:29 +00:00
Mark Haines
6a5ff5f223
Track the time spent in the database per request.
...
and track the number of transactions that request started.
2015-12-07 17:56:11 +00:00
Erik Johnston
c85c912562
Add basic full text search impl.
2015-10-09 15:48:31 +01:00
Mark Haines
396834f1c0
synapse/storage/_base.py:_simple_max_id was unused
2015-09-23 10:30:38 +01:00
Mark Haines
1d9036aff2
synapse/storage/_base.py:_simple_delete was unused
2015-09-23 10:30:25 +01:00
Mark Haines
1ee3d26432
synapse/storage/_base.py:_simple_selectupdate_one was unused
2015-09-23 10:30:03 +01:00
Mark Haines
7dd4f79c49
synapse/storage/_base.py:_execute_and_decode was unused
2015-09-22 18:37:07 +01:00
Mark Haines
527d95dea0
synapse/storage/_base.py:Table was unused
2015-09-22 18:14:15 +01:00
Erik Johnston
b62c1395d6
Merge branch 'release-v0.10.0' of github.com:matrix-org/synapse into develop
2015-09-01 13:11:55 +01:00
Erik Johnston
cd800ad99a
Lower size of 'stateGroupCache' now that we have data from matrix.org to support doing so
2015-09-01 10:09:03 +01:00
Daniel Wagner-Hall
cecbd636e9
/tokenrefresh POST endpoint
...
This allows refresh tokens to be exchanged for (access_token,
refresh_token).
It also starts issuing them on login, though no clients currently
interpret them.
2015-08-20 16:21:35 +01:00
Erik Johnston
2df8dd9b37
Move all the caches into their own package, synapse.util.caches
2015-08-11 18:00:59 +01:00
Erik Johnston
53a817518b
Comments
2015-08-11 11:40:40 +01:00
Erik Johnston
6eaa116867
Comment
2015-08-11 11:35:24 +01:00
Erik Johnston
4762c276cb
Docs
2015-08-11 11:33:41 +01:00
Erik Johnston
bb0a475c30
Comments
2015-08-10 14:27:38 +01:00
Erik Johnston
7ce71f2ffc
Merge branch 'erikj/cache_varargs_interface' of github.com:matrix-org/synapse into erikj/dictionary_cache
2015-08-10 13:47:51 +01:00
Erik Johnston
86eaaa885b
Rename keyargs to args in CacheDescriptor
2015-08-10 13:44:44 +01:00
Erik Johnston
e0b6e49466
Merge branch 'erikj/cache_varargs_interface' of github.com:matrix-org/synapse into erikj/dictionary_cache
2015-08-10 10:39:22 +01:00
Erik Johnston
2cd6cb9f65
Rename keyargs to args in Cache
2015-08-10 10:38:47 +01:00
Erik Johnston
7dec0b2bee
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/dictionary_cache
2015-08-07 19:28:39 +01:00
Erik Johnston
2352974aab
Merge branch 'erikj/cache_deferreds' of github.com:matrix-org/synapse into erikj/cache_varargs_interface
2015-08-07 19:26:54 +01:00
Erik Johnston
9c5385b53a
s/observed/observer/
2015-08-07 19:26:38 +01:00
Erik Johnston
ffab798a38
Merge branch 'erikj/cache_deferreds' of github.com:matrix-org/synapse into erikj/cache_varargs_interface
2015-08-07 19:18:47 +01:00
Erik Johnston
62126c996c
Propogate stale cache errors to calling functions
2015-08-07 19:17:58 +01:00
Erik Johnston
20addfa358
Change Cache to not use *args in its interface
2015-08-07 18:32:47 +01:00
Erik Johnston
0211890134
Implement a CacheListDescriptor
2015-08-07 18:14:49 +01:00
Erik Johnston
b8e386db59
Change Cache to not use *args in its interface
2015-08-07 11:52:21 +01:00
Erik Johnston
1d08bf7c17
Merge branch 'erikj/cache_deferreds' into erikj/dictionary_cache
2015-08-06 14:03:15 +01:00
Erik Johnston
63b1eaf32c
Docs
2015-08-06 14:02:50 +01:00
Erik Johnston
b811c98574
Remove failed deferreds from cache
2015-08-06 14:01:27 +01:00
Erik Johnston
433314cc34
Re-implement DEBUG_CACHES flag
2015-08-06 14:01:05 +01:00
Erik Johnston
f596ff402e
Merge branch 'erikj/cache_deferreds' into erikj/dictionary_cache
2015-08-06 13:37:56 +01:00
Erik Johnston
2efb93af52
Merge branch 'erikj/cached_keyword_args' into erikj/cache_deferreds
2015-08-06 13:35:28 +01:00
Erik Johnston
953dbd28a7
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/cached_keyword_args
2015-08-06 13:35:03 +01:00
Erik Johnston
7eea3e356f
Make @cached cache deferreds rather than the deferreds' values
2015-08-06 13:33:34 +01:00
Erik Johnston
3e1b77efc2
Merge branch 'erikj/cached_keyword_args' of github.com:matrix-org/synapse into erikj/dictionary_cache
2015-08-05 16:45:56 +01:00
Erik Johnston
b52b4a84ec
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/dictionary_cache
2015-08-05 15:41:20 +01:00
Erik Johnston
a89559d797
Use LRU cache by default
2015-08-05 15:39:47 +01:00
Erik Johnston
07507643cb
Use dictionary cache to do group -> state fetching
2015-08-05 15:11:42 +01:00
Erik Johnston
4d6cb8814e
Speed up event filtering (for ACL) logic
2015-08-04 09:32:23 +01:00
Erik Johnston
39e21ea51c
Add support for using keyword arguments with cached functions
2015-07-27 13:57:29 +01:00
Erik Johnston
80a61330ee
Add basic storage functions for handling of receipts
2015-07-01 17:19:12 +01:00
Erik Johnston
d8866d7277
Caches should be bound to instances.
...
Before, caches were global and so different instances of the stores
would share caches. This caused problems in the unit tests.
2015-06-03 14:45:17 +01:00
Erik Johnston
4429e720ae
Merge branch 'master' of github.com:matrix-org/synapse into develop
2015-05-22 10:33:00 +01:00
Mark Haines
53447e9cd3
Add caches for things requested by the pushers
2015-05-21 16:41:39 +01:00
Mark Haines
d61ce3f670
Add a cache for get_current_state with state_key
2015-05-21 16:41:39 +01:00
Erik Johnston
65878a2319
Remove unused metric
2015-05-18 14:06:30 +01:00
Erik Johnston
c71176858b
Newline, remove debug logging
2015-05-18 10:11:14 +01:00
Erik Johnston
c3b37abdfd
PEP8
2015-05-15 16:59:58 +01:00
Erik Johnston
aa32bd38e4
Add a wait
2015-05-15 11:35:04 +01:00
Erik Johnston
a2c4f3f150
Fix daedlock
2015-05-15 10:54:04 +01:00
Erik Johnston
1d566edb81
Remove race condition
2015-05-14 16:54:35 +01:00
Erik Johnston
142934084a
Count and loop
2015-05-14 15:40:21 +01:00
Erik Johnston
7cd6a6f6cf
Awful idea for speeding up fetching of events
2015-05-14 15:34:02 +01:00
Erik Johnston
386b7330d2
Move from _base to events
2015-05-14 14:45:22 +01:00
Erik Johnston
7d6a1dae31
Jump out early
2015-05-14 14:27:58 +01:00
Erik Johnston
656223fbd3
Actually, we probably want to run this in a transaction
2015-05-14 14:26:35 +01:00
Erik Johnston
2f7f8e1c2b
Preemptively jump into a transaction if we ask for get_prev_content
2015-05-14 14:17:36 +01:00
Erik Johnston
e1e9f0c5b2
loop -> gatherResults
2015-05-14 13:58:49 +01:00
Erik Johnston
ab78a8926e
Err, we probably want a bigger limit
2015-05-14 13:47:16 +01:00
Erik Johnston
cdb3757942
Refactor _get_events
2015-05-14 13:31:55 +01:00
Erik Johnston
36ea26c5c0
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/perf
2015-05-14 12:01:38 +01:00
David Baker
7c549dd557
Add ID generator for push_rules_enable to #resolve SYN-378
2015-05-14 11:44:03 +01:00
Erik Johnston
968b01a91a
Actually use async method
2015-05-13 17:02:46 +01:00
Erik Johnston
4071f29653
Fetch events from events_id in their own transactions
2015-05-13 16:59:41 +01:00
Erik Johnston
a988361aea
Typo
2015-05-13 15:44:15 +01:00
Erik Johnston
8888982db3
Don't insert None
2015-05-13 15:43:32 +01:00
Erik Johnston
cf706cc6ef
Don't return None
2015-05-13 15:31:25 +01:00
Erik Johnston
5971d240d4
Limit batch size
2015-05-13 15:26:49 +01:00
Erik Johnston
ca4f458787
Fetch events in bulk
2015-05-13 15:13:42 +01:00
Erik Johnston
6edff11a88
Don't fetch redaction and rejection stuff for each event, so we can use index only scan
2015-05-13 14:39:05 +01:00
Erik Johnston
409bcc76bd
Load events for state group seperately
2015-05-13 11:13:31 +01:00
Erik Johnston
da6a7bbdde
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/logging_context
2015-05-12 13:10:42 +01:00
Erik Johnston
cd525c0f5a
push_rules table expects an 'id' field
2015-05-11 11:24:01 +01:00
Erik Johnston
476899295f
Change the way we do logging contexts so that they survive divergences
2015-05-08 16:32:18 +01:00
Erik Johnston
ed2584050f
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/executemany
2015-05-05 18:15:20 +01:00
Mark Haines
31049c4d72
Merge pull request #139 from matrix-org/bugs/SYN-369
...
Fix race with cache invalidation. SYN-369
2015-05-05 17:46:13 +01:00
Mark Haines
deb0237166
Add some doc-string
2015-05-05 17:45:11 +01:00
Mark Haines
d18f37e026
Collect the invalidate callbacks on the transaction object rather than passing around a separate list
2015-05-05 17:32:21 +01:00
Erik Johnston
9951542393
Add a comment about the zip(*[zip(sorted(...),...)])
2015-05-05 17:06:55 +01:00
Mark Haines
041b6cba61
SYN-369: Add comments to the sequence number logic in the cache
2015-05-05 16:32:44 +01:00
Mark Haines
63075118a5
Add debug flag in synapse/storage/_base.py for debugging the cache logic by comparing what is in the cache with what was in the database on every access
2015-05-05 16:24:04 +01:00
Erik Johnston
43c2e8deae
Add support for using executemany
2015-05-05 15:13:25 +01:00
Erik Johnston
1692dc019d
Don't call 'encode_parameter' no-op
2015-05-05 15:00:30 +01:00
Mark Haines
261d809a47
Sequence the modifications to the cache so that selects don't race with inserts
2015-05-05 14:13:50 +01:00
Erik Johnston
657298cebd
Don't lock user_ips table for upsert.
2015-05-01 10:46:48 +01:00
Erik Johnston
fabb7acd45
Fix bug where we reconnected to the database on every query.
2015-05-01 10:24:24 +01:00
Erik Johnston
2732be83d9
Shuffle operations so that locking upsert happens last in the txn. This ensures the lock is held for the least amount of time possible.
2015-04-27 13:22:30 +01:00
Erik Johnston
e4c4664d73
Handle the fact that postgres databases can be restarted from under us
2015-04-27 12:40:49 +01:00
Erik Johnston
b8092fbc82
Go back to storing JSON in TEXT
2015-04-16 11:17:52 +01:00
Erik Johnston
5b31afcbd1
Remove debug logging
2015-04-15 16:27:04 +01:00
Erik Johnston
ed26e4012b
pushers table requires a unique id.
2015-04-15 16:24:14 +01:00
Erik Johnston
a5c72780e6
Don't pass in removed flag
2015-04-15 15:13:22 +01:00
Erik Johnston
4af32a2817
Postgres does not allow you to continue using a cursor after a DB exception has been raised, so move _simple_insert or_ignore flag out of transaction
2015-04-15 14:51:21 +01:00
Erik Johnston
58d8339966
Add support for postgres instead of mysql. Change sql accourdingly. blob + varbinary -> bytea. No support for UNSIGNED or CREATE INDEX IF NOT EXISTS.
2015-04-14 13:53:20 +01:00
Erik Johnston
7ed2ec3061
Handle the fact that in sqlite binary data might be stored as unicode or bytes
2015-04-10 13:41:54 +01:00
Erik Johnston
8bf285e082
Merge branch 'develop' of github.com:matrix-org/synapse into mysql
2015-04-09 13:13:26 +01:00
Erik Johnston
8ad0f4912e
Stream ordering and out of order insertions.
...
Handle the fact that events can be persisted out of order, and so to get
the "current max" stream token becomes non trivial - as we need to make
sure that *all* stream tokens less than the current max have also
successfully been persisted.
2015-04-09 11:41:36 +01:00
Mark Haines
83f5125d52
Merge pull request #114 from matrix-org/improve_get_event_cache
...
Improve get event cache
2015-04-08 16:50:27 +01:00
Erik Johnston
3887350e47
Merge branch 'develop' of github.com:matrix-org/synapse into mysql
2015-04-08 14:11:07 +01:00
Erik Johnston
c1b34af441
Move database timer logging to seperate logger
2015-04-08 13:31:19 +01:00
Erik Johnston
9a05795619
Retry transaction, not SQL query
2015-04-08 13:11:28 +01:00
Erik Johnston
4fe95094d1
Merge branch 'develop' of github.com:matrix-org/synapse into mysql
2015-04-07 18:05:39 +01:00
Erik Johnston
49d6aa1394
Retry on deadlock
2015-04-07 15:28:37 +01:00
Erik Johnston
0af5f5efaf
Don't use multiple UNIQUE constraints; it will cause deadlocks
2015-04-07 12:08:35 +01:00
Erik Johnston
c8d3f6486d
Implement or_ignore flag on inserts
2015-04-07 12:06:22 +01:00
Erik Johnston
304111afd0
Don't use AUTOINCREMENT, use an in memory version
2015-04-07 12:05:36 +01:00
Erik Johnston
779f7b0f44
Fix unicode support
2015-04-02 10:06:22 +01:00
Erik Johnston
9236136f3a
Make work in both Maria and SQLite. Fix tests
2015-04-01 14:12:33 +01:00
Paul "LeoNerd" Evans
a198894bf7
Appease pep8
2015-03-26 11:53:58 +00:00
Paul "LeoNerd" Evans
953e40f9dc
Implement the main getEvent cache using Cache() instead of a custom application of LruCache; also unify its two-level structure into just one
2015-03-25 19:12:16 +00:00
Paul "LeoNerd" Evans
f173d40a32
Use FrozenEvent's reject_reason to decide whether to return it; don't include allow_rejected in the main getEvents cache key
2015-03-25 19:06:05 +00:00
Paul "LeoNerd" Evans
1b988b051b
Store the rejected reason in (Frozen)Event structs
2015-03-25 19:06:05 +00:00
Paul "LeoNerd" Evans
033a517feb
Indirect invalidations of _get_event_cache via a helper method to keep all uses of the cache lexically within one .py file
2015-03-25 19:06:05 +00:00
Paul "LeoNerd" Evans
9ba6487b3f
Allow a choice of LRU behaviour for Cache() by using LruCache() or OrderedDict()
2015-03-25 19:05:34 +00:00
Erik Johnston
0e8f5095c7
Fix unicode database support
2015-03-25 17:15:20 +00:00
Erik Johnston
9e98f1022a
Don't order by rowid
2015-03-24 16:19:01 +00:00
Erik Johnston
6e7131f02f
Remove uses of REPLACE and ON CONFLICT IGNORE to make the SQL more portable.
2015-03-23 15:38:56 +00:00
Paul "LeoNerd" Evans
0f86312c4c
Pull out the cache logic from the @cached wrapper into its own class we can reuse
2015-03-20 18:25:42 +00:00
Paul "LeoNerd" Evans
b1022ed8b5
func(*EXPR) is valid Python syntax, really...
2015-03-20 17:47:45 +00:00
Erik Johnston
f6583796fe
Merge branch 'develop' of github.com:matrix-org/synapse into mysql
2015-03-20 16:31:48 +00:00
Erik Johnston
80cd08c190
PEP8
2015-03-20 16:03:25 +00:00
Erik Johnston
9517f4da4d
Merge branch 'develop' of github.com:matrix-org/synapse into store_rearrangement
2015-03-20 16:02:47 +00:00
Erik Johnston
dc0c989ef4
Give sensible names for '_simple_...' transactions
2015-03-20 15:59:18 +00:00
Erik Johnston
7e282a53a5
Tidy up _simple_... methods
2015-03-20 15:05:10 +00:00
Paul "LeoNerd" Evans
91cb46191d
Allow @cached-wrapped functions to have more or fewer than 1 argument; assert on the total count of them though
2015-03-20 14:59:45 +00:00
Erik Johnston
87db64b839
Rearrange storage modules
2015-03-20 14:11:38 +00:00
Erik Johnston
cb8162d3d1
Rearrange storage modules
2015-03-20 13:52:56 +00:00
Erik Johnston
d7a0496f3e
Convert storage layer to be mysql compatible
2015-03-19 15:59:48 +00:00
Paul "LeoNerd" Evans
1489521ee5
Be polite and ensure we use @functools.wraps() when creating a function decorator
2015-03-17 17:19:22 +00:00