From 908416edc32a06c93dbe0f771d593c74b4589bdc Mon Sep 17 00:00:00 2001 From: Himank Chaudhary Date: Mon, 12 Jun 2023 17:30:51 -0700 Subject: [PATCH] fix: delete for indexes should cleanup from metdata even if inmemory view is stale (#1274) --- server/metadata/tenant.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/metadata/tenant.go b/server/metadata/tenant.go index 5856ab83..3deb79a7 100644 --- a/server/metadata/tenant.go +++ b/server/metadata/tenant.go @@ -956,7 +956,18 @@ func (tenant *Tenant) DeleteSearchIndex(ctx context.Context, tx transaction.Tx, index, ok := project.search.GetIndex(indexName) if !ok { - return NewSearchIndexNotFoundErr(indexName) + schV, err := tenant.searchSchemaStore.GetLatest(ctx, tx, tenant.namespace.Id(), project.id, indexName) + if err != nil { + return err + } + + searchFactory, err := schema.NewFactoryBuilder(false).BuildSearch(indexName, schV.Schema) + if err != nil { + return err + } + + searchStoreIndexName := tenant.Encoder.EncodeSearchTableName(tenant.namespace.Id(), project.Id(), indexName) + index = schema.NewSearchIndex(schV.Version, searchStoreIndexName, searchFactory, nil) } return tenant.deleteSearchIndex(ctx, tx, project, index)