good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Erigon
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
a
Erigon
Commits
6c4ec563
Unverified
Commit
6c4ec563
authored
4 years ago
by
Alex Sharov
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix - change private api from ui (#829)
parent
8c843330
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ethdb/kv_lmdb.go
+5
-35
5 additions, 35 deletions
ethdb/kv_lmdb.go
with
5 additions
and
35 deletions
ethdb/kv_lmdb.go
+
5
−
35
View file @
6c4ec563
...
...
@@ -115,15 +115,11 @@ func (opts lmdbOpts) Open() (KV, error) {
}
if
!
opts
.
inMem
{
ctx
,
ctxCancel
:=
context
.
WithCancel
(
context
.
Background
())
db
.
stopStaleReadsCheck
=
ctxCancel
db
.
wg
.
Add
(
1
)
go
func
()
{
defer
db
.
wg
.
Done
()
ticker
:=
time
.
NewTicker
(
time
.
Minute
)
defer
ticker
.
Stop
()
db
.
staleReadsCheckLoop
(
ctx
,
ticker
)
}()
if
staleReaders
,
err
:=
db
.
env
.
ReaderCheck
();
err
!=
nil
{
db
.
log
.
Error
(
"failed ReaderCheck"
,
"err"
,
err
)
}
else
if
staleReaders
>
0
{
db
.
log
.
Debug
(
"cleared reader slots from dead processes"
,
"amount"
,
staleReaders
)
}
}
return
db
,
nil
...
...
@@ -160,35 +156,9 @@ func NewLMDB() lmdbOpts {
return
lmdbOpts
{}
}
// staleReadsCheckLoop - In any real application it is important to check for readers that were
// never closed by their owning process, and for which the owning process
// has exited. See the documentation on transactions for more information.
func
(
db
*
LmdbKV
)
staleReadsCheckLoop
(
ctx
context
.
Context
,
ticker
*
time
.
Ticker
)
{
for
db
.
env
!=
nil
{
// check once on app start
staleReaders
,
err2
:=
db
.
env
.
ReaderCheck
()
if
err2
!=
nil
{
db
.
log
.
Error
(
"failed ReaderCheck"
,
"err"
,
err2
)
}
if
staleReaders
>
0
{
db
.
log
.
Info
(
"cleared reader slots from dead processes"
,
"amount"
,
staleReaders
)
}
select
{
case
<-
ctx
.
Done
()
:
return
case
<-
ticker
.
C
:
}
}
}
// Close closes db
// All transactions must be closed before closing the database.
func
(
db
*
LmdbKV
)
Close
()
{
if
db
.
stopStaleReadsCheck
!=
nil
{
db
.
stopStaleReadsCheck
()
}
if
db
.
env
!=
nil
{
db
.
wg
.
Wait
()
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment