Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
张蕾
Geth-Modification
Commits
3333fe66
Unverified
Commit
3333fe66
authored
Nov 19, 2018
by
Anton Evangelatov
Committed by
GitHub
Nov 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/storage: speed up garbage collection and rpc tests (#18128)
parent
51e2e78d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
ldbstore_test.go
swarm/storage/ldbstore_test.go
+5
-4
rpc_test.go
swarm/storage/mock/rpc/rpc_test.go
+1
-1
No files found.
swarm/storage/ldbstore_test.go
View file @
3333fe66
...
@@ -344,17 +344,18 @@ func TestLDBStoreWithoutCollectGarbage(t *testing.T) {
...
@@ -344,17 +344,18 @@ func TestLDBStoreWithoutCollectGarbage(t *testing.T) {
func
TestLDBStoreCollectGarbage
(
t
*
testing
.
T
)
{
func
TestLDBStoreCollectGarbage
(
t
*
testing
.
T
)
{
// below max ronud
// below max ronud
cap
:=
defaultMaxGCRound
/
2
initialCap
:=
defaultMaxGCRound
/
100
cap
:=
initialCap
/
2
t
.
Run
(
fmt
.
Sprintf
(
"A/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"A/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"B/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreRemoveThenCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"B/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreRemoveThenCollectGarbage
)
// at max round
// at max round
cap
=
defaultMaxGCRound
cap
=
initialCap
t
.
Run
(
fmt
.
Sprintf
(
"A/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"A/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"B/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreRemoveThenCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"B/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreRemoveThenCollectGarbage
)
// more than max around, not on threshold
// more than max around, not on threshold
cap
=
defaultMaxGCRound
*
1.1
cap
=
initialCap
+
500
t
.
Run
(
fmt
.
Sprintf
(
"A/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"A/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"B/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreRemoveThenCollectGarbage
)
t
.
Run
(
fmt
.
Sprintf
(
"B/%d/%d"
,
cap
,
cap
*
4
),
testLDBStoreRemoveThenCollectGarbage
)
...
@@ -578,7 +579,7 @@ func testLDBStoreRemoveThenCollectGarbage(t *testing.T) {
...
@@ -578,7 +579,7 @@ func testLDBStoreRemoveThenCollectGarbage(t *testing.T) {
// TestLDBStoreCollectGarbageAccessUnlikeIndex tests garbage collection where accesscount differs from indexcount
// TestLDBStoreCollectGarbageAccessUnlikeIndex tests garbage collection where accesscount differs from indexcount
func
TestLDBStoreCollectGarbageAccessUnlikeIndex
(
t
*
testing
.
T
)
{
func
TestLDBStoreCollectGarbageAccessUnlikeIndex
(
t
*
testing
.
T
)
{
capacity
:=
defaultMaxGCRound
*
2
capacity
:=
defaultMaxGCRound
/
100
*
2
n
:=
capacity
-
1
n
:=
capacity
-
1
ldb
,
cleanup
:=
newLDBStore
(
t
)
ldb
,
cleanup
:=
newLDBStore
(
t
)
...
...
swarm/storage/mock/rpc/rpc_test.go
View file @
3333fe66
...
@@ -37,5 +37,5 @@ func TestRPCStore(t *testing.T) {
...
@@ -37,5 +37,5 @@ func TestRPCStore(t *testing.T) {
store
:=
NewGlobalStore
(
rpc
.
DialInProc
(
server
))
store
:=
NewGlobalStore
(
rpc
.
DialInProc
(
server
))
defer
store
.
Close
()
defer
store
.
Close
()
test
.
MockStore
(
t
,
store
,
10
0
)
test
.
MockStore
(
t
,
store
,
3
0
)
}
}
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