mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
Fix sqlite migration issues (#1960)
* Do not store 'null' in the database for empty JSON arrays This can cause issues, though it should be noted that the majority of the time this will marshal/unmarshal just fine, see https://play.golang.org/p/Doe2NZUgv7Q * bugfix: sqlite migration should handle create events as having no 'before' snapshot The state snapshot for any given event in the roomserver represents the state _before_ the event. For the create event, this is nothing, so the state snapshot nid should be 0. In some cases this wasn't happening, resulting in a nice mix of possible options including: - A state snapshot without any state blocks `[]` or `null`. - A state snapshot with a single state block with a single event, the create event, causing a circular loop. This is incorrect as it represents the state before the event, not after. * Add state key check
This commit is contained in:
parent
da101469fa
commit
ed04eed441
4 changed files with 21 additions and 1 deletions
|
@ -86,7 +86,7 @@ func (s *stateBlockStatements) BulkInsertStateData(
|
|||
entries types.StateEntries,
|
||||
) (id types.StateBlockNID, err error) {
|
||||
entries = entries[:util.SortAndUnique(entries)]
|
||||
var nids types.EventNIDs
|
||||
nids := types.EventNIDs{} // zero slice to not store 'null' in the DB
|
||||
for _, e := range entries {
|
||||
nids = append(nids, e.EventNID)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue