Skip to content

Commit

Permalink
fix: delete for indexes should cleanup from metdata even if inmemory …
Browse files Browse the repository at this point in the history
…view is stale (#1274)
  • Loading branch information
himank committed Jun 13, 2023
1 parent cf71306 commit 908416e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion server/metadata/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Check warning on line 962 in server/metadata/tenant.go

View check run for this annotation

Codecov / codecov/patch

server/metadata/tenant.go#L961-L962

Added lines #L961 - L962 were not covered by tests

searchFactory, err := schema.NewFactoryBuilder(false).BuildSearch(indexName, schV.Schema)
if err != nil {
return err
}

Check warning on line 967 in server/metadata/tenant.go

View check run for this annotation

Codecov / codecov/patch

server/metadata/tenant.go#L966-L967

Added lines #L966 - L967 were not covered by tests

searchStoreIndexName := tenant.Encoder.EncodeSearchTableName(tenant.namespace.Id(), project.Id(), indexName)
index = schema.NewSearchIndex(schV.Version, searchStoreIndexName, searchFactory, nil)

Check warning on line 970 in server/metadata/tenant.go

View check run for this annotation

Codecov / codecov/patch

server/metadata/tenant.go#L969-L970

Added lines #L969 - L970 were not covered by tests
}

return tenant.deleteSearchIndex(ctx, tx, project, index)
Expand Down

0 comments on commit 908416e

Please sign in to comment.