From efc7cecca2427d0d9b73d306f0d65f0189cdfc7c Mon Sep 17 00:00:00 2001 From: Jigar Joshi Date: Thu, 8 Jun 2023 22:42:28 -0700 Subject: [PATCH 1/3] fix: Skip reloading certain search indices (#1270) --- server/config/options.go | 2 ++ server/metadata/tenant.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/server/config/options.go b/server/config/options.go index 16537a6f..3b93d033 100644 --- a/server/config/options.go +++ b/server/config/options.go @@ -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. diff --git a/server/metadata/tenant.go b/server/metadata/tenant.go index 6ef6fa4e..5856ab83 100644 --- a/server/metadata/tenant.go +++ b/server/metadata/tenant.go @@ -19,6 +19,7 @@ import ( "context" "fmt" "reflect" + "strings" "sync" "testing" "time" @@ -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 From 2a4f4088e9d334d3a44c7d587204ffc588d41d83 Mon Sep 17 00:00:00 2001 From: Jigar Joshi Date: Fri, 9 Jun 2023 10:58:24 -0700 Subject: [PATCH 2/3] Revert "fix: Skip reloading certain search indices (#1270)" (#1272) This reverts commit efc7cecca2427d0d9b73d306f0d65f0189cdfc7c. --- server/config/options.go | 2 -- server/metadata/tenant.go | 5 ----- 2 files changed, 7 deletions(-) diff --git a/server/config/options.go b/server/config/options.go index 3b93d033..16537a6f 100644 --- a/server/config/options.go +++ b/server/config/options.go @@ -619,8 +619,6 @@ 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. diff --git a/server/metadata/tenant.go b/server/metadata/tenant.go index 5856ab83..6ef6fa4e 100644 --- a/server/metadata/tenant.go +++ b/server/metadata/tenant.go @@ -19,7 +19,6 @@ import ( "context" "fmt" "reflect" - "strings" "sync" "testing" "time" @@ -815,10 +814,6 @@ 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 From cf71306a7e834eff4b98fe226ed627428588dcc5 Mon Sep 17 00:00:00 2001 From: Himank Chaudhary Date: Mon, 12 Jun 2023 15:39:47 -0700 Subject: [PATCH 3/3] Revert "Revert "fix: Skip reloading certain search indices (#1270)" (#1272)" (#1273) This reverts commit 2a4f4088e9d334d3a44c7d587204ffc588d41d83. --- server/config/options.go | 2 ++ server/metadata/tenant.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/server/config/options.go b/server/config/options.go index 16537a6f..3b93d033 100644 --- a/server/config/options.go +++ b/server/config/options.go @@ -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. diff --git a/server/metadata/tenant.go b/server/metadata/tenant.go index 6ef6fa4e..5856ab83 100644 --- a/server/metadata/tenant.go +++ b/server/metadata/tenant.go @@ -19,6 +19,7 @@ import ( "context" "fmt" "reflect" + "strings" "sync" "testing" "time" @@ -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