Don't use multiple UNIQUE constraints; it will cause deadlocks

This commit is contained in:
Erik Johnston 2015-04-07 12:08:35 +01:00
parent c8d3f6486d
commit 0af5f5efaf
4 changed files with 17 additions and 15 deletions

View file

@ -179,7 +179,7 @@ class EventsStore(SQLBaseStore):
)
txn.execute(
sql,
(metadata_json.decode("UTF-8"), event.event_id,)
(buffer(metadata_json), event.event_id,)
)
sql = (
@ -224,14 +224,14 @@ class EventsStore(SQLBaseStore):
values={
"event_id": event.event_id,
"room_id": event.room_id,
"internal_metadata": metadata_json.decode("UTF-8"),
"json": encode_canonical_json(event_dict).decode("UTF-8"),
"internal_metadata": buffer(metadata_json),
"json": buffer(encode_canonical_json(event_dict)),
},
)
content = encode_canonical_json(
content = buffer(encode_canonical_json(
event.content
).decode("UTF-8")
))
vals = {
"topological_ordering": event.depth,
@ -256,9 +256,9 @@ class EventsStore(SQLBaseStore):
]
}
vals["unrecognized_keys"] = encode_canonical_json(
vals["unrecognized_keys"] = buffer(encode_canonical_json(
unrec
).decode("UTF-8")
))
sql = (
"INSERT INTO events"