-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Array, passed to Objects.hash(), should be wrapped into Arrays.hashCode() #15383
Conversation
How does this change the behavior of this code? Needs a test? |
@@ -103,7 +103,7 @@ public boolean equals(final Object o) { | |||
|
|||
@Override | |||
public int hashCode() { | |||
return Objects.hash(trimAboveSeqNo, maxSeenAutoIdTimestampOnPrimary, operations); | |||
return Objects.hash(trimAboveSeqNo, maxSeenAutoIdTimestampOnPrimary, Arrays.hashCode(operations)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are increasing time complexity by doing this change for sure. Is there a specific reason for doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sandeshkr419 the hash of operations
here is the array object's hash, but does not hash the contents. You could have a case of two different arrays containing the same elements, which would produce a different hashCode here but match the .equals()
check which uses Arrays.equals()
. This is a good change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change LGTM.
@dk2k please add a test to ResyncReplicationRequestTests to validate that equals()
and hashCode()
are consistent for two different arrays with the same elements. It should fail before this change and succeed after it.
Also as a bugfix this needs a change log.
…0 in /plugins/discovery-gce (opensearch-project#16306) * Bump com.google.oauth-client:google-oauth-client Bumps [com.google.oauth-client:google-oauth-client](https://github.com/googleapis/google-oauth-java-client) from 1.35.0 to 1.36.0. - [Release notes](https://github.com/googleapis/google-oauth-java-client/releases) - [Changelog](https://github.com/googleapis/google-oauth-java-client/blob/main/CHANGELOG.md) - [Commits](googleapis/google-oauth-java-client@v1.35.0...v1.36.0) --- updated-dependencies: - dependency-name: com.google.oauth-client:google-oauth-client dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Updating SHAs Signed-off-by: dependabot[bot] <support@github.com> * Update changelog Signed-off-by: dependabot[bot] <support@github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
…ct#16310) * Bump lycheeverse/lychee-action from 1.10.0 to 2.0.2 Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.10.0 to 2.0.2. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](lycheeverse/lychee-action@v1.10.0...v2.0.2) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
…s/repository-azure (opensearch-project#16311) * Bump com.azure:azure-core-http-netty in /plugins/repository-azure Bumps [com.azure:azure-core-http-netty](https://github.com/Azure/azure-sdk-for-java) from 1.15.4 to 1.15.5. - [Release notes](https://github.com/Azure/azure-sdk-for-java/releases) - [Commits](Azure/azure-sdk-for-java@azure-core-http-netty_1.15.4...azure-core-http-netty_1.15.5) --- updated-dependencies: - dependency-name: com.azure:azure-core-http-netty dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Updating SHAs Signed-off-by: dependabot[bot] <support@github.com> * Update changelog Signed-off-by: dependabot[bot] <support@github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
…sitory-gcs (opensearch-project#16308) * Bump com.google.code.gson:gson in /plugins/repository-gcs Bumps [com.google.code.gson:gson](https://github.com/google/gson) from 2.10.1 to 2.11.0. - [Release notes](https://github.com/google/gson/releases) - [Changelog](https://github.com/google/gson/blob/main/CHANGELOG.md) - [Commits](google/gson@gson-parent-2.10.1...gson-parent-2.11.0) --- updated-dependencies: - dependency-name: com.google.code.gson:gson dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Updating SHAs Signed-off-by: dependabot[bot] <support@github.com> * Update changelog Signed-off-by: dependabot[bot] <support@github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
…h-project#16290) Signed-off-by: David Zane <davizane@amazon.com> Signed-off-by: Ankit Jain <akjain@amazon.com> Co-authored-by: Ankit Jain <akjain@amazon.com>
…es (opensearch-project#14383) Signed-off-by: kkewwei <kkewwei@163.com>
…16323) We have guarded the experimental query approximation framework behind a feature flag. In order to easily measure the impact of approximation on big5 benchmarks, it would be nice to have a benchmark config. Signed-off-by: Michael Froh <froh@amazon.com>
…t#16236) Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
…ch-project#16282) --------- Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
…o null on index creation (opensearch-project#16331) * Fix wrong value when setting index.number_of_routing_shards to null on index creation Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Modify change log Signed-off-by: Gao Binlong <gbinlong@amazon.com> --------- Signed-off-by: Gao Binlong <gbinlong@amazon.com>
…sue (performance regression) (opensearch-project#16342) Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
…ld (opensearch-project#15258) * fix cluster not able to spin up issue when disk usage exceeds threshold Signed-off-by: zane-neo <zaniu@amazon.com> * Add comment to changes Signed-off-by: zane-neo <zaniu@amazon.com> * Add UT to ensure the keepAliveThread starts before node starts Signed-off-by: zane-neo <zaniu@amazon.com> * remove unused imports Signed-off-by: zane-neo <zaniu@amazon.com> * Fix forbidden API calls check failed issue Signed-off-by: zane-neo <zaniu@amazon.com> * format code Signed-off-by: zane-neo <zaniu@amazon.com> * format code Signed-off-by: zane-neo <zaniu@amazon.com> * change setInstance method to static Signed-off-by: zane-neo <zaniu@amazon.com> * Add countdownlatch in test to coordinate the thread to avoid concureency issue caused test failure Signed-off-by: zane-neo <zaniu@amazon.com> --------- Signed-off-by: zane-neo <zaniu@amazon.com>
…t V2 (opensearch-project#16344) --------- Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
…nated by a newline [\n]' failures (opensearch-project#16337) * [Streaming Indexing] Fix intermittent 'The bulk request must be terminated by a newline [\n]' failures Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> --------- Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
…rch-project#15386) * Fixed inefficient Stream API call chains ending with count() Signed-off-by: Dmitry Kryukov <dk2k@ya.ru> * Refactored method minTermLength() as per @sandeshkr419's advice Signed-off-by: Dmitry Kryukov <dk2k@ya.ru> * Added a line in CHANGELOG.md Signed-off-by: Dmitry Kryukov <dk2k@ya.ru> --------- Signed-off-by: Dmitry Kryukov <dk2k@ya.ru>
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
* Make Remote Publication a dynamic setting Signed-off-by: Shivansh Arora <hishiv@amazon.com> Co-authored-by: Sooraj Sinha <soosinha@amazon.com>
…roject#16037) --------- Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
…6358) Signed-off-by: Andrew Ross <andrross@amazon.com>
Signed-off-by: Dmitry Kryukov <dk2k@ya.ru>
Sorry, this rebase mess happened again. |
@dk2k It actually took me a few years to figure out how to do it. A
At this point you may get merge conflicts. You can usually resolve them in your editor. Add/stage each file you fix the conflicts in, and then type
|
Sometimes that rebase is nasty. Here's an even less sophisticated way to get out of this: https://code.dblock.org/2015/08/31/getting-out-of-your-first-git-mess.html. |
Array, passed to Objects.hash(), should be wrapped into Arrays.hashCode()