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

Handling BAD_REQUEST exceptions as failures even with shard.tolerant as true #139

Conversation

justinrsweeney
Copy link

This will ensure that distributed requests are considered failing requests if any shard fails with a BAD_REQUEST (400) error indicating that that request is not something that can just succeed on retry.

Copy link
Collaborator

@magibney magibney left a comment

Choose a reason for hiding this comment

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

A couple of minor suggestions, but overall looks good!

For potential upstreaming (which would depend on upstreaming #129) we'd probably want to check and make sure there are not other contexts in which shards.tolerant is applied, and if so make corresponding changes there.

Comment on lines +84 to +87
public int getRspCode() {
return rspCode;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 surprising that this wasn't already accessible! Seems pretty general-purpose useful.

Comment on lines +363 to +375

solrQuery = new SolrQuery("{!surround maxBasicQueries=1000 df=title}10W(tes*,test*)");
solrQuery.add(ShardParams.SHARDS_TOLERANT, "true");
final QueryRequest req4 = new QueryRequest(solrQuery);
req4.setMethod(SolrRequest.METHOD.POST);
e =
assertThrows(
BaseHttpSolrClient.RemoteSolrException.class,
() -> req4.process(cloudSolrClient, collectionName));
assertEquals(400, e.code());
assertTrue(
e.getMessage()
.contains("Query contains too many nested clauses; maxClauseCount is set to 1"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

curious: with a mini solr cluster of size 1, wouldn't this request have failed even before this change?

Copy link
Author

Choose a reason for hiding this comment

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

Even with the cluster of size 1, it still flows through the distributed query section of the SearchHandler and previously did not result in an error, but would just return no results and partial results as true.

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, nice! so it was very tolerant before 😁

Comment on lines 96 to 98
private static final Collection<SolrException.ErrorCode> NONTOLERANT_ERROR_CODES =
List.of(SolrException.ErrorCode.BAD_REQUEST);

Copy link
Collaborator

@magibney magibney Sep 6, 2023

Choose a reason for hiding this comment

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

maybe just make this a Set -- i.e. Set<> X = Set.of() -- avoid the extra import. For a list of size 1 it's not going to matter much, but you're doing "set-like things" on this anyway, so there's little purpose served in going broader and making it a Collection.

@justinrsweeney
Copy link
Author

A couple of minor suggestions, but overall looks good!

For potential upstreaming (which would depend on upstreaming #129) we'd probably want to check and make sure there are not other contexts in which shards.tolerant is applied, and if so make corresponding changes there.

I did a quick look on this and I think this is the only area that would need to be changed, but I can do a more thorough look as part of upstreaming.

Copy link
Collaborator

@magibney magibney left a comment

Choose a reason for hiding this comment

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

LGTM!

@justinrsweeney justinrsweeney merged commit c238c08 into fs/branch_9x Sep 7, 2023
3 checks passed
justinrsweeney pushed a commit that referenced this pull request Sep 7, 2023
…as true (#139)

* Handling BAD_REQUEST exceptions as failures even with shard.tolerant as true

* Fixing forbiddenapi use

* Updating the set of error codes to just be a Set
justinrsweeney pushed a commit that referenced this pull request Sep 7, 2023
…as true (#139)

* Handling BAD_REQUEST exceptions as failures even with shard.tolerant as true

* Fixing forbiddenapi use

* Updating the set of error codes to just be a Set
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.

2 participants