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

runtime: opportunistically rotate map key seed #25237

Closed
josharian opened this issue May 3, 2018 · 6 comments
Closed

runtime: opportunistically rotate map key seed #25237

josharian opened this issue May 3, 2018 · 6 comments
Assignees
Milestone

Comments

@josharian
Copy link
Contributor

@josharian josharian commented May 3, 2018

As further protection, when the size of a non-tiny map drops to zero, we should update its hash seed. This is a reminder issue.

See discussion in CL 110055.

cc @martisch @randall77

@josharian josharian added the NeedsFix label May 3, 2018
@josharian josharian added this to the Go1.12 milestone May 3, 2018
@josharian josharian self-assigned this May 3, 2018
@CAFxX
Copy link
Contributor

@CAFxX CAFxX commented May 4, 2018

Just curious: why not do the same when map growing is initiated? Is there something preventing the new/bigger map storage to use a different seed?

@randall77
Copy link
Contributor

@randall77 randall77 commented May 4, 2018

The way we grow the map, it isn't possible. Each original bucket evacuates to just two new buckets. The hashes need to agree on all the common bits.
There might be other growing algorithms where it could work.

@randall77
Copy link
Contributor

@randall77 randall77 commented Dec 28, 2018

Punting to unplanned. Pretty low priority.

@randall77 randall77 modified the milestones: Go1.12, Unplanned Dec 28, 2018
@randall77 randall77 added the Suggested label Dec 28, 2018
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 3, 2020

Change https://golang.org/cl/253020 mentions this issue: runtime: opportunistically rotate map key seed

@gopherbot gopherbot closed this in 93810ac Sep 3, 2020
@martisch
Copy link
Contributor

@martisch martisch commented Sep 4, 2020

While https://golang.org/cl/253020 resets the seed when the map clear idiom is used it doesnt reset the seed when maps are emptied to zero elements by just deleting elements without ranging over all the keys or when the pattern for map clear is not triggered. I think this is done in map clear we should also do it on deleting if an element is deleted and the maps length drops to 0.

@martisch martisch reopened this Sep 4, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 4, 2020

Change https://golang.org/cl/252940 mentions this issue: runtime: rotate map key seed when delete last element

@gopherbot gopherbot closed this in 1a119ed Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants