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

Add MinDocsCondition to Rollover API #7243

Closed

Conversation

shinbay-almaz
Copy link

@shinbay-almaz shinbay-almaz commented Apr 19, 2023

Description

Added MinDocsCondition to prevent rollover if the index has less than specified number of docs

Issues Resolved

#6780

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.71%. Comparing base (d7aa6dd) to head (c369090).
Report is 863 commits behind head on main.

❗ Current head c369090 differs from pull request most recent head 156a367. Consider uploading reports for the commit 156a367 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7243      +/-   ##
============================================
- Coverage     71.02%   70.71%   -0.32%     
+ Complexity    58078    56029    -2049     
============================================
  Files          4825     4670     -155     
  Lines        274032   265699    -8333     
  Branches      39930    39015     -915     
============================================
- Hits         194628   187876    -6752     
+ Misses        63067    61927    -1140     
+ Partials      16337    15896     -441     

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

@@ -131,6 +132,18 @@ public RolloverRequest addMaxIndexSizeCondition(ByteSizeValue size) {
return this;
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

same description as addMaxIndexDocsCondition. Specify what makes them different.

import java.io.IOException;

/**
* Condition for minimum index docs. Evaluates to <code>true</code>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: same as above - mention how it's different from maxDocs.

boolean metMinDocsCondition = rolloverRequest.getConditions().containsKey(MinDocsCondition.NAME)
? conditionResults.get(rolloverRequest.getConditions().get(MinDocsCondition.NAME))
: true;
if (conditionResults.size() == 0 || (metConditions.size() > 0 && metMinDocsCondition)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to confirm: our expected behavior is that when a minDocsCondition is set -
any max condition and minDocsCondition must be true in order to rollover?

Copy link
Author

Choose a reason for hiding this comment

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

I think so. If there is no enough number of docs, it should not rollover

for (Map.Entry<String, Boolean> entry : results.entrySet()) {
if (entry.getKey().equals(maxAgeCondition.toString())) {
assertThat(entry.getValue(), equalTo(true));
} else if (entry.getKey().equals(maxDocsCondition.toString())) {
assertThat(entry.getValue(), equalTo(false));
} else if (entry.getKey().equals(maxSizeCondition.toString())) {
assertThat(entry.getValue(), equalTo(false));
} else if (entry.getKey().equals(minDocsCondition.toString())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In a test, it makes more sense to have deterministic expected outcomes. We could set the minDocsCondition value to 10, in which case the expected value will always be false.

@Poojita-Raj
Copy link
Contributor

Thanks @shinbay-almaz for contributing by opening this PR!
Since it is an API that's customer facing, we should make sure to document this change. You can open another issue in opensearch-project/documentation-website requesting this parameter be documented for the rollover API once this change is merged in.

@opensearch-trigger-bot
Copy link
Contributor

This PR was closed because it has been stalled for 7 days with no activity.

@kotwanikunal
Copy link
Member

Apologies. This PR was auto closed without reaching a resolution from the maintainers.
Re-opening to move it forward.
Thanks for your contributions to OpenSearch!

@github-actions
Copy link
Contributor

github-actions bot commented Sep 14, 2023

Compatibility status:

Checks if related components are compatible with change 2ef35db

Incompatible components

Skipped components

Compatible components

Compatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/reporting.git]

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@shinbay-almaz
Copy link
Author

@kotwanikunal Hi 👋 Sorry that I left in the middle. I had work in this summer. I think now I can finally complete this PR

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Almaz Shinbay <shinbay.almaz@gmail.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@ticheng-aws
Copy link
Contributor

Hi @shinbay-almaz, the PR is stalled. Is this being worked upon? Feel free to reach out to maintainers for further reviews.

@ticheng-aws ticheng-aws added the enhancement Enhancement or improvement to existing feature or request label Jan 6, 2024
@opensearch-trigger-bot opensearch-trigger-bot bot removed the stalled Issues that have stalled label Jan 14, 2024
@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added stalled Issues that have stalled and removed stalled Issues that have stalled labels Mar 1, 2024
@stephen-crawford
Copy link
Contributor

It seems like this contribution is stalled. I would recommend we close it for now. @opensearch-project/opensearch-core could some close this please? Thanks

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added stalled Issues that have stalled and removed stalled Issues that have stalled labels May 5, 2024
@kotwanikunal
Copy link
Member

Closing this PR since there are no updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCI College Contributor Initiative related issues and PRs enhancement Enhancement or improvement to existing feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants