Skip to content

Conversation

@tandonks
Copy link
Collaborator

@tandonks tandonks commented Dec 6, 2025

Description

Adds a new prevent_empty_rollover parameter to the ISM rollover action that prevents rolling over indices with zero documents, addressing a critical user pain point where empty indices continuously roll over due to OR-based condition semantics.

Introduces an optional prevent_empty_rollover boolean parameter that checks document count before evaluating other rollover conditions:

{
  "rollover": {
    "min_index_age": "7d",
    "min_size": "50gb",
    "prevent_empty_rollover": true
  }
}

When prevent_empty_rollover: true:

  • Rollover is prevented if doc_count = 0
  • Step status returns CONDITION_NOT_MET (retries not consumed)
  • Rollover proceeds normally once documents are added
  • Existing OR behavior unchanged for non-empty indices

Related Issues

Resolves #1541

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…er of indices with zero documents

Signed-off-by: Kshitij Tandon <[email protected]>
@tandonks tandonks marked this pull request as ready for review December 6, 2025 20:44
@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.17%. Comparing base (0063142) to head (2c75593).

Files with missing lines Patch % Lines
...atemanagement/step/rollover/AttemptRolloverStep.kt 92.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1542      +/-   ##
==========================================
+ Coverage   76.15%   76.17%   +0.02%     
==========================================
  Files         375      375              
  Lines       17569    17588      +19     
  Branches     2411     2415       +4     
==========================================
+ Hits        13379    13397      +18     
- Misses       2948     2952       +4     
+ Partials     1242     1239       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

out.writeOptionalTimeValue(minAge)
out.writeOptionalWriteable(minPrimaryShardSize)
out.writeBoolean(copyAlias)
out.writeBoolean(preventEmptyRollover)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not have a version check here for backward compatibility?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh right, thanks for catching this, let me make the change

Copy link
Member

@shiv0408 shiv0408 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this change @tandonks, I just have one comment regarding backward compatibility. Please check if that change is required.

@tandonks
Copy link
Collaborator Author

tandonks commented Dec 8, 2025

I had raised the PR from main rather than fork, so shifting it to new #1545

@shiv0408 shiv0408 closed this Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add support to prevent rollover of empty indices

2 participants