Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Skip reloading certain search indices #1270

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions server/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,8 @@ type SearchConfig struct {
AuthKey string `json:"auth_key" mapstructure:"auth_key" yaml:"auth_key"`
ReadEnabled bool `json:"read_enabled" mapstructure:"read_enabled" yaml:"read_enabled"`
WriteEnabled bool `json:"write_enabled" mapstructure:"write_enabled" yaml:"write_enabled"`
// SkipPrefixedIndices is a temporary solution that skips reloading certain search indices
SkipPrefixedIndices string `json:"skip_prefixed_indices" mapstructure:"skip_prefixed_indices" yaml:"skip_prefixed_indices"`
// StorageEnabled only applies to standalone search indexes. This is to enable persisting search indexes to storage.
StorageEnabled bool `json:"storage_enabled" mapstructure:"storage_enabled" yaml:"storage_enabled"`
// Chunking allows us to persist bigger search indexes payload in storage.
Expand Down
5 changes: 5 additions & 0 deletions server/metadata/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"fmt"
"reflect"
"strings"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -814,6 +815,10 @@ func (tenant *Tenant) reloadSearch(ctx context.Context, tx transaction.Tx, proje
searchObj := NewSearch()

for _, searchMD := range projMetadata.SearchMetadata {
if config.DefaultConfig.Search.SkipPrefixedIndices != "" && strings.HasPrefix(searchMD.Name, config.DefaultConfig.Search.SkipPrefixedIndices) {
log.Warn().Str("index", searchMD.Name).Msg("Skipped reloading")
continue
}
schV, err := tenant.searchSchemaStore.GetLatest(ctx, tx, tenant.namespace.Id(), project.id, searchMD.Name)
if err != nil {
return nil, err
Expand Down