Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
10044b04
Commit
10044b04
authored
Jun 27, 2019
by
heyubin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into issues-enable-levelfee
parents
2e8f5850
5c62f0d9
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
72 deletions
+89
-72
kvmvccdb.go
plugin/store/kvmvcc/kvmvccdb.go
+1
-4
kvmvcc_mavl.go
plugin/store/kvmvccmavl/kvmvcc_mavl.go
+53
-23
kvmvcc_mavl_test.go
plugin/store/kvmvccmavl/kvmvcc_mavl_test.go
+12
-5
kvmvccdb.go
plugin/store/kvmvccmavl/kvmvccdb.go
+4
-7
restore.go
vendor/github.com/33cn/chain33/blockchain/restore.go
+2
-4
db.go
vendor/github.com/33cn/chain33/common/db/db.go
+8
-0
prune.go
vendor/github.com/33cn/chain33/system/store/mavl/db/prune.go
+6
-21
tree.go
vendor/github.com/33cn/chain33/system/store/mavl/db/tree.go
+3
-8
No files found.
plugin/store/kvmvcc/kvmvccdb.go
View file @
10044b04
...
@@ -229,10 +229,7 @@ func (mvccs *KVMVCCStore) saveKVSets(kvset []*types.KeyValue, sync bool) {
...
@@ -229,10 +229,7 @@ func (mvccs *KVMVCCStore) saveKVSets(kvset []*types.KeyValue, sync bool) {
storeBatch
.
Set
(
kvset
[
i
]
.
Key
,
kvset
[
i
]
.
Value
)
storeBatch
.
Set
(
kvset
[
i
]
.
Key
,
kvset
[
i
]
.
Value
)
}
}
}
}
err
:=
storeBatch
.
Write
()
dbm
.
MustWrite
(
storeBatch
)
if
err
!=
nil
{
klog
.
Error
(
"store kvmvcc saveKVSets to db failed"
)
}
}
}
func
(
mvccs
*
KVMVCCStore
)
checkVersion
(
height
int64
)
([]
*
types
.
KeyValue
,
error
)
{
func
(
mvccs
*
KVMVCCStore
)
checkVersion
(
height
int64
)
([]
*
types
.
KeyValue
,
error
)
{
...
...
plugin/store/kvmvccmavl/kvmvcc_mavl.go
View file @
10044b04
...
@@ -356,33 +356,49 @@ func DelMavl(db dbm.DB) {
...
@@ -356,33 +356,49 @@ func DelMavl(db dbm.DB) {
defer
wg
.
Done
()
defer
wg
.
Done
()
setDelMavl
(
delMavlStateStart
)
setDelMavl
(
delMavlStateStart
)
defer
setDelMavl
(
delMavlStateEnd
)
defer
setDelMavl
(
delMavlStateEnd
)
isDel
:=
delMavlData
(
db
)
prefix
:=
""
if
isDel
{
for
{
isDelMavlData
=
true
kmlog
.
Debug
(
"start once del mavl"
)
kmlog
.
Info
(
"DelMavl success"
)
var
loop
bool
loop
,
prefix
=
delMavlData
(
db
,
prefix
)
if
!
loop
{
break
}
kmlog
.
Debug
(
"end once del mavl"
)
time
.
Sleep
(
time
.
Second
*
1
)
}
}
}
}
func
delMavlData
(
db
dbm
.
DB
)
bool
{
func
delMavlData
(
db
dbm
.
DB
,
prefix
string
)
(
bool
,
string
)
{
it
:=
db
.
Iterator
(
nil
,
nil
,
tru
e
)
it
:=
db
.
Iterator
(
[]
byte
(
prefix
),
types
.
EmptyValue
,
fals
e
)
defer
it
.
Close
()
defer
it
.
Close
()
batch
:=
db
.
NewBatch
(
true
)
batch
:=
db
.
NewBatch
(
false
)
count
:=
0
const
onceCount
=
50
for
it
.
Rewind
();
it
.
Valid
();
it
.
Next
()
{
for
it
.
Rewind
();
it
.
Valid
();
it
.
Next
()
{
if
quit
{
if
quit
{
return
false
return
false
,
""
}
}
if
!
bytes
.
HasPrefix
(
it
.
Key
(),
mvccPrefix
)
{
// 将非mvcc的mavl数据全部删除
if
!
bytes
.
HasPrefix
(
it
.
Key
(),
mvccPrefix
)
{
// 将非mvcc的mavl数据全部删除
batch
.
Delete
(
it
.
Key
())
batch
.
Delete
(
it
.
Key
())
if
batch
.
ValueSize
()
>
batchDataSize
{
if
batch
.
ValueSize
()
>
batchDataSize
{
batch
.
Write
(
)
dbm
.
MustWrite
(
batch
)
batch
.
Reset
()
batch
.
Reset
()
time
.
Sleep
(
time
.
Millisecond
*
100
)
count
++
}
}
}
}
if
count
>
onceCount
{
if
it
.
Next
()
{
return
true
,
string
(
it
.
Key
())
}
return
true
,
""
}
}
}
batch
.
Set
(
genDelMavlKey
(
mvccPrefix
),
[]
byte
(
""
))
batch
.
Set
(
genDelMavlKey
(
mvccPrefix
),
[]
byte
(
""
))
batch
.
Write
()
dbm
.
MustWrite
(
batch
)
return
true
isDelMavlData
=
true
kmlog
.
Info
(
"DelMavl success"
)
return
false
,
""
}
}
func
genDelMavlKey
(
prefix
[]
byte
)
[]
byte
{
func
genDelMavlKey
(
prefix
[]
byte
)
[]
byte
{
...
@@ -423,29 +439,43 @@ func deletePrunedMavl(db dbm.DB) {
...
@@ -423,29 +439,43 @@ func deletePrunedMavl(db dbm.DB) {
defer
wg
.
Done
()
defer
wg
.
Done
()
setDelPrunedMavl
(
delPrunedMavlStarting
)
setDelPrunedMavl
(
delPrunedMavlStarting
)
defer
setDelPrunedMavl
(
delPruneMavlEnd
)
defer
setDelPrunedMavl
(
delPruneMavlEnd
)
prefixS
:=
[]
string
{
hashNodePrefix
,
leafNodePrefix
,
leafKeyCountPrefix
,
oldLeafKeyCountPrefix
}
deletePrunedMavlData
(
db
,
hashNodePrefix
)
for
_
,
str
:=
range
prefixS
{
deletePrunedMavlData
(
db
,
leafNodePrefix
)
for
{
deletePrunedMavlData
(
db
,
leafKeyCountPrefix
)
stat
:=
deletePrunedMavlData
(
db
,
str
)
deletePrunedMavlData
(
db
,
oldLeafKeyCountPrefix
)
if
stat
==
0
{
return
}
else
if
stat
==
1
{
break
}
else
{
time
.
Sleep
(
time
.
Millisecond
*
100
)
}
}
}
}
}
func
deletePrunedMavlData
(
db
dbm
.
DB
,
prefix
string
)
{
func
deletePrunedMavlData
(
db
dbm
.
DB
,
prefix
string
)
(
status
int
)
{
it
:=
db
.
Iterator
([]
byte
(
prefix
),
nil
,
tru
e
)
it
:=
db
.
Iterator
([]
byte
(
prefix
),
nil
,
fals
e
)
defer
it
.
Close
()
defer
it
.
Close
()
count
:=
0
const
onceCount
=
200
if
it
.
Rewind
()
&&
it
.
Valid
()
{
if
it
.
Rewind
()
&&
it
.
Valid
()
{
batch
:=
db
.
NewBatch
(
false
)
batch
:=
db
.
NewBatch
(
false
)
for
it
.
Next
();
it
.
Valid
();
it
.
Next
()
{
//第一个不做删除
for
it
.
Next
();
it
.
Valid
();
it
.
Next
()
{
//第一个不做删除
if
quit
{
if
quit
{
return
return
0
// quit
}
}
batch
.
Delete
(
it
.
Key
())
batch
.
Delete
(
it
.
Key
())
if
batch
.
ValueSize
()
>
batchDataSize
{
if
batch
.
ValueSize
()
>
batchDataSize
{
batch
.
Write
(
)
dbm
.
MustWrite
(
batch
)
batch
.
Reset
()
batch
.
Reset
()
time
.
Sleep
(
time
.
Millisecond
*
100
)
count
++
}
if
count
>
onceCount
{
return
2
//loop
}
}
}
}
batch
.
Write
(
)
dbm
.
MustWrite
(
batch
)
}
}
return
1
// this prefix Iterator over
}
}
plugin/store/kvmvccmavl/kvmvcc_mavl_test.go
View file @
10044b04
...
@@ -573,7 +573,14 @@ func TestDelMavlData(t *testing.T) {
...
@@ -573,7 +573,14 @@ func TestDelMavlData(t *testing.T) {
db
.
Set
([]
byte
(
"key22"
),
[]
byte
(
"value22"
))
db
.
Set
([]
byte
(
"key22"
),
[]
byte
(
"value22"
))
quit
=
false
quit
=
false
delMavlData
(
db
)
prefix
:=
""
for
{
var
loop
bool
loop
,
prefix
=
delMavlData
(
db
,
prefix
)
if
!
loop
{
break
}
}
v
,
err
:=
db
.
Get
([]
byte
(
mvccPrefix
))
v
,
err
:=
db
.
Get
([]
byte
(
mvccPrefix
))
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
...
@@ -748,15 +755,15 @@ func TestDeletePrunedMavl(t *testing.T) {
...
@@ -748,15 +755,15 @@ func TestDeletePrunedMavl(t *testing.T) {
require
.
Equal
(
t
,
v1
,
[]
byte
(
"v1"
))
require
.
Equal
(
t
,
v1
,
[]
byte
(
"v1"
))
//测试再加入一条数据,即两条时候
//测试再加入一条数据,即两条时候
store
.
GetDB
()
.
Set
([]
byte
(
fmt
.
Sprintln
(
hashNodePrefix
,
"
456"
)),
[]
byte
(
"v2
"
))
store
.
GetDB
()
.
Set
([]
byte
(
fmt
.
Sprintln
(
hashNodePrefix
,
"
123"
)),
[]
byte
(
"v1
"
))
deletePrunedMavlData
(
store
.
GetDB
(),
hashNodePrefix
)
deletePrunedMavlData
(
store
.
GetDB
(),
hashNodePrefix
)
v1
,
err
=
store
.
GetDB
()
.
Get
([]
byte
(
fmt
.
Sprintln
(
hashNodePrefix
,
"
123
"
)))
v1
,
err
=
store
.
GetDB
()
.
Get
([]
byte
(
fmt
.
Sprintln
(
hashNodePrefix
,
"
456
"
)))
require
.
Error
(
t
,
err
)
require
.
Error
(
t
,
err
)
require
.
Equal
(
t
,
v1
,
[]
uint8
([]
byte
(
nil
)))
require
.
Equal
(
t
,
v1
,
[]
uint8
([]
byte
(
nil
)))
v2
,
err
:=
store
.
GetDB
()
.
Get
([]
byte
(
fmt
.
Sprintln
(
hashNodePrefix
,
"
456
"
)))
v2
,
err
:=
store
.
GetDB
()
.
Get
([]
byte
(
fmt
.
Sprintln
(
hashNodePrefix
,
"
123
"
)))
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
v2
,
[]
byte
(
"v
2
"
))
require
.
Equal
(
t
,
v2
,
[]
byte
(
"v
1
"
))
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
deletePrunedMavl
(
store
.
GetDB
())
go
deletePrunedMavl
(
store
.
GetDB
())
...
...
plugin/store/kvmvccmavl/kvmvccdb.go
View file @
10044b04
...
@@ -184,7 +184,7 @@ func (mvccs *KVMVCCStore) CommitUpgrade(req *types.ReqHash) ([]byte, error) {
...
@@ -184,7 +184,7 @@ func (mvccs *KVMVCCStore) CommitUpgrade(req *types.ReqHash) ([]byte, error) {
batch
.
Set
(
kvset
[
i
]
.
Key
,
kvset
[
i
]
.
Value
)
batch
.
Set
(
kvset
[
i
]
.
Key
,
kvset
[
i
]
.
Value
)
}
}
}
}
batch
.
Write
(
)
dbm
.
MustWrite
(
batch
)
delete
(
mvccs
.
kvsetmap
,
string
(
req
.
Hash
))
delete
(
mvccs
.
kvsetmap
,
string
(
req
.
Hash
))
return
req
.
Hash
,
nil
return
req
.
Hash
,
nil
}
}
...
@@ -263,10 +263,7 @@ func (mvccs *KVMVCCStore) saveKVSets(kvset []*types.KeyValue, sync bool) {
...
@@ -263,10 +263,7 @@ func (mvccs *KVMVCCStore) saveKVSets(kvset []*types.KeyValue, sync bool) {
storeBatch
.
Set
(
kvset
[
i
]
.
Key
,
kvset
[
i
]
.
Value
)
storeBatch
.
Set
(
kvset
[
i
]
.
Key
,
kvset
[
i
]
.
Value
)
}
}
}
}
err
:=
storeBatch
.
Write
()
dbm
.
MustWrite
(
storeBatch
)
if
err
!=
nil
{
kmlog
.
Info
(
"KVMVCCStore saveKVSets"
,
"Write error"
,
err
)
}
}
}
// GetMaxVersion 获取当前最大高度
// GetMaxVersion 获取当前最大高度
...
@@ -396,7 +393,7 @@ func deleteOldKV(mp map[string][]int64, curHeight int64, batch dbm.Batch) {
...
@@ -396,7 +393,7 @@ func deleteOldKV(mp map[string][]int64, curHeight int64, batch dbm.Batch) {
if
curHeight
>=
val
+
int64
(
pruneHeight
)
{
if
curHeight
>=
val
+
int64
(
pruneHeight
)
{
batch
.
Delete
(
genKeyVersion
([]
byte
(
key
),
val
))
// 删除老版本key
batch
.
Delete
(
genKeyVersion
([]
byte
(
key
),
val
))
// 删除老版本key
if
batch
.
ValueSize
()
>
batchDataSize
{
if
batch
.
ValueSize
()
>
batchDataSize
{
batch
.
Write
(
)
dbm
.
MustWrite
(
batch
)
batch
.
Reset
()
batch
.
Reset
()
}
}
}
}
...
@@ -404,7 +401,7 @@ func deleteOldKV(mp map[string][]int64, curHeight int64, batch dbm.Batch) {
...
@@ -404,7 +401,7 @@ func deleteOldKV(mp map[string][]int64, curHeight int64, batch dbm.Batch) {
}
}
delete
(
mp
,
key
)
delete
(
mp
,
key
)
}
}
batch
.
Write
(
)
dbm
.
MustWrite
(
batch
)
}
}
func
genKeyVersion
(
key
[]
byte
,
height
int64
)
[]
byte
{
func
genKeyVersion
(
key
[]
byte
,
height
int64
)
[]
byte
{
...
...
vendor/github.com/33cn/chain33/blockchain/restore.go
View file @
10044b04
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"github.com/33cn/chain33/common/version"
"github.com/33cn/chain33/common/version"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
dbm
"github.com/33cn/chain33/common/db"
)
)
// Upgrade 升级localDB和storeDB
// Upgrade 升级localDB和storeDB
...
@@ -82,10 +83,7 @@ func (chain *BlockChain) ReExecBlock(startHeight, curHeight int64) {
...
@@ -82,10 +83,7 @@ func (chain *BlockChain) ReExecBlock(startHeight, curHeight int64) {
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"execBlockEx connectBlock readd Txs fail height=%d err=%s, this not allow fail"
,
i
,
err
.
Error
()))
panic
(
fmt
.
Sprintf
(
"execBlockEx connectBlock readd Txs fail height=%d err=%s, this not allow fail"
,
i
,
err
.
Error
()))
}
}
err
=
newbatch
.
Write
()
dbm
.
MustWrite
(
newbatch
)
if
err
!=
nil
{
panic
(
err
)
}
}
}
prevStateHash
=
block
.
StateHash
prevStateHash
=
block
.
StateHash
...
...
vendor/github.com/33cn/chain33/common/db/db.go
View file @
10044b04
...
@@ -96,6 +96,14 @@ type Batch interface {
...
@@ -96,6 +96,14 @@ type Batch interface {
Reset
()
// Reset resets the batch for reuse
Reset
()
// Reset resets the batch for reuse
}
}
// MustWrite must write correct
func
MustWrite
(
batch
Batch
)
{
err
:=
batch
.
Write
()
if
err
!=
nil
{
panic
(
fmt
.
Sprint
(
"batch write err"
,
err
))
}
}
//IteratorSeeker ...
//IteratorSeeker ...
type
IteratorSeeker
interface
{
type
IteratorSeeker
interface
{
Rewind
()
bool
Rewind
()
bool
...
...
vendor/github.com/33cn/chain33/system/store/mavl/db/prune.go
View file @
10044b04
...
@@ -256,28 +256,22 @@ func pruningFirstLevelNode(db dbm.DB, curHeight int64) {
...
@@ -256,28 +256,22 @@ func pruningFirstLevelNode(db dbm.DB, curHeight int64) {
}
}
func
addLeafCountKeyToSecondLevel
(
db
dbm
.
DB
,
kvs
[]
*
types
.
KeyValue
,
batch
dbm
.
Batch
)
{
func
addLeafCountKeyToSecondLevel
(
db
dbm
.
DB
,
kvs
[]
*
types
.
KeyValue
,
batch
dbm
.
Batch
)
{
var
err
error
batch
.
Reset
()
batch
.
Reset
()
for
_
,
kv
:=
range
kvs
{
for
_
,
kv
:=
range
kvs
{
batch
.
Delete
(
kv
.
Key
)
batch
.
Delete
(
kv
.
Key
)
batch
.
Set
(
genOldLeafCountKeyFromKey
(
kv
.
Key
),
kv
.
Value
)
batch
.
Set
(
genOldLeafCountKeyFromKey
(
kv
.
Key
),
kv
.
Value
)
if
batch
.
ValueSize
()
>
batchDataSize
{
if
batch
.
ValueSize
()
>
batchDataSize
{
if
err
=
batch
.
Write
();
err
!=
nil
{
dbm
.
MustWrite
(
batch
)
return
}
batch
.
Reset
()
batch
.
Reset
()
}
}
}
}
if
err
=
batch
.
Write
();
err
!=
nil
{
dbm
.
MustWrite
(
batch
)
return
}
}
}
func
deleteNode
(
db
dbm
.
DB
,
mp
map
[
string
][]
hashData
,
curHeight
int64
,
batch
dbm
.
Batch
)
{
func
deleteNode
(
db
dbm
.
DB
,
mp
map
[
string
][]
hashData
,
curHeight
int64
,
batch
dbm
.
Batch
)
{
if
len
(
mp
)
==
0
{
if
len
(
mp
)
==
0
{
return
return
}
}
var
err
error
batch
.
Reset
()
batch
.
Reset
()
for
key
,
vals
:=
range
mp
{
for
key
,
vals
:=
range
mp
{
if
len
(
vals
)
>
1
&&
vals
[
1
]
.
height
!=
vals
[
0
]
.
height
{
//防止相同高度时候出现的误删除
if
len
(
vals
)
>
1
&&
vals
[
1
]
.
height
!=
vals
[
0
]
.
height
{
//防止相同高度时候出现的误删除
...
@@ -297,9 +291,7 @@ func deleteNode(db dbm.DB, mp map[string][]hashData, curHeight int64, batch dbm.
...
@@ -297,9 +291,7 @@ func deleteNode(db dbm.DB, mp map[string][]hashData, curHeight int64, batch dbm.
batch
.
Delete
(
leafCountKey
)
// 叶子计数节点
batch
.
Delete
(
leafCountKey
)
// 叶子计数节点
batch
.
Delete
(
val
.
hash
)
// 叶子节点hash值
batch
.
Delete
(
val
.
hash
)
// 叶子节点hash值
if
batch
.
ValueSize
()
>
batchDataSize
{
if
batch
.
ValueSize
()
>
batchDataSize
{
if
err
=
batch
.
Write
();
err
!=
nil
{
dbm
.
MustWrite
(
batch
)
return
}
batch
.
Reset
()
batch
.
Reset
()
}
}
}
}
...
@@ -307,9 +299,7 @@ func deleteNode(db dbm.DB, mp map[string][]hashData, curHeight int64, batch dbm.
...
@@ -307,9 +299,7 @@ func deleteNode(db dbm.DB, mp map[string][]hashData, curHeight int64, batch dbm.
}
}
delete
(
mp
,
key
)
delete
(
mp
,
key
)
}
}
if
err
=
batch
.
Write
();
err
!=
nil
{
dbm
.
MustWrite
(
batch
)
return
}
}
}
func
pruningSecondLevel
(
db
dbm
.
DB
,
curHeight
int64
)
{
func
pruningSecondLevel
(
db
dbm
.
DB
,
curHeight
int64
)
{
...
@@ -376,7 +366,6 @@ func deleteOldNode(db dbm.DB, mp map[string][]hashData, curHeight int64, batch d
...
@@ -376,7 +366,6 @@ func deleteOldNode(db dbm.DB, mp map[string][]hashData, curHeight int64, batch d
if
len
(
mp
)
==
0
{
if
len
(
mp
)
==
0
{
return
return
}
}
var
err
error
batch
.
Reset
()
batch
.
Reset
()
for
key
,
vals
:=
range
mp
{
for
key
,
vals
:=
range
mp
{
if
len
(
vals
)
>
1
{
if
len
(
vals
)
>
1
{
...
@@ -411,15 +400,11 @@ func deleteOldNode(db dbm.DB, mp map[string][]hashData, curHeight int64, batch d
...
@@ -411,15 +400,11 @@ func deleteOldNode(db dbm.DB, mp map[string][]hashData, curHeight int64, batch d
}
}
delete
(
mp
,
key
)
delete
(
mp
,
key
)
if
batch
.
ValueSize
()
>
batchDataSize
{
if
batch
.
ValueSize
()
>
batchDataSize
{
if
err
=
batch
.
Write
();
err
!=
nil
{
dbm
.
MustWrite
(
batch
)
return
}
batch
.
Reset
()
batch
.
Reset
()
}
}
}
}
if
err
=
batch
.
Write
();
err
!=
nil
{
dbm
.
MustWrite
(
batch
)
return
}
}
}
// PruningTreePrintDB pruning tree print db
// PruningTreePrintDB pruning tree print db
...
...
vendor/github.com/33cn/chain33/system/store/mavl/db/tree.go
View file @
10044b04
...
@@ -404,9 +404,7 @@ func (t *Tree) RemoveLeafCountKey(height int64) {
...
@@ -404,9 +404,7 @@ func (t *Tree) RemoveLeafCountKey(height int64) {
treelog
.
Debug
(
"RemoveLeafCountKey:"
,
"height"
,
height
,
"key:"
,
string
(
k
),
"hash:"
,
common
.
ToHex
(
hash
))
treelog
.
Debug
(
"RemoveLeafCountKey:"
,
"height"
,
height
,
"key:"
,
string
(
k
),
"hash:"
,
common
.
ToHex
(
hash
))
}
}
}
}
if
err
:=
batch
.
Write
();
err
!=
nil
{
dbm
.
MustWrite
(
batch
)
return
}
}
}
// Iterate 依次迭代遍历树的所有键
// Iterate 依次迭代遍历树的所有键
...
@@ -711,14 +709,11 @@ func (ndb *nodeDB) Commit() error {
...
@@ -711,14 +709,11 @@ func (ndb *nodeDB) Commit() error {
defer
ndb
.
mtx
.
Unlock
()
defer
ndb
.
mtx
.
Unlock
()
// Write saves
// Write saves
err
:=
ndb
.
batch
.
Write
()
dbm
.
MustWrite
(
ndb
.
batch
)
if
err
!=
nil
{
treelog
.
Error
(
"Commit batch.Write err"
,
"err"
,
err
)
}
ndb
.
batch
=
nil
ndb
.
batch
=
nil
ndb
.
orphans
=
make
(
map
[
string
]
struct
{})
ndb
.
orphans
=
make
(
map
[
string
]
struct
{})
return
err
return
nil
}
}
// SetKVPair 设置kv对外接口
// SetKVPair 设置kv对外接口
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment