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

Fix potential IllegalCapacityException in LLRC when selecting nodes #37821

Merged
merged 3 commits into from
Jan 25, 2019

Conversation

SivagurunathanV
Copy link
Contributor

Handling LLRC when live node size < 0

@elasticcla
Copy link

Hi @SivagurunathanV, we have found your signature in our records, but it seems like you have signed with a different e-mail than the one used in yout Git commit. Can you please add both of these e-mails into your Github profile (they can be hidden), so we can match your e-mails to your Github profile?

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

The change itself looks like the solution proposed in #37739, so that part looks fine. It would be good to have some sort of test though that checks this behaviour. It looks like it should be easy to unit-test RestClient#selectNodes even though it is package-private. There is already a RestClientTests that should be a good place for this.

@cbuescher cbuescher added >bug :Clients/Java Low Level REST Client Minimal dependencies Java Client for Elasticsearch v7.0.0 labels Jan 24, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@cbuescher cbuescher changed the title Fix for 37739 Fix potential IllegalCapacityException in LLRC when selecting nodes Jan 24, 2019
Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

As @cbuescher mentioned, do you think you could add a unit test for this @SivagurunathanV?

@@ -398,7 +398,7 @@ private void setHeaders(HttpRequest httpRequest, Collection<Header> requestHeade
/*
* Sort the nodes into living and dead lists.
*/
List<Node> livingNodes = new ArrayList<>(nodeTuple.nodes.size() - blacklist.size());
List<Node> livingNodes = new ArrayList<>(Math.max(0,nodeTuple.nodes.size() - blacklist.size()));
Copy link
Member

Choose a reason for hiding this comment

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

Super minor nit, could you add a space after the comma?

Suggested change
List<Node> livingNodes = new ArrayList<>(Math.max(0,nodeTuple.nodes.size() - blacklist.size()));
List<Node> livingNodes = new ArrayList<>(Math.max(0, nodeTuple.nodes.size() - blacklist.size()));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@SivagurunathanV
Copy link
Contributor Author

Added test case.

@dakrone
Copy link
Member

dakrone commented Jan 25, 2019

@elasticmachine ok to test

@SivagurunathanV
Copy link
Contributor Author

SivagurunathanV commented Jan 25, 2019

Hi @dakrone
I found one test failure issue

"org.elasticsearch.transport.ConnectTransportException: [node_sm1][127.0.0.1:37453] connect_exception
Caused by: java.net.ConnectException: Connection refused
on TcpTransport.java".

I would appreciate if can you help to debug on this or any point of reference?

Thanks,
Siva.

@SivagurunathanV
Copy link
Contributor Author

SivagurunathanV commented Jan 25, 2019

@dakrone @cbuescher
Fixed the issue in the build.

@dakrone dakrone merged commit a35701e into elastic:master Jan 25, 2019
@dakrone
Copy link
Member

dakrone commented Jan 25, 2019

Merged this, thanks for working through this @SivagurunathanV!

@SivagurunathanV
Copy link
Contributor Author

Thanks @dakrone & @cbuescher for guiding me in my first PR 👍.

Cheers.

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jan 25, 2019
* elastic/master: (68 commits)
  Fix potential IllegalCapacityException in LLRC when selecting nodes (elastic#37821)
  Mute CcrRepositoryIT#testFollowerMappingIsUpdated
  Fix S3 Repository ITs When Docker is not Available (elastic#37878)
  Pass distribution type through to docs tests (elastic#37885)
  Mute SharedClusterSnapshotRestoreIT#testSnapshotCanceledOnRemovedShard
  SQL: Fix casting from date to numeric type to use millis (elastic#37869)
  Migrate o.e.i.r.RecoveryState to Writeable (elastic#37380)
  ML: removing unnecessary upgrade code (elastic#37879)
  Relax cluster metadata version check (elastic#37834)
  Mute TransformIntegrationTests#testSearchTransform
  Refactored GeoHashGrid unit tests (elastic#37832)
  Fixes for a few randomized agg tests that fail hasValue() checks
  Geo: replace intermediate geo objects with libs/geo (elastic#37721)
  Remove NOREPLACE for /etc/elasticsearch in rpm and deb (elastic#37839)
  Remove "reinstall" packaging tests (elastic#37851)
  Add unit tests for ShardStateAction's ShardStartedClusterStateTaskExecutor (elastic#37756)
  Exit batch files explictly using ERRORLEVEL (elastic#29583)
  TransportUnfollowAction should increase settings version (elastic#37859)
  AsyncTwoPhaseIndexerTests race condition fixed (elastic#37830)
  Do not allow negative variances (elastic#37384)
  ...
ywelsch pushed a commit to ywelsch/elasticsearch that referenced this pull request Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Clients/Java Low Level REST Client Minimal dependencies Java Client for Elasticsearch v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants