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
13f8f65a
Commit
13f8f65a
authored
10 years ago
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth, ethdb: lower the amount of open files & improve err messages for db
Closes #880
parent
76215ca9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
backend.go
eth/backend.go
+6
-3
database.go
ethdb/database.go
+2
-2
No files found.
eth/backend.go
View file @
13f8f65a
...
...
@@ -207,21 +207,24 @@ func New(config *Config) (*Ethereum, error) {
logger
.
NewJSONsystem
(
config
.
DataDir
,
config
.
LogJSON
)
}
const
dbCount
=
3
ethdb
.
OpenFileLimit
=
256
/
(
dbCount
+
1
)
newdb
:=
config
.
NewDB
if
newdb
==
nil
{
newdb
=
func
(
path
string
)
(
common
.
Database
,
error
)
{
return
ethdb
.
NewLDBDatabase
(
path
)
}
}
blockDb
,
err
:=
newdb
(
path
.
Join
(
config
.
DataDir
,
"blockchain"
))
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"blockchain db err: %v"
,
err
)
}
stateDb
,
err
:=
newdb
(
path
.
Join
(
config
.
DataDir
,
"state"
))
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"state db err: %v"
,
err
)
}
extraDb
,
err
:=
newdb
(
path
.
Join
(
config
.
DataDir
,
"extra"
))
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"extra db err: %v"
,
err
)
}
nodeDb
:=
path
.
Join
(
config
.
DataDir
,
"nodes"
)
...
...
This diff is collapsed.
Click to expand it.
ethdb/database.go
View file @
13f8f65a
...
...
@@ -11,7 +11,7 @@ import (
"github.com/syndtr/goleveldb/leveldb/opt"
)
const
openFileLimit
=
128
var
OpenFileLimit
=
64
type
LDBDatabase
struct
{
fn
string
...
...
@@ -26,7 +26,7 @@ type LDBDatabase struct {
func
NewLDBDatabase
(
file
string
)
(
*
LDBDatabase
,
error
)
{
// Open the db
db
,
err
:=
leveldb
.
OpenFile
(
file
,
&
opt
.
Options
{
OpenFilesCacheCapacity
:
o
penFileLimit
})
db
,
err
:=
leveldb
.
OpenFile
(
file
,
&
opt
.
Options
{
OpenFilesCacheCapacity
:
O
penFileLimit
})
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
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