From e209759283ab723ee86f9c3db7af7ca25987cce5 Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Tue, 8 Mar 2022 21:16:11 -0600 Subject: [PATCH] make maxdelete an optional param --- executor.go | 2 +- rbf/cfg/cfg.go | 4 ++++ rbf/cfg/os.go | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/executor.go b/executor.go index 885200c4f..d8422bd05 100644 --- a/executor.go +++ b/executor.go @@ -8504,7 +8504,7 @@ func DeleteRowsWithFlow(ctx context.Context, src *Row, idx *Index, shard uint64, } var change bool var err error - limit := 65536 + limit := idx.holder.cfg.RBFConfig.MaxDelete for i := 0; i < len(bits); i += limit { batch := roaring.NewBitmap(bits[i:min(i+limit, len(bits))]...) if idx.Keys() { diff --git a/rbf/cfg/cfg.go b/rbf/cfg/cfg.go index 184775e33..2b65a2b2b 100644 --- a/rbf/cfg/cfg.go +++ b/rbf/cfg/cfg.go @@ -41,6 +41,9 @@ type Config struct { // background checkpoints. It cannot be set from toml. The default is // to use stderr. Logger logger.Logger `toml:"-"` + + // The maximum number of bits to be deleted in a single transaction default(65536) + MaxDelete int `toml:"max-delete"` } func NewDefaultConfig() *Config { @@ -50,6 +53,7 @@ func NewDefaultConfig() *Config { MinWALCheckpointSize: DefaultMinWALCheckpointSize, MaxWALCheckpointSize: DefaultMaxWALCheckpointSize, FsyncEnabled: true, + MaxDelete: DefaultMaxDelete, // CI passed with 20. 50 was too big for CI, even on X-large instances. // For now we default to 0, which means use sync.Pool. diff --git a/rbf/cfg/os.go b/rbf/cfg/os.go index 5ca1f60d9..057b4320f 100644 --- a/rbf/cfg/os.go +++ b/rbf/cfg/os.go @@ -13,3 +13,6 @@ const DefaultMaxSize = 4 * (1 << 30) // size of the WAL. The size can be increased by updating the DB.MaxWALSize // and reopening the database. This setting mainly affects virtual space usage. const DefaultMaxWALSize = 4 * (1 << 30) + +// DefaultMaxDelete is the maximum number of bits that will be deleted in a single batch +const DefaultMaxDelete = 65536