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