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
Suffix reorg #113
Suffix reorg #113
Conversation
common/dbutils/suffix_type.go
Outdated
} | ||
buf := bytes.NewBuffer(b) | ||
h := SuffixHistory{} | ||
err := rlp.Decode(buf, &h) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to use rlp
package, if possible. It is very inefficient both in terms of allocations and cpu usage. That is why I used hand-written encoding before
ethdb/database.go
Outdated
@@ -86,26 +86,40 @@ func (db *BoltDatabase) Put(bucket, key []byte, value []byte) error { | |||
} | |||
|
|||
// Put puts the given key / value to the queue | |||
func (db *BoltDatabase) PutS(hBucket, key, value []byte, timestamp uint64) error { | |||
func (db *BoltDatabase) PutS(hBucket, key, value []byte, timestamp uint64, noHistory bool) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment. Invert noHistory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can defer this change to: #119
//fmt.Printf("PutS bucket %x key %x value %x timestamp %d\n", bucket, key, value, timestamp) | ||
composite, _ := dbutils.CompositeKeySuffix(key, timestamp) | ||
suffixM, ok := m.suffixkeys[timestamp] | ||
if !ok { | ||
suffixM = make(map[string][][]byte) | ||
suffixM = make(map[string][]dbutils.Change) | ||
m.suffixkeys[timestamp] = suffixM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to changeset
res, err := getStat(db) | ||
if err != nil { | ||
t.Fatal(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for reorg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separated PR
ErrAccountsInHistory: 0, | ||
ErrDecodedAccountsInHistory: 0, | ||
NumOfChangesInAccountsHistory: 0, | ||
AccountSuffixRecordsByTimestamp: map[uint64]uint32{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comments for test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
closes #97