Skip to content

Conversation

@guillaumemichel
Copy link
Collaborator

Based on #1146

Part of #1095


Remove lock contention in KeyStore by having a go routine managing accesses to the underneath datastore.

This adds quite some complexity :(

cc: @gammazero @hsanjuan

@guillaumemichel guillaumemichel requested a review from a team as a code owner September 10, 2025 14:11
@guillaumemichel guillaumemichel mentioned this pull request Sep 10, 2025
56 tasks
Copy link
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

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

Before I complete the review, I want to discuss the large comment I left pertaining to async behavior.

@guillaumemichel
Copy link
Collaborator Author

guillaumemichel commented Sep 11, 2025

Since the supplied datastore is considered to be thread safe, we can safely remove the mutex without running all datastore operations sequentially in a single go routine, like implemented in this PR.

EDIT: A mutex is still required in the ResettableKeyStore when swapping the datastore in use. So this PR is still relevant.

Copy link
Contributor

@hsanjuan hsanjuan left a comment

Choose a reason for hiding this comment

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

I had a general look. Looks fine as an intermediary step before removing the blocking operations I think.

@guillaumemichel guillaumemichel force-pushed the provider-accelerate-keystore branch from 74670b4 to bb7a2d4 Compare September 12, 2025 21:36
@guillaumemichel guillaumemichel force-pushed the provider-accelerate-keystore branch from bb7a2d4 to 38a707a Compare September 12, 2025 21:40
Base automatically changed from provider-ResettableKeyStore to provider September 16, 2025 14:50
@guillaumemichel guillaumemichel requested a review from a team as a code owner September 16, 2025 14:50
@guillaumemichel guillaumemichel force-pushed the provider-accelerate-keystore branch from c45a22e to bfc6664 Compare September 16, 2025 15:04
@guillaumemichel guillaumemichel merged commit db8dc82 into provider Sep 16, 2025
9 checks passed
@guillaumemichel guillaumemichel deleted the provider-accelerate-keystore branch September 16, 2025 15:12
guillaumemichel added a commit to guillaumemichel/go-libp2p-kad-dht that referenced this pull request Sep 17, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code
guillaumemichel added a commit to guillaumemichel/go-libp2p-kad-dht that referenced this pull request Sep 17, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code
guillaumemichel added a commit that referenced this pull request Sep 17, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code
guillaumemichel added a commit that referenced this pull request Sep 17, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code
guillaumemichel added a commit that referenced this pull request Sep 18, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code
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.

4 participants