Commit 2828d7a9 authored by liuyuhang's avatar liuyuhang Committed by vipwzw

modify mpt db ValueSize to ValueLen

parent 7c747f31
...@@ -474,7 +474,7 @@ func (db *Database) Commit(node common.Hash, report bool) error { ...@@ -474,7 +474,7 @@ func (db *Database) Commit(node common.Hash, report bool) error {
// db.lock.RUnlock() // db.lock.RUnlock()
// return err // return err
//} //}
//if batch.ValueSize() > ethdb.IdealBatchSize { //if batch.ValueLen() > ethdb.IdealBatchSize {
// if err := batch.Write(); err != nil { // if err := batch.Write(); err != nil {
// return err // return err
// } // }
......
...@@ -525,7 +525,7 @@ func (db *Database) dereference(child common.Hash, parent common.Hash) { ...@@ -525,7 +525,7 @@ func (db *Database) dereference(child common.Hash, parent common.Hash) {
// // db.lock.RUnlock() // // db.lock.RUnlock()
// // return err // // return err
// //} // //}
// //if batch.ValueSize() > ethdb.IdealBatchSize { // //if batch.ValueLen() > ethdb.IdealBatchSize {
// // if err := batch.Write(); err != nil { // // if err := batch.Write(); err != nil {
// // db.lock.RUnlock() // // db.lock.RUnlock()
// // return err // // return err
...@@ -545,7 +545,7 @@ func (db *Database) dereference(child common.Hash, parent common.Hash) { ...@@ -545,7 +545,7 @@ func (db *Database) dereference(child common.Hash, parent common.Hash) {
// // return err // // return err
// //} // //}
// //// If we exceeded the ideal batch size, commit and reset // //// If we exceeded the ideal batch size, commit and reset
// //if batch.ValueSize() >= ethdb.IdealBatchSize { // //if batch.ValueLen() >= ethdb.IdealBatchSize {
// // if err := batch.Write(); err != nil { // // if err := batch.Write(); err != nil {
// // log.Error("Failed to write flush list to disk", "err", err) // // log.Error("Failed to write flush list to disk", "err", err)
// // db.lock.RUnlock() // // db.lock.RUnlock()
...@@ -625,7 +625,7 @@ func (db *Database) Commit(node common.Hash, report bool) error { ...@@ -625,7 +625,7 @@ func (db *Database) Commit(node common.Hash, report bool) error {
// db.lock.RUnlock() // db.lock.RUnlock()
// return err // return err
//} //}
//if batch.ValueSize() > ethdb.IdealBatchSize { //if batch.ValueLen() > ethdb.IdealBatchSize {
// if err := batch.Write(); err != nil { // if err := batch.Write(); err != nil {
// return err // return err
// } // }
...@@ -693,7 +693,7 @@ func (db *Database) commit(hash common.Hash, batch dbm.Batch) error { ...@@ -693,7 +693,7 @@ func (db *Database) commit(hash common.Hash, batch dbm.Batch) error {
//println(hex.EncodeToString(hash[:]), len(node.rlp())) //println(hex.EncodeToString(hash[:]), len(node.rlp()))
batch.Set(hash[:], node.rlp()) batch.Set(hash[:], node.rlp())
// If we've reached an optimal batch size, commit and start over // If we've reached an optimal batch size, commit and start over
if batch.ValueSize() >= IdealBatchSize { if batch.ValueLen() >= IdealBatchSize {
if err := batch.Write(); err != nil { if err := batch.Write(); err != nil {
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment