diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-03-08 21:56:20 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-05-16 15:39:29 +0800 |
commit | 006c21efc7af8bdf04d003ef256d8e2eb30006bb (patch) | |
tree | 17df1f265b2f17355e7e6be75edbc2ffd695afe2 /cmd | |
parent | 0c5f8c078abca7dc5954e30f307495a5c41c5f6c (diff) | |
download | go-tangerine-006c21efc7af8bdf04d003ef256d8e2eb30006bb.tar go-tangerine-006c21efc7af8bdf04d003ef256d8e2eb30006bb.tar.gz go-tangerine-006c21efc7af8bdf04d003ef256d8e2eb30006bb.tar.bz2 go-tangerine-006c21efc7af8bdf04d003ef256d8e2eb30006bb.tar.lz go-tangerine-006c21efc7af8bdf04d003ef256d8e2eb30006bb.tar.xz go-tangerine-006c21efc7af8bdf04d003ef256d8e2eb30006bb.tar.zst go-tangerine-006c21efc7af8bdf04d003ef256d8e2eb30006bb.zip |
cmd, core, eth, les, node: chain freezer on top of db rework
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/chaincmd.go | 7 | ||||
-rw-r--r-- | cmd/geth/main.go | 1 | ||||
-rw-r--r-- | cmd/geth/usage.go | 1 | ||||
-rw-r--r-- | cmd/utils/flags.go | 9 |
4 files changed, 15 insertions, 3 deletions
diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 582f0b768..809f5cf4a 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -368,9 +368,12 @@ func exportPreimages(ctx *cli.Context) error { func copyDb(ctx *cli.Context) error { // Ensure we have a source chain directory to copy - if len(ctx.Args()) != 1 { + if len(ctx.Args()) < 1 { utils.Fatalf("Source chaindata directory path argument missing") } + if len(ctx.Args()) < 2 { + utils.Fatalf("Source ancient chain directory path argument missing") + } // Initialize a new chain for the running node to sync into stack := makeFullNode(ctx) defer stack.Close() @@ -385,7 +388,7 @@ func copyDb(ctx *cli.Context) error { dl := downloader.New(0, chainDb, syncBloom, new(event.TypeMux), chain, nil, nil) // Create a source peer to satisfy downloader requests from - db, err := rawdb.NewLevelDBDatabase(ctx.Args().First(), ctx.GlobalInt(utils.CacheFlag.Name)/2, 256, "") + db, err := rawdb.NewLevelDBDatabaseWithFreezer(ctx.Args().First(), ctx.GlobalInt(utils.CacheFlag.Name)/2, 256, ctx.Args().Get(1), "") if err != nil { return err } diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 838029333..dc63f2302 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -62,6 +62,7 @@ var ( utils.BootnodesV4Flag, utils.BootnodesV5Flag, utils.DataDirFlag, + utils.AncientFlag, utils.KeyStoreDirFlag, utils.ExternalSignerFlag, utils.NoUSBFlag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 7ec1ab03f..67b0027f2 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -69,6 +69,7 @@ var AppHelpFlagGroups = []flagGroup{ Flags: []cli.Flag{ configFileFlag, utils.DataDirFlag, + utils.AncientFlag, utils.KeyStoreDirFlag, utils.NoUSBFlag, utils.NetworkIdFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 2dc45cbba..c40da85b0 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -117,6 +117,10 @@ var ( Usage: "Data directory for the databases and keystore", Value: DirectoryString{node.DefaultDataDir()}, } + AncientFlag = DirectoryFlag{ + Name: "datadir.ancient", + Usage: "Data directory for ancient chain segments (default = inside chaindata)", + } KeyStoreDirFlag = DirectoryFlag{ Name: "keystore", Usage: "Directory for the keystore (default = inside the datadir)", @@ -1378,6 +1382,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { cfg.DatabaseCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100 } cfg.DatabaseHandles = makeDatabaseHandles() + if ctx.GlobalIsSet(AncientFlag.Name) { + cfg.DatabaseFreezer = ctx.GlobalString(AncientFlag.Name) + } if gcmode := ctx.GlobalString(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" { Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name) @@ -1566,7 +1573,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database { if ctx.GlobalString(SyncModeFlag.Name) == "light" { name = "lightchaindata" } - chainDb, err := stack.OpenDatabase(name, cache, handles, "") + chainDb, err := stack.OpenDatabaseWithFreezer(name, cache, handles, "", "") if err != nil { Fatalf("Could not open database: %v", err) } |