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

[JENKINS-60563] Replace MD5 with SHA-256 in ConsistentHash #5028

Merged

Conversation

Wadeck
Copy link
Contributor

@Wadeck Wadeck commented Oct 24, 2020

  • Also update outdated link
  • Reformat some of the code
  • Adjust the tests
  • Ignore the performance test
  • Correct typos

ℹ️ No usage of that class in the ecosystem (Edit: outside Jenkins core that is using it for Queue)
⚠️ For CloudBees, please check Slack.

See JENKINS-60563.

Proposed changelog entries

  • (internal) Modernize the hashing function of ConsistentHash

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • [n/a] For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are correct
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

- Also update outdated link
- Reformat some of the code
- Adjust the tests
- Ignore the performance test
- Correct typos
@timja
Copy link
Member

timja commented Oct 24, 2020

No usage of that class in the ecosystem

why have it then?

@Wadeck
Copy link
Contributor Author

Wadeck commented Oct 24, 2020

why have it then?

Used in Jenkins core only :) (description updated)

Copy link
Contributor

@StefanSpieker StefanSpieker left a comment

Choose a reason for hiding this comment

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

Replacing the MD5 is a good idea 👍

@@ -183,18 +185,20 @@ public String hash(String str) {
* This test doesn't fail but it's written to measure the performance of the consistent hash function with large data set.
*/
@Test
@Ignore("Helper test for performance, no assertion")
Copy link
Contributor

Choose a reason for hiding this comment

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

Fine with me, is the performance difference for this implementation noteworthy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No tested due to Hash function comparison, the difference should be around 5-10% between MD5 and SHA-256.

It's not like we are moving from MD5 to BCrypt :)

Copy link
Member

@jvz jvz left a comment

Choose a reason for hiding this comment

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

Seems fine, though I wonder if there's a non-cryptographic hash function that would work better for this use case.

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Fine with me. Maybe it is a good time to deprecate the class also.

We may merge it in 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process

@oleg-nenashev oleg-nenashev added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Nov 4, 2020
@oleg-nenashev oleg-nenashev merged commit 748e8b2 into jenkinsci:master Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
6 participants