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

Cache rebuild #124

Merged
merged 11 commits into from
May 27, 2019
Merged

Cache rebuild #124

merged 11 commits into from
May 27, 2019

Conversation

gdiazlo
Copy link
Contributor

@gdiazlo gdiazlo commented May 22, 2019

New cache recovery strategy. From ~1200 to ~7 seconds adding one write per operation.

Co-authored-by: @aalda

@gdiazlo gdiazlo requested a review from aalda May 22, 2019 16:16
@gdiazlo gdiazlo changed the title Cache recover Cache rebuild May 22, 2019
@@ -104,6 +105,7 @@ func NewRocksDBStoreOpts(opts *Options) (*RocksDBStore, error) {
cfOpts := []*rocksdb.Options{
rocksdb.NewDefaultOptions(),
getHyperTableOpts(blockCache),
getHyperTableOpts(blockCache), // hyperCacheOpts table options
Copy link
Contributor

Choose a reason for hiding this comment

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

Open an issue to optimize this options


}

func TestRebuildInterpretation(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Recover this test

)

func pruneToRebuild(index, serializedBatch []byte, cacheHeightLimit uint16, batches batchLoader) *operationsStack {
func pruneToRebuildBulk(indexes [][]byte, cacheHeightLimit uint16, batches batchLoader) *operationsStack {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename cacheHeightLimit

func NewBalloon(store storage.Store, hasherF func() hashing.Hasher) (*Balloon, error) {

// create trees
historyTree := history.NewHistoryTree(hasherF, store, 300)
hyperTree := hyper.NewHyperTree(hasherF, store, cache.NewFreeCache(hyper.CacheSize))
hasher := hasherF()
cacheHeightLimit := hasher.Len() - min(24, hasher.Len()/8*4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this

key := pos.Bytes()
val := batch.Serialize()
c.Cache.Put(key, val)
if pos.Height == c.RecoveryHeight {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider to include this in the pruner as a new mutateOp

)

func pruneToRebuild(index, serializedBatch []byte, cacheHeightLimit uint16, batches batchLoader) *operationsStack {
func pruneToRebuildBulk(indexes [][]byte, cacheHeightLimit uint16, batches batchLoader) *operationsStack {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename function name to pruneToRebuild

@aalda aalda merged commit aa0d4f9 into BBVA:master May 27, 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