mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-29 17:51:56 -06:00
Make logging output for state deletions a bit better
This commit is contained in:
parent
015465d496
commit
9eb4fec33b
|
@ -102,8 +102,8 @@ type latestEventsUpdater struct {
|
||||||
// The eventID of the event that was processed before this one.
|
// The eventID of the event that was processed before this one.
|
||||||
lastEventIDSent string
|
lastEventIDSent string
|
||||||
// The latest events in the room after processing this event.
|
// The latest events in the room after processing this event.
|
||||||
oldLatest []types.StateAtEventAndReference
|
oldLatest types.StateAtEventAndReferences
|
||||||
latest []types.StateAtEventAndReference
|
latest types.StateAtEventAndReferences
|
||||||
// The state entries removed from and added to the current state of the
|
// The state entries removed from and added to the current state of the
|
||||||
// room as a result of processing this event. They are sorted lists.
|
// room as a result of processing this event. They are sorted lists.
|
||||||
removed []types.StateEntry
|
removed []types.StateEntry
|
||||||
|
@ -126,7 +126,7 @@ func (u *latestEventsUpdater) doUpdateLatestEvents() error {
|
||||||
// state snapshot from somewhere else, e.g. a federated room join,
|
// state snapshot from somewhere else, e.g. a federated room join,
|
||||||
// then start with an empty set - none of the forward extremities
|
// then start with an empty set - none of the forward extremities
|
||||||
// that we knew about before matter anymore.
|
// that we knew about before matter anymore.
|
||||||
u.oldLatest = []types.StateAtEventAndReference{}
|
u.oldLatest = types.StateAtEventAndReferences{}
|
||||||
if !u.rewritesState {
|
if !u.rewritesState {
|
||||||
u.oldStateNID = u.updater.CurrentStateSnapshotNID()
|
u.oldStateNID = u.updater.CurrentStateSnapshotNID()
|
||||||
u.oldLatest = u.updater.LatestEvents()
|
u.oldLatest = u.updater.LatestEvents()
|
||||||
|
@ -277,8 +277,8 @@ func (u *latestEventsUpdater) latestState() error {
|
||||||
"room_id": u.event.RoomID(),
|
"room_id": u.event.RoomID(),
|
||||||
"old_state_nid": u.oldStateNID,
|
"old_state_nid": u.oldStateNID,
|
||||||
"new_state_nid": u.newStateNID,
|
"new_state_nid": u.newStateNID,
|
||||||
"old_latest": u.oldLatest,
|
"old_latest": u.oldLatest.EventIDs(),
|
||||||
"new_latest": u.latest,
|
"new_latest": u.latest.EventIDs(),
|
||||||
}).Errorf("Unexpected state deletion (removing %d events)", removed)
|
}).Errorf("Unexpected state deletion (removing %d events)", removed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,14 @@ func (s StateAtEventAndReferences) Swap(a, b int) {
|
||||||
s[a], s[b] = s[b], s[a]
|
s[a], s[b] = s[b], s[a]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s StateAtEventAndReferences) EventIDs() string {
|
||||||
|
strs := make([]string, 0, len(s))
|
||||||
|
for _, r := range s {
|
||||||
|
strs = append(strs, r.EventID)
|
||||||
|
}
|
||||||
|
return "[" + strings.Join(strs, " ") + "]"
|
||||||
|
}
|
||||||
|
|
||||||
// An Event is a gomatrixserverlib.Event with the numeric event ID attached.
|
// An Event is a gomatrixserverlib.Event with the numeric event ID attached.
|
||||||
// It is when performing bulk event lookup in the database.
|
// It is when performing bulk event lookup in the database.
|
||||||
type Event struct {
|
type Event struct {
|
||||||
|
|
Loading…
Reference in a new issue