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
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@josharian
Copy link
Contributor

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 The path to resolution is known, but the work has not been done. 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 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

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

Punting to unplanned. Pretty low priority.

@randall77 randall77 modified the milestones: Go1.12, Unplanned Dec 28, 2018
@randall77 randall77 added the Suggested Issues that may be good for new contributors looking for work to do. label Dec 28, 2018
@gopherbot
Copy link

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

@martisch
Copy link
Contributor

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

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

@golang golang locked and limited conversation to collaborators Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

5 participants