Merge branch 'develop' of github.com:matrix-org/synapse into erikj/remove_membership_change

pull/3200/head
Erik Johnston 2018-05-09 15:32:07 +01:00
commit cddf91c8b9
4 changed files with 22 additions and 10 deletions

View File

@ -6,9 +6,19 @@
## Do not run it lightly. ## Do not run it lightly.
set -e
if [ "$1" == "-h" ] || [ "$1" == "" ]; then
echo "Call with ROOM_ID as first option and then pipe it into the database. So for instance you might run"
echo " nuke-room-from-db.sh <room_id> | sqlite3 homeserver.db"
echo "or"
echo " nuke-room-from-db.sh <room_id> | psql --dbname=synapse"
exit
fi
ROOMID="$1" ROOMID="$1"
sqlite3 homeserver.db <<EOF cat <<EOF
DELETE FROM event_forward_extremities WHERE room_id = '$ROOMID'; DELETE FROM event_forward_extremities WHERE room_id = '$ROOMID';
DELETE FROM event_backward_extremities WHERE room_id = '$ROOMID'; DELETE FROM event_backward_extremities WHERE room_id = '$ROOMID';
DELETE FROM event_edges WHERE room_id = '$ROOMID'; DELETE FROM event_edges WHERE room_id = '$ROOMID';
@ -29,7 +39,7 @@ DELETE FROM state_groups WHERE room_id = '$ROOMID';
DELETE FROM state_groups_state WHERE room_id = '$ROOMID'; DELETE FROM state_groups_state WHERE room_id = '$ROOMID';
DELETE FROM receipts_graph WHERE room_id = '$ROOMID'; DELETE FROM receipts_graph WHERE room_id = '$ROOMID';
DELETE FROM receipts_linearized WHERE room_id = '$ROOMID'; DELETE FROM receipts_linearized WHERE room_id = '$ROOMID';
DELETE FROM event_search_content WHERE c1room_id = '$ROOMID'; DELETE FROM event_search WHERE room_id = '$ROOMID';
DELETE FROM guest_access WHERE room_id = '$ROOMID'; DELETE FROM guest_access WHERE room_id = '$ROOMID';
DELETE FROM history_visibility WHERE room_id = '$ROOMID'; DELETE FROM history_visibility WHERE room_id = '$ROOMID';
DELETE FROM room_tags WHERE room_id = '$ROOMID'; DELETE FROM room_tags WHERE room_id = '$ROOMID';

View File

@ -71,7 +71,8 @@ class BaseMetric(object):
"""Render this metric for a single set of labels """Render this metric for a single set of labels
Args: Args:
label_values (list[str]): values for each of the labels label_values (list[object]): values for each of the labels,
(which get stringified).
value: value of the metric at with these labels value: value of the metric at with these labels
Returns: Returns:
@ -324,4 +325,4 @@ def _escape_character(m):
def _escape_label_value(value): def _escape_label_value(value):
"""Takes a label value and escapes quotes, newlines and backslashes """Takes a label value and escapes quotes, newlines and backslashes
""" """
return re.sub(r"([\n\"\\])", _escape_character, value) return re.sub(r"([\n\"\\])", _escape_character, str(value))

View File

@ -88,7 +88,7 @@ class NotificationsServlet(RestServlet):
pa["topological_ordering"], pa["stream_ordering"] pa["topological_ordering"], pa["stream_ordering"]
) )
returned_push_actions.append(returned_pa) returned_push_actions.append(returned_pa)
next_token = pa["stream_ordering"] next_token = str(pa["stream_ordering"])
defer.returnValue((200, { defer.returnValue((200, {
"notifications": returned_push_actions, "notifications": returned_push_actions,

View File

@ -371,7 +371,7 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
Returns: Returns:
Deferred[tuple[list[_EventDictReturn], str]]: Returns a list of Deferred[tuple[list[_EventDictReturn], str]]: Returns a list of
_EventDictReturn and a token pointint to the start of the returned _EventDictReturn and a token pointing to the start of the returned
events. events.
The events returned are in ascending order. The events returned are in ascending order.
""" """
@ -500,7 +500,8 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
events (list[FrozenEvent]) events (list[FrozenEvent])
rows (list[_EventDictReturn]) rows (list[_EventDictReturn])
topo_order (bool): Whether the events were ordered topologically topo_order (bool): Whether the events were ordered topologically
or by stream ordering or by stream ordering. If true then all rows should have a non
null topological_ordering.
""" """
for event, row in zip(events, rows): for event, row in zip(events, rows):
stream = row.stream_ordering stream = row.stream_ordering
@ -678,9 +679,9 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
those that match the filter. those that match the filter.
Returns: Returns:
tuple[list[_EventDictReturn], str]: Returns the results as a list Deferred[tuple[list[_EventDictReturn], str]]: Returns the results
of _EventDictReturn and a token that points to the end of the as a list of _EventDictReturn and a token that points to the end
result set. of the result set.
""" """
# Tokens really represent positions between elements, but we use # Tokens really represent positions between elements, but we use
# the convention of pointing to the event before the gap. Hence # the convention of pointing to the event before the gap. Hence