graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

Delete index via API not scaling with huge amount of index sets

Open HenryTheSir opened this issue 1 year ago • 1 comments

Expected Behavior

Fast deleting of indices via Graylog REST API independent of index set amount

Current Behavior

Deleting of indices gets slower as more index sets the cluster has. The reason can be found here, as graylog iterates over all index sets if an index gets deleted by api: https://github.com/Graylog2/graylog2-server/blob/5.2/graylog2-server/src/main/java/org/graylog2/indexer/MongoIndexSetRegistry.java#L234

This Method iterates over all index Sets which are currently in the cluster to check if the current write index equals the index which should be deleted. In our env this are over 500 Calls to Opensearch (/_alias/<index_prefix>_deflector) As this calls are made one after another the response time for the delete calls stack ups to ~5-10 Minutes.

Possible Solution

A much nicer approach would be to test /<index_name>/_alias if this response contains any alias ending with _deflector
(All methods in this Class seam not to scale very well with rising index sets, we observed problems with deleting sofar. )

Steps to Reproduce (for bugs)

  1. Create high amound index sets
  2. try to delete an index in graylog via rest api
  3. wait very long

Context

There are various reasons why one would like to delete an index via graylog webui or by rest api.

Your Environment

  • Graylog Version: 5.2.4
  • Java Version: JDK 17
  • OpenSearch Version: 2.12
  • MongoDB Version: 5
  • Operating System: RHEL 8
  • Browser version: Firefox latest ESR

HenryTheSir avatar Mar 11 '24 15:03 HenryTheSir

Hey @HenryTheSir!

Thank you very much for reporting this and providing very helpful details!

dennisoelkers avatar Mar 11 '24 15:03 dennisoelkers

Closed with PR #21195.

fpetersen-gl avatar Dec 18 '24 08:12 fpetersen-gl