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

Flushing Memtree #6

Merged
merged 37 commits into from
Jul 2, 2019
Merged

Flushing Memtree #6

merged 37 commits into from
Jul 2, 2019

Conversation

Sriep
Copy link

@Sriep Sriep commented Jun 24, 2019

Allows using two DBS for storing data.

@mattkanwisher mattkanwisher changed the title Hack1 Flushing Memtree Jul 2, 2019
mutable_tree.go Outdated
@@ -16,6 +16,7 @@ type MutableTree struct {
*ImmutableTree // The current, working tree.
lastSaved *ImmutableTree // The most recently saved tree.
orphans map[string]int64 // Nodes removed by changes to working tree.
memversions map[int64]bool // The previous, saved versions of the tree in mem.
Copy link

Choose a reason for hiding this comment

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

memversions -> memVersions

mutable_tree.go Outdated
@@ -364,11 +366,44 @@ func (tree *MutableTree) GetVersioned(key []byte, version int64) (
return -1, nil
}

var nextTimeClear = false
Copy link

Choose a reason for hiding this comment

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

Doesn't seem to do anything

mutable_tree.go Outdated
version := tree.version + 1

if flushToDisk == true {
Copy link

Choose a reason for hiding this comment

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

-> if flushToDisk {

mutable_tree.go Outdated
}

func (tree *MutableTree) DeleteVersionFull(version int64, memDeleteAlso bool) error {
if tree.memversions[version] == true {
Copy link

Choose a reason for hiding this comment

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

-> if tree.memversions[version]

mutable_tree.go Outdated
func (tree *MutableTree) DeleteVersionFull(version int64, memDeleteAlso bool) error {
if tree.memversions[version] == true {
//sometimes you dont want to bother deleting versions in memory
if memDeleteAlso == false {
Copy link

Choose a reason for hiding this comment

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

-> if !memDeleteAlso

nodedb.go Outdated
ndb.mtx.Lock()
defer ndb.mtx.Unlock()

if node.hash == nil {
panic("Expected to find node.hash, but none found.")
}
if node.persistedMem == true && flushToDisk == false {
Copy link

Choose a reason for hiding this comment

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

-> if node.persistedMem && !flushToDisk

nodedb.go Outdated

node.persisted = true
ndb.cacheNode(node)
if flushToDisk == true {
Copy link

Choose a reason for hiding this comment

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

-> if flushToDisk {

nodedb.go Outdated
if node.persisted {
return node.hash
}
if node.persistedMem && flushToDisk == false {
Copy link

Choose a reason for hiding this comment

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

-> if node.persistedMem && !flushToDisk

nodedb.go Outdated

node.leftNode = nil
node.rightNode = nil
if flushToDisk == true {
Copy link

Choose a reason for hiding this comment

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

-> if flushToDisk {

nodedb.go Outdated
return ndb.getPreviousVersioni(version, ndb.db)
}

func (ndb *nodeDB) getPreviousVersioni(version int64, db dbm.DB) int64 {
Copy link

Choose a reason for hiding this comment

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

getPreviousVersioni -> getPreviousVersionFromDB

@mattkanwisher mattkanwisher merged commit 874bcf8 into master Jul 2, 2019
@mattkanwisher mattkanwisher deleted the hack1 branch July 2, 2019 09:10
@mattkanwisher mattkanwisher restored the hack1 branch July 2, 2019 09:12
@Sriep Sriep deleted the hack1 branch July 30, 2019 15:04
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