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

Suffix reorg #113

Merged
merged 12 commits into from Oct 31, 2019
Merged

Suffix reorg #113

merged 12 commits into from Oct 31, 2019

Conversation

b00ris
Copy link
Contributor

@b00ris b00ris commented Oct 14, 2019

closes #97

}
buf := bytes.NewBuffer(b)
h := SuffixHistory{}
err := rlp.Decode(buf, &h)
Copy link
Contributor

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

@b00ris b00ris changed the title [WIP] Suffix reorg Suffix reorg Oct 16, 2019
@@ -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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment. Invert noHistory

Copy link
Contributor

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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rename to changeset

ethdb/table.go Show resolved Hide resolved
res, err := getStat(db)
if err != nil {
t.Fatal(err)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same for reorg

Copy link
Contributor Author

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{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

add comments for test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@b00ris b00ris merged commit c1df4dc into master Oct 31, 2019
mandrigin pushed a commit that referenced this pull request Nov 4, 2019
@AlexeyAkhunov AlexeyAkhunov deleted the suffix_reorg branch April 4, 2020 09:48
cffls pushed a commit to cffls/erigon that referenced this pull request Feb 14, 2024
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.

Check and fix reorg
3 participants