From 926e7c3b5eb0daaeb206dd94e4205d063442b0ab Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Tue, 4 Jan 2022 22:37:19 +0530 Subject: [PATCH] MM-40801: Use replica for getPostsAround (#19273) This query deals with posts already created, and it was originally already querying replica. In recent performance investigations, this came up a lot of times. I believe the change to query master was unintentional. ```release-note NONE ``` --- store/sqlstore/post_store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/store/sqlstore/post_store.go b/store/sqlstore/post_store.go index e246290858..adae543dd8 100644 --- a/store/sqlstore/post_store.go +++ b/store/sqlstore/post_store.go @@ -1404,7 +1404,7 @@ func (s *SqlPostStore) getPostsAround(before bool, options model.GetPostsOptions if err != nil { return nil, errors.Wrap(err, "post_tosql") } - err = s.GetMasterX().Select(&posts, queryString, args...) + err = s.GetReplicaX().Select(&posts, queryString, args...) if err != nil { return nil, errors.Wrapf(err, "failed to find Posts with channelId=%s", options.ChannelId) } @@ -1439,7 +1439,7 @@ func (s *SqlPostStore) getPostsAround(before bool, options model.GetPostsOptions if nErr != nil { return nil, errors.Wrap(nErr, "post_tosql") } - nErr = s.GetMasterX().Select(&parents, rootQueryString, rootArgs...) + nErr = s.GetReplicaX().Select(&parents, rootQueryString, rootArgs...) if nErr != nil { return nil, errors.Wrapf(nErr, "failed to find Posts with channelId=%s", options.ChannelId) }