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

pkg: stop using math/rand.Seed #48653

Merged
merged 3 commits into from
Nov 17, 2023
Merged

pkg: stop using math/rand.Seed #48653

merged 3 commits into from
Nov 17, 2023

Conversation

szpnygo
Copy link
Contributor

@szpnygo szpnygo commented Nov 17, 2023

What problem does this PR solve?

Issue Number: golang/go#54880

Problem Summary:

// Seed uses the provided seed value to initialize the default Source to a
// deterministic state. Seed values that have the same remainder when
// divided by 2³¹-1 generate the same pseudo-random sequence.
// Seed, unlike the Rand.Seed method, is safe for concurrent use.
//
// If Seed is not called, the generator is seeded randomly at program startup.
//
// Prior to Go 1.20, the generator was seeded like Seed(1) at program startup.
// To force the old behavior, call Seed(1) at program startup.
// Alternately, set GODEBUG=randautoseed=0 in the environment
// before making any calls to functions in this package.
//
// Deprecated: As of Go 1.20 there is no reason to call Seed with
// a random value. Programs that call Seed with a known value to get
// a specific sequence of results should use New(NewSource(seed)) to
// obtain a local random generator.
func Seed(seed int64) {

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Copy link

ti-chi-bot bot commented Nov 17, 2023

Welcome @szpnygo!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 17, 2023
Copy link

ti-chi-bot bot commented Nov 17, 2023

Hi @szpnygo. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

tiprow bot commented Nov 17, 2023

Hi @szpnygo. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@szpnygo szpnygo changed the title stop using math/rand.Seed pkg: stop using math/rand.Seed Nov 17, 2023
@lance6716
Copy link
Contributor

/ok-to-test

Copy link

codecov bot commented Nov 17, 2023

Codecov Report

Merging #48653 (e2dc107) into master (1f7c1e0) will increase coverage by 1.4361%.
Report is 3 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #48653        +/-   ##
================================================
+ Coverage   71.2194%   72.6555%   +1.4361%     
================================================
  Files          1360       1389        +29     
  Lines        403915     410786      +6871     
================================================
+ Hits         287666     298459     +10793     
+ Misses        96337      93439      -2898     
+ Partials      19912      18888      -1024     
Flag Coverage Δ
integration 43.5524% <ø> (?)
unit 71.0808% <ø> (-0.1387%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9874% <ø> (ø)
parser ∅ <ø> (∅)
br 48.8137% <ø> (-4.2955%) ⬇️

@szpnygo
Copy link
Contributor Author

szpnygo commented Nov 17, 2023

/retest

Copy link

ti-chi-bot bot commented Nov 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, lance6716

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented Nov 17, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-11-17 04:11:26.802960154 +0000 UTC m=+4395084.390070284: ☑️ agreed by lance6716.
  • 2023-11-17 05:12:11.083843468 +0000 UTC m=+4398728.670953598: ☑️ agreed by hawkingrei.

@ti-chi-bot ti-chi-bot bot merged commit 657f0d9 into pingcap:master Nov 17, 2023
27 of 28 checks passed
@szpnygo szpnygo deleted the remove_math_rand_seed branch November 17, 2023 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files. skip-issue-check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants