Commit 0feef75c authored by liuyuhang's avatar liuyuhang Committed by vipwzw

del kvmvcc roll back limit

parent c2820b66
......@@ -16,7 +16,6 @@ import (
)
var klog = log.New("module", "kvmvccdb")
var maxRollbackNum = 200
// SetLogLevel set log level
func SetLogLevel(level string) {
......@@ -272,11 +271,6 @@ func (mvccs *KVMVCCStore) checkVersion(height int64) ([]*types.KeyValue, error)
kvset = append(kvset, kvlist...)
klog.Debug("store kvmvcc checkVersion DelMVCC4Height", "height", i, "maxVersion", maxVersion)
//为避免高度差过大时出现异常,做一个保护,一次最多回滚200个区块
count++
if count >= maxRollbackNum {
break
}
}
}
......
......@@ -15,6 +15,7 @@ import (
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/types"
"github.com/golang/protobuf/proto"
"time"
)
const (
......@@ -26,7 +27,6 @@ const (
)
var (
maxRollbackNum = 200
// 是否开启裁剪
enablePrune bool
// 每个10000裁剪一次
......@@ -294,7 +294,6 @@ func (mvccs *KVMVCCStore) checkVersion(height int64) ([]*types.KeyValue, error)
} else if maxVersion == height-1 {
return nil, nil
} else {
count := 1
for i := maxVersion; i >= height; i-- {
hash, err := mvccs.mvcc.GetVersionHash(i)
if err != nil {
......@@ -309,11 +308,6 @@ func (mvccs *KVMVCCStore) checkVersion(height int64) ([]*types.KeyValue, error)
kvset = append(kvset, kvlist...)
kmlog.Debug("store kvmvcc checkVersion DelMVCC4Height", "height", i, "maxVersion", maxVersion)
//为避免高度差过大时出现异常,做一个保护,一次最多回滚200个区块
count++
if count >= maxRollbackNum {
break
}
}
}
......@@ -345,7 +339,10 @@ func pruning(db dbm.DB, height int64) {
func pruningMVCC(db dbm.DB, height int64) {
setPruning(pruningStateStart)
defer setPruning(pruningStateEnd)
start := time.Now()
pruningFirst(db, height)
end := time.Now()
kmlog.Debug("pruningMVCC", "height", height, "cost", end.Sub(start))
}
func pruningFirst(db dbm.DB, curHeight int64) {
......
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