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

Array, passed to Objects.hash(), should be wrapped into Arrays.hashCode() #15383

Closed
wants to merge 307 commits into from

Conversation

dk2k
Copy link
Contributor

@dk2k dk2k commented Aug 23, 2024

Array, passed to Objects.hash(), should be wrapped into Arrays.hashCode()

Copy link
Contributor

✅ Gradle check result for 9abc6d8: SUCCESS

Copy link

codecov bot commented Aug 23, 2024

Codecov Report

Attention: Patch coverage is 85.96974% with 102 lines in your changes missing coverage. Please review.

Project coverage is 72.00%. Comparing base (dc8a435) to head (ce74105).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...search/cache/common/tier/TieredSpilloverCache.java 93.21% 13 Missing and 6 partials ⚠️
...opensearch/identity/shiro/ShiroIdentityPlugin.java 0.00% 16 Missing ⚠️
...common/io/stream/BufferedChecksumStreamOutput.java 72.09% 12 Missing ⚠️
...ch/plugin/wlm/rest/RestUpdateQueryGroupAction.java 0.00% 8 Missing ⚠️
...search/gradle/testfixtures/TestFixturesPlugin.java 0.00% 6 Missing ⚠️
.../opensearch/cache/store/disk/EhcacheDiskCache.java 75.00% 3 Missing and 3 partials ⚠️
...in/wlm/action/TransportUpdateQueryGroupAction.java 0.00% 5 Missing ⚠️
...rch/plugin/wlm/action/UpdateQueryGroupRequest.java 73.33% 4 Missing ⚠️
...ugin/wlm/service/QueryGroupPersistenceService.java 92.85% 2 Missing and 2 partials ⚠️
...opensearch/gradle/docker/DockerSupportService.java 0.00% 3 Missing ⚠️
... and 13 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #15383      +/-   ##
============================================
+ Coverage     71.96%   72.00%   +0.04%     
- Complexity    64791    64816      +25     
============================================
  Files          5307     5307              
  Lines        302714   302725      +11     
  Branches      43733    43734       +1     
============================================
+ Hits         217836   217991     +155     
+ Misses        67013    66823     -190     
- Partials      17865    17911      +46     

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

@dblock
Copy link
Member

dblock commented Aug 23, 2024

How does this change the behavior of this code? Needs a test?

@dblock dblock added backport 2.x Backport to 2.x branch skip-changelog labels Aug 23, 2024
@@ -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));
Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Member

@dbwiddis dbwiddis left a 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.

dependabot bot and others added 22 commits October 17, 2024 22:36
…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>
…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>
)

* Update last seen cluster state on apply commit

Signed-off-by: Sooraj Sinha <soosinha@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>
@dk2k dk2k requested review from jed326 and peternied as code owners October 17, 2024 19:38
@dk2k
Copy link
Contributor Author

dk2k commented Oct 17, 2024

Sorry, this rebase mess happened again.

@dk2k dk2k closed this Oct 17, 2024
@dbwiddis
Copy link
Member

Sorry, this rebase mess happened again.

@dk2k It actually took me a few years to figure out how to do it. A rebase is different than a merge. Here's some simple steps.

  1. On your local machine, switch to the main branch: git checkout main
  2. Get the latest from main: git pull upstream main
  3. Switch back to your pr branch: git checkout dk_array_hashcode
  4. Type git rebase main

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 git rebase --continue.

  1. Once you've got everything rebased, force push to your fork PR branch: git push -f.

Copy link
Contributor

✅ Gradle check result for ce74105: SUCCESS

@dblock
Copy link
Member

dblock commented Oct 18, 2024

@dk2k It actually took me a few years to figure out how to do it. A rebase is different than a merge. Here's some simple steps.

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.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.