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

fix(providers): gc #325

Merged
merged 3 commits into from
Apr 19, 2019
Merged

fix(providers): gc #325

merged 3 commits into from
Apr 19, 2019

Conversation

Stebalien
Copy link
Member

Otherwise, we'll delete everything.

Otherwise, we'll delete everything.
@ghost ghost assigned Stebalien Apr 18, 2019
@ghost ghost added the status/in-progress In progress label Apr 18, 2019
@Stebalien
Copy link
Member Author

See: ipfs/go-datastore#130

@@ -31,7 +31,7 @@ type ProviderManager struct {
// all non channel fields are meant to be accessed only within
// the run method
providers *lru.LRU
dstore ds.Datastore
dstore *autobatch.Datastore
Copy link
Contributor

Choose a reason for hiding this comment

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

are we concerned about the lack of thread-safety in the autobatching datastore?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're only using it from one thread here.

@@ -193,8 +193,7 @@ func writeProviderEntry(dstore ds.Datastore, k cid.Cid, p peer.ID, t time.Time)

func (pm *ProviderManager) gc() {
res, err := pm.dstore.Query(dsq.Query{
KeysOnly: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

ok, that's a subtle little change. What's the difference here?

Copy link
Member Author

Choose a reason for hiding this comment

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

The expiration is in the value. We had this before because we'd:

  1. Determine that all records have expired.
  2. Delete all records.

This caused us to remember a bunch of expired records indefinitely.

Copy link
Contributor

Choose a reason for hiding this comment

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

OUCH!

@Stebalien Stebalien merged commit 5b6bc7e into master Apr 19, 2019
@Stebalien Stebalien deleted the fix/gc branch April 19, 2019 16:51
@ghost ghost removed the status/in-progress In progress label Apr 19, 2019
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.

2 participants