mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
mvcc: check null before set FillPercent not to panic
Since CreateBucketIfNotExists() can return nil when it gets an error, accessing FillPercent must be done after a nil check, not to cause a panic.
This commit is contained in:
parent
df4036ab73
commit
6999bbb47b
@ -370,10 +370,10 @@ func defragdb(odb, tmpdb *bolt.DB, limit int) error {
|
||||
}
|
||||
|
||||
tmpb, berr := tmptx.CreateBucketIfNotExists(next)
|
||||
tmpb.FillPercent = 0.9 // for seq write in for each
|
||||
if berr != nil {
|
||||
return berr
|
||||
}
|
||||
tmpb.FillPercent = 0.9 // for seq write in for each
|
||||
|
||||
b.ForEach(func(k, v []byte) error {
|
||||
count++
|
||||
|
Loading…
x
Reference in New Issue
Block a user