Insert delta of current_state_events to be more efficient #1840

Merged
merged 3 commits into from Jan 23, 2017

Projects

None yet

2 participants

@erikjohnston
Member

No description provided.

erikjohnston added some commits Jan 20, 2017
@erikjohnston erikjohnston Insert delta of current_state_events to be more efficient
a55fa20
@erikjohnston erikjohnston Comments
5d2134d
synapse/storage/events.py
- ],
- )
+ # Figure out what has changed (if anything). Then we simply delete
+ # and readd the keys that have been changed.
@NegativeMjark
NegativeMjark Jan 20, 2017 Contributor

"re-add" ?

synapse/storage/events.py
txn,
table="current_state_events",
keyvalues={"room_id": room_id},
+ retcols=["event_id", "type", "state_key"],
@NegativeMjark
NegativeMjark Jan 20, 2017 Contributor

Why are you returning the "type" and "state_key" here?

@erikjohnston
erikjohnston Jan 20, 2017 Member

Because we're using it below?

@NegativeMjark
NegativeMjark Jan 23, 2017 Contributor

Oh I failed to read that far down the file :(

@NegativeMjark

LGTM

@erikjohnston erikjohnston Refactor to calculate state delta outside transaction
c77b24c
+
+ Returns:
+ 2-tuple (to_delete, to_insert) where both are state dicts, i.e.
+ (type, state_key) -> event_id. `to_delete` are the entreis to
@NegativeMjark
NegativeMjark Jan 23, 2017 Contributor

entries

@NegativeMjark

LGTM

@erikjohnston erikjohnston merged commit f5b4648 into develop Jan 23, 2017

8 checks passed

Sytest Dendron (Commit) Build #1416 origin/erikj/current_state_fix succeeded in 11 min
Details
Sytest Dendron (Merged PR) Build finished.
Details
Sytest Postgres (Commit) Build #2233 origin/erikj/current_state_fix succeeded in 6 min 52 sec
Details
Sytest Postgres (Merged PR) Build finished.
Details
Sytest SQLite (Commit) Build #2301 origin/erikj/current_state_fix succeeded in 6 min 27 sec
Details
Sytest SQLite (Merged PR) Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment