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
0ce331f5
Unverified
Commit
0ce331f5
authored
Aug 11, 2023
by
Péter Szilágyi
Committed by
GitHub
Aug 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trie/triedb/pathdb: make shutdown journal log friendlier (#27905)
parent
80b76a95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
journal.go
trie/triedb/pathdb/journal.go
+10
-1
No files found.
trie/triedb/pathdb/journal.go
View file @
0ce331f5
...
@@ -21,6 +21,7 @@ import (
...
@@ -21,6 +21,7 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"io"
"io"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
...
@@ -341,6 +342,14 @@ func (db *Database) Journal(root common.Hash) error {
...
@@ -341,6 +342,14 @@ func (db *Database) Journal(root common.Hash) error {
if
l
==
nil
{
if
l
==
nil
{
return
fmt
.
Errorf
(
"triedb layer [%#x] missing"
,
root
)
return
fmt
.
Errorf
(
"triedb layer [%#x] missing"
,
root
)
}
}
disk
:=
db
.
tree
.
bottom
()
if
l
,
ok
:=
l
.
(
*
diffLayer
);
ok
{
log
.
Info
(
"Persisting dirty state to disk"
,
"head"
,
l
.
block
,
"root"
,
root
,
"layers"
,
l
.
id
-
disk
.
id
+
disk
.
buffer
.
layers
)
}
else
{
// disk layer only on noop runs (likely) or deep reorgs (unlikely)
log
.
Info
(
"Persisting dirty state to disk"
,
"root"
,
root
,
"layers"
,
disk
.
buffer
.
layers
)
}
start
:=
time
.
Now
()
// Run the journaling
// Run the journaling
db
.
lock
.
Lock
()
db
.
lock
.
Lock
()
defer
db
.
lock
.
Unlock
()
defer
db
.
lock
.
Unlock
()
...
@@ -373,6 +382,6 @@ func (db *Database) Journal(root common.Hash) error {
...
@@ -373,6 +382,6 @@ func (db *Database) Journal(root common.Hash) error {
// Set the db in read only mode to reject all following mutations
// Set the db in read only mode to reject all following mutations
db
.
readOnly
=
true
db
.
readOnly
=
true
log
.
Info
(
"
Stored journal in triedb"
,
"disk"
,
diskroot
,
"size"
,
common
.
StorageSize
(
journal
.
Len
(
)))
log
.
Info
(
"
Persisted dirty state to disk"
,
"size"
,
common
.
StorageSize
(
journal
.
Len
()),
"elapsed"
,
common
.
PrettyDuration
(
time
.
Since
(
start
)))
return
nil
return
nil
}
}
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