mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-26837] attempt at fixing flaky test on mysql-5.6 (#15110)
Summary - Attempt at fixing the AutocompleteInTeam/empty_string test which is flaky on MySQL-5.6. This is likely an index_merge_intersection optimization issue. See https://community.mattermost.com/core/pl/uzgygwa9e3d4pns14ayfs7mobw for more discussion. The fix here simply modifies the where clause to change the query plan so index_merge_intersection is not used, while also not introducing a temporary table or a filesort. Ticket Link - https://mattermost.atlassian.net/browse/MM-26837
This commit is contained in:
@@ -2584,7 +2584,7 @@ func (s SqlChannelStore) GetMembersForUserWithPagination(teamId, userId string,
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) AutocompleteInTeam(teamId string, term string, includeDeleted bool) (*model.ChannelList, *model.AppError) {
|
||||
deleteFilter := "AND c.DeleteAt = 0"
|
||||
deleteFilter := "AND Channels.DeleteAt = 0"
|
||||
if includeDeleted {
|
||||
deleteFilter = ""
|
||||
}
|
||||
@@ -2597,7 +2597,7 @@ func (s SqlChannelStore) AutocompleteInTeam(teamId string, term string, includeD
|
||||
JOIN
|
||||
PublicChannels c ON (c.Id = Channels.Id)
|
||||
WHERE
|
||||
c.TeamId = :TeamId
|
||||
Channels.TeamId = :TeamId
|
||||
` + deleteFilter + `
|
||||
%v
|
||||
LIMIT ` + strconv.Itoa(model.CHANNEL_SEARCH_DEFAULT_LIMIT)
|
||||
|
||||
@@ -78,8 +78,8 @@ func TestChannelStore(t *testing.T, ss store.Store, s SqlSupplier) {
|
||||
t.Run("GetMemberCount", func(t *testing.T) { testGetMemberCount(t, ss) })
|
||||
t.Run("GetMemberCountsByGroup", func(t *testing.T) { testGetMemberCountsByGroup(t, ss) })
|
||||
t.Run("GetGuestCount", func(t *testing.T) { testGetGuestCount(t, ss) })
|
||||
t.Run("SearchInTeam", func(t *testing.T) { testChannelStoreSearchInTeam(t, ss, s) })
|
||||
t.Run("SearchMore", func(t *testing.T) { testChannelStoreSearchMore(t, ss) })
|
||||
t.Run("SearchInTeam", func(t *testing.T) { testChannelStoreSearchInTeam(t, ss, s) })
|
||||
t.Run("SearchForUserInTeam", func(t *testing.T) { testChannelStoreSearchForUserInTeam(t, ss) })
|
||||
t.Run("SearchAllChannels", func(t *testing.T) { testChannelStoreSearchAllChannels(t, ss) })
|
||||
t.Run("GetMembersByIds", func(t *testing.T) { testChannelStoreGetMembersByIds(t, ss) })
|
||||
@@ -5114,9 +5114,6 @@ func testChannelStoreSearchInTeam(t *testing.T, ss store.Store, s SqlSupplier) {
|
||||
} {
|
||||
for _, testCase := range testCases {
|
||||
t.Run(name+"/"+testCase.Description, func(t *testing.T) {
|
||||
if name == "AutocompleteInTeam" && testCase.Description == "empty string" && s.DriverName() == model.DATABASE_DRIVER_MYSQL {
|
||||
t.Skip("Skip test for MySQL. TODO: Understand why this test fails in mysql 5.6 in the CI")
|
||||
}
|
||||
channels, err := search(testCase.TeamId, testCase.Term, testCase.IncludeDeleted)
|
||||
require.Nil(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user