aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-03-09 16:43:07 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-03-09 16:43:07 +0800
commitedd7aa054c0f9860c799748439255722e51feccc (patch)
treedd7dd52d31628375ead8a06e681441102faf9037 /eth
parent05c86c2c9fa14ea03fdc5d0cd77cdecc34e4f164 (diff)
parente90958cd29a228b051faeaa25d66e053cf9d2228 (diff)
downloadgo-tangerine-edd7aa054c0f9860c799748439255722e51feccc.tar
go-tangerine-edd7aa054c0f9860c799748439255722e51feccc.tar.gz
go-tangerine-edd7aa054c0f9860c799748439255722e51feccc.tar.bz2
go-tangerine-edd7aa054c0f9860c799748439255722e51feccc.tar.lz
go-tangerine-edd7aa054c0f9860c799748439255722e51feccc.tar.xz
go-tangerine-edd7aa054c0f9860c799748439255722e51feccc.tar.zst
go-tangerine-edd7aa054c0f9860c799748439255722e51feccc.zip
Merge pull request #2228 from karalabe/allocate-cache-to-chaindata
cmd, eth, ethdb, node: prioritise chaindata for resources, bump cache
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go9
-rw-r--r--eth/filters/filter_test.go4
2 files changed, 5 insertions, 8 deletions
diff --git a/eth/backend.go b/eth/backend.go
index f62ee976d..d807f8ae8 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -69,6 +69,7 @@ type Config struct {
BlockChainVersion int
SkipBcVersionCheck bool // e.g. blockchain export
DatabaseCache int
+ DatabaseHandles int
NatSpec bool
DocRoot string
@@ -135,12 +136,8 @@ type Ethereum struct {
}
func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
- // Let the database take 3/4 of the max open files (TODO figure out a way to get the actual limit of the open files)
- const dbCount = 3
- ethdb.OpenFileLimit = 128 / (dbCount + 1)
-
// Open the chain database and perform any upgrades needed
- chainDb, err := ctx.OpenDatabase("chaindata", config.DatabaseCache)
+ chainDb, err := ctx.OpenDatabase("chaindata", config.DatabaseCache, config.DatabaseHandles)
if err != nil {
return nil, err
}
@@ -154,7 +151,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
return nil, err
}
- dappDb, err := ctx.OpenDatabase("dapp", config.DatabaseCache)
+ dappDb, err := ctx.OpenDatabase("dapp", config.DatabaseCache, config.DatabaseHandles)
if err != nil {
return nil, err
}
diff --git a/eth/filters/filter_test.go b/eth/filters/filter_test.go
index 5772114b3..b98945bbd 100644
--- a/eth/filters/filter_test.go
+++ b/eth/filters/filter_test.go
@@ -31,7 +31,7 @@ func BenchmarkMipmaps(b *testing.B) {
defer os.RemoveAll(dir)
var (
- db, _ = ethdb.NewLDBDatabase(dir, 16)
+ db, _ = ethdb.NewLDBDatabase(dir, 0, 0)
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
addr2 = common.BytesToAddress([]byte("jeff"))
@@ -105,7 +105,7 @@ func TestFilters(t *testing.T) {
defer os.RemoveAll(dir)
var (
- db, _ = ethdb.NewLDBDatabase(dir, 16)
+ db, _ = ethdb.NewLDBDatabase(dir, 0, 0)
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addr = crypto.PubkeyToAddress(key1.PublicKey)