Fixing problem with read-replica on indexing files (#17460)

Этот коммит содержится в:
Jesús Espino
2021-04-20 12:30:43 +02:00
коммит произвёл GitHub
родитель 4295a1f556
Коммит 368b642105
7 изменённых файлов: 95 добавлений и 4 удалений

Просмотреть файл

@@ -3146,6 +3146,24 @@ func (s *OpenTracingLayerFileInfoStore) GetForUser(userID string) ([]*model.File
return result, err
}
func (s *OpenTracingLayerFileInfoStore) GetFromMaster(id string) (*model.FileInfo, error) {
origCtx := s.Root.Store.Context()
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "FileInfoStore.GetFromMaster")
s.Root.Store.SetContext(newCtx)
defer func() {
s.Root.Store.SetContext(origCtx)
}()
defer span.Finish()
result, err := s.FileInfoStore.GetFromMaster(id)
if err != nil {
span.LogFields(spanlog.Error(err))
ext.Error.Set(span, true)
}
return result, err
}
func (s *OpenTracingLayerFileInfoStore) GetWithOptions(page int, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, error) {
origCtx := s.Root.Store.Context()
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "FileInfoStore.GetWithOptions")