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

Removing hard coded value of max concurrent shard requests #3364

Merged
merged 1 commit into from
May 18, 2022

Conversation

jainankitk
Copy link
Collaborator

Signed-off-by: Ankit Jain jain.ankitk@gmail.com

Description

Removes the hard coding for max concurrent shard requests

Issues Resolved

#3363

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

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.

Signed-off-by: Ankit Jain <jain.ankitk@gmail.com>
@jainankitk jainankitk requested review from a team and reta as code owners May 17, 2022 22:13
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success bd99b0b
Log 5415

Reports 5415

Copy link
Collaborator

@Bukhtawar Bukhtawar left a comment

Choose a reason for hiding this comment

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

Thanks @jainankitk should we also add a test to ensure that we catch it if it accidentally gets reset to 1

Copy link
Collaborator

@nknize nknize 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 doing this. It puts the action in sync w/ AbstractSearchAsyncActionTests#createAction. It's up to you if you want to add a test to make sure the maxConcurrentRequestsPerNode member variable keeps the value. I don't think it's necessary and will likely require you to add a getter method just for the test.

@jainankitk
Copy link
Collaborator Author

@nknize @Bukhtawar - Yeah, I could not think of good way to add test. Maybe we can merge the PR, to fix the regression asap and I will keep the issue open to add test whenever I have time?

@nknize
Copy link
Collaborator

nknize commented May 18, 2022

Maybe we can merge the PR, to fix the regression asap and I will keep the issue open to add test whenever I have time?

+1 So we don't miss (and in case another contributor wants to pick it up) go ahead and open an issue and throw a TODO in the code w/ a link to the issue.

@reta
Copy link
Collaborator

reta commented May 18, 2022

@nknize backport to 2.0, wdyt?

@reta reta added the backport 2.x Backport to 2.x branch label May 18, 2022
@nknize
Copy link
Collaborator

nknize commented May 18, 2022

backport to 2.0, wdyt?

yes

@nknize nknize added backport 2.0 Backport to 2.0 branch bug Something isn't working Indexing & Search labels May 18, 2022
@nknize nknize merged commit f8b102c into opensearch-project:main May 18, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 18, 2022
Signed-off-by: Ankit Jain <jain.ankitk@gmail.com>
(cherry picked from commit f8b102c)
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 18, 2022
Signed-off-by: Ankit Jain <jain.ankitk@gmail.com>
(cherry picked from commit f8b102c)
@nknize
Copy link
Collaborator

nknize commented May 18, 2022

+1 So we don't miss (and in case another contributor wants to pick it up) go ahead and open an issue and throw a TODO in the code w/ a link to the issue.

don't worry about the TODO in the code (they're often overlooked and rarely taken out).. let's just open a low hanging fruit issue to track the test.

@jainankitk
Copy link
Collaborator Author

don't worry about the TODO in the code (they're often overlooked and rarely taken out).. let's just open a low hanging fruit issue to track the test.

@nknize Thank you for promptly merging this fix. Created separate issue for adding test #3384

dblock pushed a commit that referenced this pull request May 18, 2022
…3375)

Signed-off-by: Ankit Jain <jain.ankitk@gmail.com>
(cherry picked from commit f8b102c)

Co-authored-by: Ankit Jain <jain.ankitk@gmail.com>
@dblock
Copy link
Member

dblock commented May 18, 2022

It's up to you if you want to add a test to make sure the maxConcurrentRequestsPerNode member variable keeps the value. I don't think it's necessary and will likely require you to add a getter method just for the test.

FWIW, I don't agree, it's a bug, the value here isn't propagating properly in some scenario, so we should have a test. Otherwise I'll accidentally change it back to 1 and nothing will break.

dblock pushed a commit that referenced this pull request May 18, 2022
…3376)

Signed-off-by: Ankit Jain <jain.ankitk@gmail.com>
(cherry picked from commit f8b102c)

Co-authored-by: Ankit Jain <jain.ankitk@gmail.com>
@jainankitk
Copy link
Collaborator Author

FWIW, I don't agree, it's a bug, the value here isn't propagating properly in some scenario, so we should have a test. Otherwise I'll accidentally change it back to 1 and nothing will break.

I agree with @dblock that we must have test (not optional) for preventing this regression from happening again. Though, I agree with @nknize to not hold the check-in back for test if it takes few days to get the tests in. This code is not new, but rather artifact of regression due to other commit.

@nknize
Copy link
Collaborator

nknize commented May 18, 2022

I'll accidentally change it back to 1 and nothing will break.

Nothing should break. 1 is a valid value.

the value here isn't propagating properly in some scenario

The value was straight hard coded to 1.

While the test should be as simple as ensuring the value matches the input, we need to avoid relaxing modifiers just for tests. So that needs a little more thought. It can wait to not hold up the fix and addressed in a follow up.

@Bukhtawar
Copy link
Collaborator

@nknize Totally agree. Sure 1 is a valid value however we cannot allow the change to be reverted by a future commit for the same reason that it was tagged as a BUG.
I am glad we have a follow up issue but what I am afraid is if it doesn't get picked up now unlikely we would see that getting picked up in near future

@nknize
Copy link
Collaborator

nknize commented May 18, 2022

if it doesn't get picked up now unlikely we would see that getting picked up in near future

That's a fair concern. Label as a good first issue and high severity and it shouldn't linger. @jainankitk do you also want to assign it to yourself to prioritize it now that the fix is merged?

@jainankitk
Copy link
Collaborator Author

jainankitk commented May 20, 2022

@nknize @Bukhtawar I took first stab at it and after spending some time came up with below assertion. I liked this approach as we are not adding relaxing modifiers just for testing. Unfortunately, none of our tests trigger this code path at all! :( So, I guess this is going to take more time than expected.

Open to any suggestions for expediting this.

diff --git a/server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java b/server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java
index 1d6d3f284d5..40070827082 100644
--- a/server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java
+++ b/server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java
@@ -152,6 +152,7 @@ abstract class AbstractSearchAsyncAction<Result extends SearchPhaseResult> exten
         // on a per shards level we use shardIt.remaining() to increment the totalOps pointer but add 1 for the current shard result
         // we process hence we add one for the non active partition here.
         this.expectedTotalOps = shardsIts.totalSizeWith1ForEmpty();
+        assert maxConcurrentRequestsPerNode == request.getMaxConcurrentShardRequests() || maxConcurrentRequestsPerNode == shardsIts.size();
         this.maxConcurrentRequestsPerNode = maxConcurrentRequestsPerNode;
         // in the case were we have less shards than maxConcurrentRequestsPerNode we don't need to throttle
         this.throttleConcurrentRequests = maxConcurrentRequestsPerNode < shardsIts.size();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch backport 2.0 Backport to 2.0 branch bug Something isn't working Indexing & Search
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants