Merge pull request #1628 from nagamocha3000/delete-id-allocs

Delete ids allocated for index if any present
This commit is contained in:
nagamocha3000 2021-06-04 16:51:32 +03:00 • committed by GitHub
commit 3b6ba01111
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

7
api.go
View file

@ -275,6 +275,13 @@ func (api *API) DeleteIndex(ctx context.Context, indexName string) error {
api.server.logger.Errorf("problem sending DeleteIndex message: %s", err)
return errors.Wrap(err, "sending DeleteIndex message")
}
// Delete ids allocated for index if any present
snap := topology.NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
if snap.IsPrimaryFieldTranslationNode(api.NodeID()) {
if err := api.holder.ida.reset(indexName); err != nil {
return errors.Wrap(err, "deleting id allocation for index")
}
}
api.holder.Stats.Count(MetricDeleteIndex, 1, 1.0)
return nil
}