aboutsummaryrefslogtreecommitdiff
path: root/internal/caching
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-08-03 17:14:21 +0100
committerGitHub <noreply@github.com>2022-08-03 17:14:21 +0100
commit2250768be16bd0e6b3a6a72b5e55eb3e2ad6e3c6 (patch)
tree71b0429816fec0b74895e1907d3c32923400fde0 /internal/caching
parentbbff41b44bff2dbc53867cc0fd94ce8f31fd511a (diff)
Remove roominfo cache (#2615)
* Remove roominfo cache It's the source of a number of race conditions which are seemingly causing bugs and CI failures. * Make the linter less sad
Diffstat (limited to 'internal/caching')
-rw-r--r--internal/caching/cache_roominfo.go33
-rw-r--r--internal/caching/cache_roomservernids.go1
-rw-r--r--internal/caching/caches.go1
-rw-r--r--internal/caching/impl_ristretto.go7
4 files changed, 0 insertions, 42 deletions
diff --git a/internal/caching/cache_roominfo.go b/internal/caching/cache_roominfo.go
deleted file mode 100644
index 5dfed3c8..00000000
--- a/internal/caching/cache_roominfo.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package caching
-
-import (
- "github.com/matrix-org/dendrite/roomserver/types"
-)
-
-// WARNING: This cache is mutable because it's entirely possible that
-// the IsStub or StateSnaphotNID fields can change, even though the
-// room version and room NID fields will not. This is only safe because
-// the RoomInfoCache is used ONLY within the roomserver and because it
-// will be kept up-to-date by the latest events updater. It MUST NOT be
-// used from other components as we currently have no way to invalidate
-// the cache in downstream components.
-
-// RoomInfosCache contains the subset of functions needed for
-// a room Info cache. It must only be used from the roomserver only
-// It is not safe for use from other components.
-type RoomInfoCache interface {
- GetRoomInfo(roomID string) (roomInfo *types.RoomInfo, ok bool)
- StoreRoomInfo(roomID string, roomInfo *types.RoomInfo)
-}
-
-// GetRoomInfo must only be called from the roomserver only. It is not
-// safe for use from other components.
-func (c Caches) GetRoomInfo(roomID string) (*types.RoomInfo, bool) {
- return c.RoomInfos.Get(roomID)
-}
-
-// StoreRoomInfo must only be called from the roomserver only. It is not
-// safe for use from other components.
-func (c Caches) StoreRoomInfo(roomID string, roomInfo *types.RoomInfo) {
- c.RoomInfos.Set(roomID, roomInfo)
-}
diff --git a/internal/caching/cache_roomservernids.go b/internal/caching/cache_roomservernids.go
index f27154f1..88a5b28b 100644
--- a/internal/caching/cache_roomservernids.go
+++ b/internal/caching/cache_roomservernids.go
@@ -7,7 +7,6 @@ import (
type RoomServerCaches interface {
RoomServerNIDsCache
RoomVersionCache
- RoomInfoCache
RoomServerEventsCache
EventStateKeyCache
}
diff --git a/internal/caching/caches.go b/internal/caching/caches.go
index f13f743d..78c9ab7e 100644
--- a/internal/caching/caches.go
+++ b/internal/caching/caches.go
@@ -29,7 +29,6 @@ type Caches struct {
RoomServerRoomIDs Cache[types.RoomNID, string] // room NID -> room ID
RoomServerEvents Cache[int64, *gomatrixserverlib.Event] // event NID -> event
RoomServerStateKeys Cache[types.EventStateKeyNID, string] // event NID -> event state key
- RoomInfos Cache[string, *types.RoomInfo] // room ID -> room info
FederationPDUs Cache[int64, *gomatrixserverlib.HeaderedEvent] // queue NID -> PDU
FederationEDUs Cache[int64, *gomatrixserverlib.EDU] // queue NID -> EDU
SpaceSummaryRooms Cache[string, gomatrixserverlib.MSC2946SpacesResponse] // room ID -> space response
diff --git a/internal/caching/impl_ristretto.go b/internal/caching/impl_ristretto.go
index fdbbb4d7..fc0c8cc0 100644
--- a/internal/caching/impl_ristretto.go
+++ b/internal/caching/impl_ristretto.go
@@ -35,7 +35,6 @@ const (
roomNIDsCache
roomIDsCache
roomEventsCache
- roomInfosCache
federationPDUsCache
federationEDUsCache
spaceSummaryRoomsCache
@@ -106,12 +105,6 @@ func NewRistrettoCache(maxCost config.DataUnit, maxAge time.Duration, enableProm
Prefix: eventStateKeyCache,
MaxAge: maxAge,
},
- RoomInfos: &RistrettoCachePartition[string, *types.RoomInfo]{ // room ID -> room info
- cache: cache,
- Prefix: roomInfosCache,
- Mutable: true,
- MaxAge: maxAge,
- },
FederationPDUs: &RistrettoCostedCachePartition[int64, *gomatrixserverlib.HeaderedEvent]{ // queue NID -> PDU
&RistrettoCachePartition[int64, *gomatrixserverlib.HeaderedEvent]{
cache: cache,