Skip to content

Conversation

@tandonks
Copy link
Collaborator

@tandonks tandonks commented Dec 8, 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]>
Signed-off-by: Kshitij Tandon <[email protected]>
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.14%. Comparing base (cd87aa2) to head (765f0a6).
⚠️ Report is 1 commits behind head on main.

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    #1545      +/-   ##
==========================================
+ Coverage   76.07%   76.14%   +0.06%     
==========================================
  Files         375      375              
  Lines       17569    17591      +22     
  Branches     2411     2417       +6     
==========================================
+ Hits        13365    13394      +29     
+ Misses       2961     2953       -8     
- Partials     1243     1244       +1     

☔ 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.

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.

LGTM!

@shiv0408 shiv0408 merged commit fe5da1d into opensearch-project:main Dec 8, 2025
23 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 3.4 failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/index-management/backport-3.4 3.4
# Navigate to the new working tree
pushd ../.worktrees/index-management/backport-3.4
# Create a new branch
git switch --create backport/backport-1545-to-3.4
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 fe5da1d5afa33e120aba957220732be46111dc47
# Push it to GitHub
git push --set-upstream origin backport/backport-1545-to-3.4
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/index-management/backport-3.4

Then, create a pull request where the base branch is 3.4 and the compare/head branch is backport/backport-1545-to-3.4.

@shiv0408
Copy link
Member

shiv0408 commented Dec 8, 2025

@tandonks Backport seems to be failing, can you manually backport it?

tandonks added a commit that referenced this pull request Dec 9, 2025
…er on empty indices (#1545)

* Add boolean parameter to the ISM rollover action that prevents rollover of indices with zero documents

Signed-off-by: Kshitij Tandon <[email protected]>

* Add version checks

Signed-off-by: Kshitij Tandon <[email protected]>

---------

Signed-off-by: Kshitij Tandon <[email protected]>
(cherry picked from commit fe5da1d)
@tandonks
Copy link
Collaborator Author

tandonks commented Dec 9, 2025

Have raised the manula backport PR: #1547
@shiv0408 can you please help with the review and merge? Thanks!

shiv0408 pushed a commit that referenced this pull request Dec 9, 2025
…er on empty indices (#1545) (#1547)

* Add boolean parameter to the ISM rollover action that prevents rollover of indices with zero documents



* Add version checks



---------


(cherry picked from commit fe5da1d)

Signed-off-by: Kshitij Tandon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add support to prevent rollover of empty indices

2 participants