Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Conversation

@mhmxs
Copy link
Contributor

@mhmxs mhmxs commented Apr 5, 2022

In some cases after we patched volume object via CreateOrPatch it loads status from Kubernetes back, so next status update does nothung. To avoid this situation the new way applies status changes after CreateOrPatch so we always persist the latest state.

Meanwhile i was not happy to keep entire json objects in memory as volume hash, so i implemented a proper hash function.

@mhmxs mhmxs force-pushed the fix-volume-status-update branch from 3f5e475 to 38b8112 Compare April 5, 2022 16:34
@cannischan cannischan requested a review from angelos-p April 5, 2022 17:13
}

hash := []byte{}
for _, s := range [][]byte{[]byte(stosVol.Id), []byte(stosVol.CreatedAt.String()), raw} {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the benefit of hashing the id, the createdAt and the entire raw json string?

Doesn't the entire json string contain the id and createdAt anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is we convert undefined number of any characters to ~19 digits. Because the output is slimmer than the input, we have some chance for collision. So this should power the output space and drastically decreases chance of collision.

@Mojachieee Mojachieee self-requested a review April 6, 2022 09:55
@mhmxs mhmxs merged commit e8056a9 into master Apr 6, 2022
@mhmxs mhmxs deleted the fix-volume-status-update branch April 6, 2022 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants