Skip to content

blockstore: extract ARC cache from Bloom cache - #3026

Merged
whyrusleeping merged 3 commits into
masterfrom
feature/blockstore-separation
Aug 3, 2016
Merged

whyrusleeping merged 3 commits into
masterfrom
feature/blockstore-separation

Conversation

@Kubuxu

@Kubuxu Kubuxu commented Aug 2, 2016

Copy link
Copy Markdown
Member

it removes race condition that would happen during various calls

If tests are ok, it is good for review.

License: MIT
Signed-off-by: Jakub Sztandera kubuxu@protonmail.ch

it removes race condition that would happen during various calls

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Comment thread blocks/blockstore/arc_cache.go Outdated
}
}
err := b.blockstore.PutMany(bs)
if err == nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i'd reverse the logic here to be more conventional:

if err != nil {
  return err
}

for ....

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure, it was refactored out so there was more logic in here.

@Kubuxu
Kubuxu force-pushed the feature/blockstore-separation branch from dd49a4e to a50495d Compare August 2, 2016 10:42
@whyrusleeping

Copy link
Copy Markdown
Member

@Kubuxu theres a lot of failing tests here...

}
cachedbs.Put(b)

cd.Lock()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

whats with locking here? you dont need to lock around a variable instantiation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah why is this lock here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The race detector was giving me an error otherwise for some reason, I can tinker with it more to find out the exact reason.

Maybe line 47 should be locked instead.

@whyrusleeping

Copy link
Copy Markdown
Member

what was the actual race condition here that youre fixing?

@Kubuxu

Kubuxu commented Aug 2, 2016

Copy link
Copy Markdown
Member Author

The race was happening when tests for ARC was running and the bloom cache finished initializing.

The test failures you see here are because the gateways were down.

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
@Kubuxu
Kubuxu force-pushed the feature/blockstore-separation branch from a50495d to 9543ed6 Compare August 2, 2016 14:03
Comment thread blocks/blockstore/arc_cache.go Outdated
h, ok := b.arc.Get(k)
if ok {
return h.(bool), ok
} else {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

drop the else

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, it is artefact from the refactor too

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
@whyrusleeping

Copy link
Copy Markdown
Member

Alright, LGTM. waiting on tests to pass now

@Kubuxu

Kubuxu commented Aug 3, 2016

Copy link
Copy Markdown
Member Author

All green.

@whyrusleeping
whyrusleeping merged commit 8405b56 into master Aug 3, 2016
@whyrusleeping
whyrusleeping deleted the feature/blockstore-separation branch August 3, 2016 12:17
@Kubuxu

Kubuxu commented Aug 3, 2016

Copy link
Copy Markdown
Member Author

Also the race in question: https://gist.github.com/Kubuxu/575f39058618a3fd5fd3efa518c65c1e

blockstore Blockstore
}

func arcCached(bs Blockstore, lruSize int) (*arccache, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • newArcCacheDS

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