mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -06:00
Move the missing state event check inside the SQL layer, comment on why the error message is unhelpful
This commit is contained in:
parent
00e6b86ba7
commit
70645ea2c7
|
|
@ -1,7 +1,6 @@
|
|||
package input
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/dendrite/roomserver/types"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
|
@ -70,10 +69,6 @@ func checkAuthEvents(db RoomEventDatabase, event gomatrixserverlib.Event, authEv
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(authStateEntries) < len(authEventIDs) {
|
||||
return nil, fmt.Errorf("input: Some of the auth event IDs were missing from the database")
|
||||
}
|
||||
|
||||
// TODO: check for duplicate state keys here.
|
||||
|
||||
// Work out which of the state events we actually need.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package storage
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/lib/pq"
|
||||
"github.com/matrix-org/dendrite/roomserver/types"
|
||||
)
|
||||
|
|
@ -409,7 +410,15 @@ func (s *statements) bulkSelectStateEventByIDID(eventIDs []string) ([]types.Stat
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
return results[:i], err
|
||||
if i < len(eventIDs) {
|
||||
// If there are fewer rows returned than IDs then we were asked to lookup event IDs we don't have.
|
||||
// We don't know which ones were missing because we don't return the string IDs in the query.
|
||||
// However it should be possible debug this by replaying queries or entries from the input kafka logs.
|
||||
// If this turns out to be impossible and we do need the debug information here, it would be better
|
||||
// to do it as a separate query rather than slowing down/complicating the common case.
|
||||
return nil, fmt.Errorf("storage: state event IDs missing from the database")
|
||||
}
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s *statements) prepareEventJSON(db *sql.DB) (err error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue