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
e5a109f0
Commit
e5a109f0
authored
Mar 05, 2019
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
afa2401a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
main.go
main.go
+3
-2
kvmvcc_mavl.go
plugin/store/kvmvccmavl/kvmvcc_mavl.go
+0
-0
kvmvccdb.go
plugin/store/kvmvccmavl/kvmvccdb.go
+9
-9
No files found.
main.go
View file @
e5a109f0
...
@@ -12,11 +12,12 @@
...
@@ -12,11 +12,12 @@
package
main
package
main
import
(
import
(
"net/http"
"runtime/debug"
_
"github.com/33cn/chain33/system"
_
"github.com/33cn/chain33/system"
"github.com/33cn/chain33/util/cli"
"github.com/33cn/chain33/util/cli"
_
"github.com/33cn/plugin/plugin"
_
"github.com/33cn/plugin/plugin"
"net/http"
"runtime/debug"
)
)
func
main
()
{
func
main
()
{
...
...
plugin/store/kvmvccmavl/kvmvcc_mavl.go
View file @
e5a109f0
plugin/store/kvmvccmavl/kvmvccdb.go
View file @
e5a109f0
...
@@ -5,15 +5,16 @@
...
@@ -5,15 +5,16 @@
package
kvmvccmavl
package
kvmvccmavl
import
(
import
(
"bytes"
"fmt"
"strconv"
"sync/atomic"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common"
dbm
"github.com/33cn/chain33/common/db"
dbm
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/proto"
"sync/atomic"
"fmt"
"strconv"
"bytes"
)
)
const
(
const
(
...
@@ -280,7 +281,6 @@ func calcHash(datas proto.Message) []byte {
...
@@ -280,7 +281,6 @@ func calcHash(datas proto.Message) []byte {
return
common
.
Sha256
(
b
)
return
common
.
Sha256
(
b
)
}
}
//裁剪-------------------------------------------
//裁剪-------------------------------------------
// EnablePrune 使能裁剪
// EnablePrune 使能裁剪
func
EnablePrune
(
enable
bool
)
{
func
EnablePrune
(
enable
bool
)
{
...
@@ -324,8 +324,8 @@ func pruningFirst(db dbm.DB, curHeight int64) {
...
@@ -324,8 +324,8 @@ func pruningFirst(db dbm.DB, curHeight int64) {
continue
continue
}
}
if
curHeight
<
int64
(
height
)
+
LevelPruningHeight
&&
if
curHeight
<
int64
(
height
)
+
LevelPruningHeight
&&
curHeight
>=
int64
(
height
)
+
int64
(
pruneHeight
)
{
curHeight
>=
int64
(
height
)
+
int64
(
pruneHeight
)
{
mp
[
string
(
key
)]
=
append
(
mp
[
string
(
key
)],
height
)
mp
[
string
(
key
)]
=
append
(
mp
[
string
(
key
)],
height
)
count
++
count
++
}
}
...
@@ -345,7 +345,7 @@ func deleteOldKV(mp map[string][]int64, curHeight int64, batch dbm.Batch) {
...
@@ -345,7 +345,7 @@ func deleteOldKV(mp map[string][]int64, curHeight int64, batch dbm.Batch) {
for
key
,
vals
:=
range
mp
{
for
key
,
vals
:=
range
mp
{
if
len
(
vals
)
>
1
&&
vals
[
1
]
!=
vals
[
0
]
{
//防止相同高度时候出现的误删除
if
len
(
vals
)
>
1
&&
vals
[
1
]
!=
vals
[
0
]
{
//防止相同高度时候出现的误删除
for
_
,
val
:=
range
vals
[
1
:
]
{
//从第二个开始判断
for
_
,
val
:=
range
vals
[
1
:
]
{
//从第二个开始判断
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
()
batch
.
Write
()
...
@@ -368,7 +368,7 @@ func genKeyVersion(key []byte, height int64) []byte {
...
@@ -368,7 +368,7 @@ func genKeyVersion(key []byte, height int64) []byte {
}
}
func
getKeyVersion
(
vsnKey
[]
byte
)
([]
byte
,
int64
,
error
)
{
func
getKeyVersion
(
vsnKey
[]
byte
)
([]
byte
,
int64
,
error
)
{
if
len
(
vsnKey
)
<=
len
(
mvccData
)
+
1
+
20
{
if
len
(
vsnKey
)
<=
len
(
mvccData
)
+
1
+
20
{
return
nil
,
0
,
types
.
ErrSize
return
nil
,
0
,
types
.
ErrSize
}
}
sLen
:=
vsnKey
[
len
(
vsnKey
)
-
20
:
]
sLen
:=
vsnKey
[
len
(
vsnKey
)
-
20
:
]
...
...
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