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
a6e5c6a2
Commit
a6e5c6a2
authored
Mar 08, 2019
by
Janoš Guljaš
Committed by
Viktor Trón
Mar 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/storage/localstore: fix synchronization in TestDB_gcSize (#19235)
parent
46873912
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
gc_test.go
swarm/storage/localstore/gc_test.go
+2
-5
localstore.go
swarm/storage/localstore/localstore.go
+10
-2
No files found.
swarm/storage/localstore/gc_test.go
View file @
a6e5c6a2
...
...
@@ -289,12 +289,9 @@ func TestDB_gcSize(t *testing.T) {
}
// DB.Close writes gc size to disk, so
// Instead calling Close,
simulate database shutdown
// Instead calling Close,
close the database
// without it.
close
(
db
.
close
)
db
.
updateGCWG
.
Wait
()
err
=
db
.
shed
.
Close
()
if
err
!=
nil
{
if
err
:=
db
.
closeWithOptions
(
false
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
swarm/storage/localstore/localstore.go
View file @
a6e5c6a2
...
...
@@ -367,6 +367,12 @@ func New(path string, baseKey []byte, o *Options) (db *DB, err error) {
// Close closes the underlying database.
func
(
db
*
DB
)
Close
()
(
err
error
)
{
return
db
.
closeWithOptions
(
true
)
}
// closeWithOptions provides a more control which part of closing
// is done for tests.
func
(
db
*
DB
)
closeWithOptions
(
writeGCSize
bool
)
(
err
error
)
{
close
(
db
.
close
)
db
.
updateGCWG
.
Wait
()
...
...
@@ -384,8 +390,10 @@ func (db *DB) Close() (err error) {
log
.
Error
(
"localstore: write gc size worker did not return after db close"
)
}
if
err
:=
db
.
writeGCSize
(
db
.
getGCSize
());
err
!=
nil
{
log
.
Error
(
"localstore: write gc size"
,
"err"
,
err
)
if
writeGCSize
{
if
err
:=
db
.
writeGCSize
(
db
.
getGCSize
());
err
!=
nil
{
log
.
Error
(
"localstore: write gc size"
,
"err"
,
err
)
}
}
return
db
.
shed
.
Close
()
}
...
...
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