Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Improve delete after execution timing #288

Open
dzane17 opened this issue Mar 26, 2025 · 0 comments · May be fixed by #289
Open

[BUG] Improve delete after execution timing #288

dzane17 opened this issue Mar 26, 2025 · 0 comments · May be fixed by #289
Assignees
Labels
bug Something isn't working v3.0.0

Comments

@dzane17
Copy link
Collaborator

dzane17 commented Mar 26, 2025

What is the bug?

Local indices are retained longer than expected. For example, we observed a domain containing local indices for the past 3 days when delete_after_days=1.

This is caused by 2 factors:

  1. Periodic job to delete indices is scheduled at a 24 hours interval starting from when the domain/node is created. If a node boots up at 14:30, the job will run at 14:30 every day in the future. We have no control over when the OpenSearch process starts, so this is non deterministic.
    scheduledFutures.add(
    threadPool.scheduleWithFixedDelay(
    this::deleteExpiredTopNIndices,
    new TimeValue(1, TimeUnit.DAYS), // Check for deletable indices once per day
    QueryInsightsSettings.QUERY_INSIGHTS_EXECUTOR
    )
    );
  2. Expiration is calculated with current time. That means the local index creation time in relation to the daily job start time can add an extra day of retention.
    final long expirationMillisLong = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(
    ((LocalIndexExporter) topQueriesExporter).getDeleteAfter()
    );

How can one reproduce the bug?

Steps to reproduce the behavior.

What is the expected behavior?

Do not allow local indices to overstay the delete_after_days setting value

What is your host/environment?

Operating system, version.

Do you have any screenshots?

If applicable, add screenshots to help explain your problem.

Do you have any additional context?

Add any other context about the problem.

@dzane17 dzane17 added bug Something isn't working untriaged and removed untriaged labels Mar 26, 2025
@dzane17 dzane17 self-assigned this Mar 26, 2025
@dzane17 dzane17 linked a pull request Mar 27, 2025 that will close this issue
@dzane17 dzane17 removed the untriaged label Mar 27, 2025
@deshsidd deshsidd added the v3.0.0 label Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v3.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants