mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-08 06:33:09 -06:00
ALL THE LOGS
This commit is contained in:
parent
b75fc332dd
commit
533a9069e5
|
|
@ -120,6 +120,7 @@ func (t *KeyChangeConsumer) onDeviceKeyMessage(m api.DeviceMessage) bool {
|
||||||
logger.WithError(err).Error("failed to calculate joined rooms for user")
|
logger.WithError(err).Error("failed to calculate joined rooms for user")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
logrus.Infof("DEBUG: %v joined rooms for user %v", queryRes.RoomIDs, m.UserID)
|
||||||
// send this key change to all servers who share rooms with this user.
|
// send this key change to all servers who share rooms with this user.
|
||||||
destinations, err := t.db.GetJoinedHostsForRooms(t.ctx, queryRes.RoomIDs, true)
|
destinations, err := t.db.GetJoinedHostsForRooms(t.ctx, queryRes.RoomIDs, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -129,6 +130,8 @@ func (t *KeyChangeConsumer) onDeviceKeyMessage(m api.DeviceMessage) bool {
|
||||||
|
|
||||||
if len(destinations) == 0 {
|
if len(destinations) == 0 {
|
||||||
logger.WithField("num_rooms", len(queryRes.RoomIDs)).Debug("user is in no federated rooms")
|
logger.WithField("num_rooms", len(queryRes.RoomIDs)).Debug("user is in no federated rooms")
|
||||||
|
destinations, err = t.db.GetJoinedHostsForRooms(t.ctx, queryRes.RoomIDs, false)
|
||||||
|
logrus.Infof("GetJoinedHostsForRooms exclude self=false -> %v %v", destinations, err)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// Pack the EDU and marshal it
|
// Pack the EDU and marshal it
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import (
|
||||||
|
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/nats-io/nats.go"
|
"github.com/nats-io/nats.go"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/federationapi/queue"
|
"github.com/matrix-org/dendrite/federationapi/queue"
|
||||||
|
|
@ -173,11 +174,10 @@ func (s *OutputRoomEventConsumer) processMessage(ore api.OutputNewRoomEvent) err
|
||||||
// expressed as a delta against the current state.
|
// expressed as a delta against the current state.
|
||||||
// TODO(#290): handle EventIDMismatchError and recover the current state by
|
// TODO(#290): handle EventIDMismatchError and recover the current state by
|
||||||
// talking to the roomserver
|
// talking to the roomserver
|
||||||
|
logrus.Infof("room %s adds joined hosts: %v removes %v", ore.Event.RoomID(), addsJoinedHosts, ore.RemovesStateEventIDs)
|
||||||
oldJoinedHosts, err := s.db.UpdateRoom(
|
oldJoinedHosts, err := s.db.UpdateRoom(
|
||||||
s.ctx,
|
s.ctx,
|
||||||
ore.Event.RoomID(),
|
ore.Event.RoomID(),
|
||||||
ore.LastSentEventID,
|
|
||||||
ore.Event.EventID(),
|
|
||||||
addsJoinedHosts,
|
addsJoinedHosts,
|
||||||
ore.RemovesStateEventIDs,
|
ore.RemovesStateEventIDs,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ func (r *FederationInternalAPI) performJoinUsingServer(
|
||||||
return fmt.Errorf("JoinedHostsFromEvents: failed to get joined hosts: %s", err)
|
return fmt.Errorf("JoinedHostsFromEvents: failed to get joined hosts: %s", err)
|
||||||
}
|
}
|
||||||
logrus.WithField("hosts", joinedHosts).WithField("room", roomID).Info("Joined federated room with hosts")
|
logrus.WithField("hosts", joinedHosts).WithField("room", roomID).Info("Joined federated room with hosts")
|
||||||
if _, err = r.db.UpdateRoom(context.Background(), roomID, "", event.EventID(), joinedHosts, nil); err != nil {
|
if _, err = r.db.UpdateRoom(context.Background(), roomID, joinedHosts, nil); err != nil {
|
||||||
return fmt.Errorf("UpdatedRoom: failed to update room with joined hosts: %s", err)
|
return fmt.Errorf("UpdatedRoom: failed to update room with joined hosts: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import (
|
||||||
type Database interface {
|
type Database interface {
|
||||||
gomatrixserverlib.KeyDatabase
|
gomatrixserverlib.KeyDatabase
|
||||||
|
|
||||||
UpdateRoom(ctx context.Context, roomID, oldEventID, newEventID string, addHosts []types.JoinedHost, removeHosts []string) (joinedHosts []types.JoinedHost, err error)
|
UpdateRoom(ctx context.Context, roomID string, addHosts []types.JoinedHost, removeHosts []string) (joinedHosts []types.JoinedHost, err error)
|
||||||
|
|
||||||
GetJoinedHosts(ctx context.Context, roomID string) ([]types.JoinedHost, error)
|
GetJoinedHosts(ctx context.Context, roomID string) ([]types.JoinedHost, error)
|
||||||
GetAllJoinedHosts(ctx context.Context) ([]gomatrixserverlib.ServerName, error)
|
GetAllJoinedHosts(ctx context.Context) ([]gomatrixserverlib.ServerName, error)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"github.com/matrix-org/dendrite/internal"
|
"github.com/matrix-org/dendrite/internal"
|
||||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const joinedHostsSchema = `
|
const joinedHostsSchema = `
|
||||||
|
|
@ -111,6 +112,7 @@ func (s *joinedHostsStatements) InsertJoinedHosts(
|
||||||
roomID, eventID string,
|
roomID, eventID string,
|
||||||
serverName gomatrixserverlib.ServerName,
|
serverName gomatrixserverlib.ServerName,
|
||||||
) error {
|
) error {
|
||||||
|
logrus.Debugf("FederationJoinedHosts: INSERT %v %v %v", roomID, eventID, serverName)
|
||||||
stmt := sqlutil.TxStmt(txn, s.insertJoinedHostsStmt)
|
stmt := sqlutil.TxStmt(txn, s.insertJoinedHostsStmt)
|
||||||
_, err := stmt.ExecContext(ctx, roomID, eventID, serverName)
|
_, err := stmt.ExecContext(ctx, roomID, eventID, serverName)
|
||||||
return err
|
return err
|
||||||
|
|
@ -119,6 +121,7 @@ func (s *joinedHostsStatements) InsertJoinedHosts(
|
||||||
func (s *joinedHostsStatements) DeleteJoinedHosts(
|
func (s *joinedHostsStatements) DeleteJoinedHosts(
|
||||||
ctx context.Context, txn *sql.Tx, eventIDs []string,
|
ctx context.Context, txn *sql.Tx, eventIDs []string,
|
||||||
) error {
|
) error {
|
||||||
|
logrus.Debugf("FederationJoinedHosts: DELETE WITH EVENTS %v", eventIDs)
|
||||||
stmt := sqlutil.TxStmt(txn, s.deleteJoinedHostsStmt)
|
stmt := sqlutil.TxStmt(txn, s.deleteJoinedHostsStmt)
|
||||||
_, err := stmt.ExecContext(ctx, pq.StringArray(eventIDs))
|
_, err := stmt.ExecContext(ctx, pq.StringArray(eventIDs))
|
||||||
return err
|
return err
|
||||||
|
|
@ -127,6 +130,7 @@ func (s *joinedHostsStatements) DeleteJoinedHosts(
|
||||||
func (s *joinedHostsStatements) DeleteJoinedHostsForRoom(
|
func (s *joinedHostsStatements) DeleteJoinedHostsForRoom(
|
||||||
ctx context.Context, txn *sql.Tx, roomID string,
|
ctx context.Context, txn *sql.Tx, roomID string,
|
||||||
) error {
|
) error {
|
||||||
|
logrus.Debugf("FederationJoinedHosts: DELETE ALL IN ROOM %v", roomID)
|
||||||
stmt := sqlutil.TxStmt(txn, s.deleteJoinedHostsForRoomStmt)
|
stmt := sqlutil.TxStmt(txn, s.deleteJoinedHostsForRoomStmt)
|
||||||
_, err := stmt.ExecContext(ctx, roomID)
|
_, err := stmt.ExecContext(ctx, roomID)
|
||||||
return err
|
return err
|
||||||
|
|
@ -207,6 +211,7 @@ func joinedHostsFromStmt(
|
||||||
ServerName: gomatrixserverlib.ServerName(serverName),
|
ServerName: gomatrixserverlib.ServerName(serverName),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
logrus.Debugf("FederationJoinedHosts: SELECT %v => %+v", roomID, result)
|
||||||
|
|
||||||
return result, rows.Err()
|
return result, rows.Err()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ func (r *Receipt) String() string {
|
||||||
// this isn't a duplicate message.
|
// this isn't a duplicate message.
|
||||||
func (d *Database) UpdateRoom(
|
func (d *Database) UpdateRoom(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
roomID, oldEventID, newEventID string,
|
roomID string,
|
||||||
addHosts []types.JoinedHost,
|
addHosts []types.JoinedHost,
|
||||||
removeHosts []string,
|
removeHosts []string,
|
||||||
) (joinedHosts []types.JoinedHost, err error) {
|
) (joinedHosts []types.JoinedHost, err error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue