This commit is contained in:
alex.sharov 2023-04-18 08:26:55 +07:00
parent 515aedda7b
commit 31e5036985

View File

@ -711,11 +711,12 @@ var (
} }
DbPageSizeFlag = cli.StringFlag{ DbPageSizeFlag = cli.StringFlag{
Name: "db.pagesize", Name: "db.pagesize",
Usage: "set mdbx pagesize on db creation: must be power of 2 and '256b <= pagesize <= 64kb'. default: equal to OperationSystem's pageSize", Usage: "DB is splitted to 'pages' of fixed size. Can't change DB creation. Must be power of 2 and '256b <= pagesize <= 64kb'. Default: equal to OperationSystem's pageSize. Bigger pageSize causing: 1. More writes to disk during commit 2. Smaller b-tree high 3. Less fragmentation 4. Less overhead on 'free-pages list' maintainance (a bit faster Put/Commit) 5. If expecting DB-size > 8Tb then set pageSize >= 8Kb",
Value: datasize.ByteSize(kv.DefaultPageSize()).String(), Value: datasize.ByteSize(kv.DefaultPageSize()).String(),
} }
DbSizeLimitFlag = cli.StringFlag{ DbSizeLimitFlag = cli.StringFlag{
Name: "db.size.limit", Name: "db.size.limit",
Usage: "runtime limit of chandata db size. you can change value of this flag at any time",
Value: (8 * datasize.TB).String(), Value: (8 * datasize.TB).String(),
} }
@ -1157,7 +1158,7 @@ func setDataDir(ctx *cli.Context, cfg *nodecfg.Config) {
} }
sz := cfg.MdbxPageSize.Bytes() sz := cfg.MdbxPageSize.Bytes()
if !isPowerOfTwo(sz) || sz < 256 || sz > 64*1024 { if !isPowerOfTwo(sz) || sz < 256 || sz > 64*1024 {
panic(fmt.Errorf("invalid --db.pagesize: %s=%d, see: %s", ctx.String(DbPageSizeFlag.Name), sz, DbPageSizeFlag.Usage)) panic(fmt.Errorf("invalid --db.pageSize: %s=%d, see: %s", ctx.String(DbPageSizeFlag.Name), sz, DbPageSizeFlag.Usage))
} }
szLimit := cfg.MdbxDBSizeLimit.Bytes() szLimit := cfg.MdbxDBSizeLimit.Bytes()
if !isPowerOfTwo(szLimit) || szLimit < 256 { if !isPowerOfTwo(szLimit) || szLimit < 256 {