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

cleanup locking, add named mutex and make cache atomically #1212

Merged
merged 8 commits into from
Jan 19, 2021

Conversation

fschade
Copy link
Contributor

@fschade fschade commented Jan 14, 2021

fixes: #966

  • remove locking from accounts service
  • add sync package with named mutex
  • add named locking to indexer
  • move cache into sync pkg
  • remove husky

add a cached named rwlock pkg
use sync.map in the cache pkg
use named rwlock in indexer pkg
use sync.map in indexer pkg
remove husky
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Some input for the changelog. Code itself looks cool. 👍
I'd love to see unit tests for ocis-pkg/indexer/map.go though 😁

changelog/unreleased/account-locking.md Outdated Show resolved Hide resolved
changelog/unreleased/account-locking.md Outdated Show resolved Hide resolved
changelog/unreleased/account-locking.md Outdated Show resolved Hide resolved
ocis-pkg/cache/cache.go Outdated Show resolved Hide resolved
ocis-pkg/sync/mutex.go Outdated Show resolved Hide resolved
ocis-pkg/sync/mutex.go Outdated Show resolved Hide resolved
ocis-pkg/sync/mutex.go Outdated Show resolved Hide resolved
ocis-pkg/sync/mutex_test.go Outdated Show resolved Hide resolved
ocis-pkg/sync/mutex.go Outdated Show resolved Hide resolved
rollback indexer map
use sync.pool for cache entries
add tests for cache
remove main locks from nrwmutex and use sync.map and sync.pool instead
bump dockerfile go version
@fschade fschade changed the title remove locking from accounts service [with-benchmarks] Remove locking from accounts service Jan 18, 2021
refactor cache to use atomic uint
@fschade fschade changed the title [with-benchmarks] Remove locking from accounts service Remove locking from accounts service Jan 18, 2021
@fschade fschade requested a review from refs January 18, 2021 18:03
Copy link
Contributor

@C0rby C0rby left a comment

Choose a reason for hiding this comment

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

Looks good to me.

ocis-pkg/sync/nrwmutex.go Outdated Show resolved Hide resolved
Copy link
Member

@refs refs left a comment

Choose a reason for hiding this comment

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

Thanks for the brainpower that went into this!

ocis-pkg/sync/nrwmutex.go Outdated Show resolved Hide resolved
@refs refs changed the title Remove locking from accounts service Remove locking from accounts service handlers Jan 19, 2021
@refs
Copy link
Member

refs commented Jan 19, 2021

took the liberty to edit the title to reduce the scope, as we're not removing locking per-se, only from the handlers.

@fschade fschade changed the title Remove locking from accounts service handlers cleanup locking, add named mutex and make cache atomically Jan 19, 2021
@fschade fschade marked this pull request as ready for review January 19, 2021 14:04
@micbar
Copy link
Contributor

micbar commented Jan 19, 2021

looks like it needs a rebase

@sonarcloud
Copy link

sonarcloud bot commented Jan 19, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@fschade fschade merged commit 873fbcb into master Jan 19, 2021
@delete-merged-branch delete-merged-branch bot deleted the account-locking branch January 19, 2021 22:23
@kulmann kulmann mentioned this pull request Jan 22, 2021
15 tasks
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.

Remove accounts service locking
5 participants