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
d6225ab8
Unverified
Commit
d6225ab8
authored
Feb 05, 2019
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/utils, eth: relinquish GC cache to read cache in archive mode
parent
85b3b1c8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
17 deletions
+24
-17
flags.go
cmd/utils/flags.go
+2
-2
size.go
common/size.go
+8
-8
size_test.go
common/size_test.go
+2
-2
blockchain.go
core/blockchain.go
+2
-2
blockchain_insert.go
core/blockchain_insert.go
+2
-2
backend.go
eth/backend.go
+6
-0
database.go
ethdb/database.go
+2
-1
No files found.
cmd/utils/flags.go
View file @
d6225ab8
...
...
@@ -332,12 +332,12 @@ var (
}
CacheTrieFlag
=
cli
.
IntFlag
{
Name
:
"cache.trie"
,
Usage
:
"Percentage of cache memory allowance to use for trie caching"
,
Usage
:
"Percentage of cache memory allowance to use for trie caching
(default = 25% full mode, 50% archive mode)
"
,
Value
:
25
,
}
CacheGCFlag
=
cli
.
IntFlag
{
Name
:
"cache.gc"
,
Usage
:
"Percentage of cache memory allowance to use for trie pruning"
,
Usage
:
"Percentage of cache memory allowance to use for trie pruning
(default = 25% full mode, 0% archive mode)
"
,
Value
:
25
,
}
TrieCacheGenFlag
=
cli
.
IntFlag
{
...
...
common/size.go
View file @
d6225ab8
...
...
@@ -26,10 +26,10 @@ type StorageSize float64
// String implements the stringer interface.
func
(
s
StorageSize
)
String
()
string
{
if
s
>
10
00000
{
return
fmt
.
Sprintf
(
"%.2f
mB"
,
s
/
1000000
)
}
else
if
s
>
10
00
{
return
fmt
.
Sprintf
(
"%.2f
kB"
,
s
/
1000
)
if
s
>
10
48576
{
return
fmt
.
Sprintf
(
"%.2f
MiB"
,
s
/
1048576
)
}
else
if
s
>
10
24
{
return
fmt
.
Sprintf
(
"%.2f
KiB"
,
s
/
1024
)
}
else
{
return
fmt
.
Sprintf
(
"%.2f B"
,
s
)
}
...
...
@@ -38,10 +38,10 @@ func (s StorageSize) String() string {
// TerminalString implements log.TerminalStringer, formatting a string for console
// output during logging.
func
(
s
StorageSize
)
TerminalString
()
string
{
if
s
>
10
00000
{
return
fmt
.
Sprintf
(
"%.2f
mB"
,
s
/
1000000
)
}
else
if
s
>
10
00
{
return
fmt
.
Sprintf
(
"%.2f
kB"
,
s
/
1000
)
if
s
>
10
48576
{
return
fmt
.
Sprintf
(
"%.2f
MiB"
,
s
/
1048576
)
}
else
if
s
>
10
24
{
return
fmt
.
Sprintf
(
"%.2f
KiB"
,
s
/
1024
)
}
else
{
return
fmt
.
Sprintf
(
"%.2fB"
,
s
)
}
...
...
common/size_test.go
View file @
d6225ab8
...
...
@@ -25,8 +25,8 @@ func TestStorageSizeString(t *testing.T) {
size
StorageSize
str
string
}{
{
2381273
,
"2.
38 m
B"
},
{
2192
,
"2.1
9 k
B"
},
{
2381273
,
"2.
27 Mi
B"
},
{
2192
,
"2.1
4 Ki
B"
},
{
12
,
"12.00 B"
},
}
...
...
core/blockchain.go
View file @
d6225ab8
...
...
@@ -1253,8 +1253,8 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, []
stats
.
processed
++
stats
.
usedGas
+=
usedGas
cache
,
_
:=
bc
.
stateCache
.
TrieDB
()
.
Size
()
stats
.
report
(
chain
,
it
.
index
,
cache
)
dirty
,
_
:=
bc
.
stateCache
.
TrieDB
()
.
Size
()
stats
.
report
(
chain
,
it
.
index
,
dirty
)
}
// Any blocks remaining here? The only ones we care about are the future ones
if
block
!=
nil
&&
err
==
consensus
.
ErrFutureBlock
{
...
...
core/blockchain_insert.go
View file @
d6225ab8
...
...
@@ -39,7 +39,7 @@ const statsReportLimit = 8 * time.Second
// report prints statistics if some number of blocks have been processed
// or more than a few seconds have passed since the last message.
func
(
st
*
insertStats
)
report
(
chain
[]
*
types
.
Block
,
index
int
,
cache
common
.
StorageSize
)
{
func
(
st
*
insertStats
)
report
(
chain
[]
*
types
.
Block
,
index
int
,
dirty
common
.
StorageSize
)
{
// Fetch the timings for the batch
var
(
now
=
mclock
.
Now
()
...
...
@@ -63,7 +63,7 @@ func (st *insertStats) report(chain []*types.Block, index int, cache common.Stor
if
timestamp
:=
time
.
Unix
(
end
.
Time
()
.
Int64
(),
0
);
time
.
Since
(
timestamp
)
>
time
.
Minute
{
context
=
append
(
context
,
[]
interface
{}{
"age"
,
common
.
PrettyAge
(
timestamp
)}
...
)
}
context
=
append
(
context
,
[]
interface
{}{
"
cache"
,
cache
}
...
)
context
=
append
(
context
,
[]
interface
{}{
"
dirty"
,
dirty
}
...
)
if
st
.
queued
>
0
{
context
=
append
(
context
,
[]
interface
{}{
"queued"
,
st
.
queued
}
...
)
...
...
eth/backend.go
View file @
d6225ab8
...
...
@@ -113,6 +113,12 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
log
.
Warn
(
"Sanitizing invalid miner gas price"
,
"provided"
,
config
.
MinerGasPrice
,
"updated"
,
DefaultConfig
.
MinerGasPrice
)
config
.
MinerGasPrice
=
new
(
big
.
Int
)
.
Set
(
DefaultConfig
.
MinerGasPrice
)
}
if
config
.
NoPruning
&&
config
.
TrieDirtyCache
>
0
{
config
.
TrieCleanCache
+=
config
.
TrieDirtyCache
config
.
TrieDirtyCache
=
0
}
log
.
Info
(
"Allocated trie memory caches"
,
"clean"
,
common
.
StorageSize
(
config
.
TrieCleanCache
)
*
1024
*
1024
,
"dirty"
,
common
.
StorageSize
(
config
.
TrieDirtyCache
)
*
1024
*
1024
)
// Assemble the Ethereum object
chainDb
,
err
:=
CreateDB
(
ctx
,
config
,
"chaindata"
)
if
err
!=
nil
{
...
...
ethdb/database.go
View file @
d6225ab8
...
...
@@ -25,6 +25,7 @@ import (
"sync"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/syndtr/goleveldb/leveldb"
...
...
@@ -70,7 +71,7 @@ func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error) {
if
handles
<
16
{
handles
=
16
}
logger
.
Info
(
"Allocated cache and file handles"
,
"cache"
,
c
ache
,
"handles"
,
handles
)
logger
.
Info
(
"Allocated cache and file handles"
,
"cache"
,
c
ommon
.
StorageSize
(
cache
*
1024
*
1024
)
,
"handles"
,
handles
)
// Open the db and recover any potential corruptions
db
,
err
:=
leveldb
.
OpenFile
(
file
,
&
opt
.
Options
{
...
...
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