From 8b17bf9e42dd56ecd0fe8300da90bea5ee8684ef Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Thu, 13 Sep 2018 13:47:17 -0400 Subject: MM-11886: materialize channel search (#9349) * materialize PublicChannels table Introduce triggers for each supported database that automatically maintain a subset of the Channels table corresponding to only public channels. This improves corresponding queries that no longer need to filter out 99% DM channels. This initial commit modifies the channel store directly for easier code reviewing, but the next wraps an experimental version around it to enable a kill switch in case there are unforeseen performance regressions. This addresses [MM-11886](https://mattermost.atlassian.net/browse/MM-11886) and [MM-11945](https://mattermost.atlassian.net/browse/MM-11945). * extract the experimental public channels materialization Wrap the original channel store with an experimental version that leverages the materialized public channels, but can be disabled to fallback to the original implementation. This addresses MM-11947. * s/ExperimentalPublicChannelsMaterialization/EnablePublicChannelsMaterialization/ * simplify error handling * move experimental config listener until after store is initialized --- store/storetest/mocks/ChannelStore.go | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'store/storetest/mocks/ChannelStore.go') diff --git a/store/storetest/mocks/ChannelStore.go b/store/storetest/mocks/ChannelStore.go index 63f6bc6a9..c187aae6b 100644 --- a/store/storetest/mocks/ChannelStore.go +++ b/store/storetest/mocks/ChannelStore.go @@ -130,6 +130,30 @@ func (_m *ChannelStore) Delete(channelId string, time int64) store.StoreChannel return r0 } +// DisableExperimentalPublicChannelsMaterialization provides a mock function with given fields: +func (_m *ChannelStore) DisableExperimentalPublicChannelsMaterialization() { + _m.Called() +} + +// DropPublicChannels provides a mock function with given fields: +func (_m *ChannelStore) DropPublicChannels() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// EnableExperimentalPublicChannelsMaterialization provides a mock function with given fields: +func (_m *ChannelStore) EnableExperimentalPublicChannelsMaterialization() { + _m.Called() +} + // Get provides a mock function with given fields: id, allowFromCache func (_m *ChannelStore) Get(id string, allowFromCache bool) store.StoreChannel { ret := _m.Called(id, allowFromCache) @@ -601,6 +625,20 @@ func (_m *ChannelStore) InvalidateMemberCount(channelId string) { _m.Called(channelId) } +// IsExperimentalPublicChannelsMaterializationEnabled provides a mock function with given fields: +func (_m *ChannelStore) IsExperimentalPublicChannelsMaterializationEnabled() bool { + ret := _m.Called() + + var r0 bool + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + // IsUserInChannelUseCache provides a mock function with given fields: userId, channelId func (_m *ChannelStore) IsUserInChannelUseCache(userId string, channelId string) bool { ret := _m.Called(userId, channelId) @@ -631,6 +669,20 @@ func (_m *ChannelStore) MigrateChannelMembers(fromChannelId string, fromUserId s return r0 } +// MigratePublicChannels provides a mock function with given fields: +func (_m *ChannelStore) MigratePublicChannels() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + // PermanentDelete provides a mock function with given fields: channelId func (_m *ChannelStore) PermanentDelete(channelId string) store.StoreChannel { ret := _m.Called(channelId) -- cgit v1.2.3-1-g7c22