From a0ee18483e9576d7dd2863f90b6df5b69d9af17f Mon Sep 17 00:00:00 2001 From: jiangxinmeng1 <51114574+jiangxinmeng1@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:50:54 +0800 Subject: [PATCH 1/5] chore: set default incremental checkpoint interval to 5m --- pkg/tnservice/cfg.go | 2 +- pkg/vm/engine/tae/db/checkpoint/cfg.go | 2 +- pkg/vm/engine/tae/options/types.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/tnservice/cfg.go b/pkg/tnservice/cfg.go index 2851623af2ae0..e2175c3bdb2ae 100644 --- a/pkg/tnservice/cfg.go +++ b/pkg/tnservice/cfg.go @@ -50,7 +50,7 @@ var ( defaultFlushInterval = time.Second * 60 defaultScanInterval = time.Second * 5 - defaultIncrementalInterval = time.Minute + defaultIncrementalInterval = time.Minute * 5 defaultGlobalMinCount = int64(40) defaultMinCount = int64(100) defaultReservedWALEntryCount = uint64(5000) diff --git a/pkg/vm/engine/tae/db/checkpoint/cfg.go b/pkg/vm/engine/tae/db/checkpoint/cfg.go index 187078a7e4f79..0873ca44b8806 100644 --- a/pkg/vm/engine/tae/db/checkpoint/cfg.go +++ b/pkg/vm/engine/tae/db/checkpoint/cfg.go @@ -57,7 +57,7 @@ func (cfg CheckpointCfg) String() string { func (cfg *CheckpointCfg) FillDefaults() { if cfg.IncrementalInterval <= 0 { - cfg.IncrementalInterval = time.Minute + cfg.IncrementalInterval = time.Minute * 5 } if cfg.MinCount <= 0 { cfg.MinCount = 10000 diff --git a/pkg/vm/engine/tae/options/types.go b/pkg/vm/engine/tae/options/types.go index f4d4b3182f787..815a40a396437 100644 --- a/pkg/vm/engine/tae/options/types.go +++ b/pkg/vm/engine/tae/options/types.go @@ -41,7 +41,7 @@ const ( DefaultCheckpointFlushInterval = time.Minute DefaultCheckpointTransferInterval = time.Second * 5 DefaultCheckpointMinCount = int64(100) - DefaultCheckpointIncremetalInterval = time.Minute + DefaultCheckpointIncremetalInterval = time.Minute * 5 DefaultCheckpointGlobalMinCount = 10 DefaultGlobalVersionInterval = time.Hour DefaultGCCheckpointInterval = time.Minute From 0b98efc2a39ad1d080796fcd2305f76a0bacd189 Mon Sep 17 00:00:00 2001 From: jiangxinmeng1 <51114574+jiangxinmeng1@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:45:40 +0800 Subject: [PATCH 2/5] chore: set default incremental checkpoint interval to 5m (cherry picked from commit 0ba8b1b31bb864b3c276f6b07f4bf8400b63cbd2) --- pkg/tnservice/cfg.go | 6 +++--- pkg/vm/engine/tae/db/checkpoint/cfg.go | 3 ++- pkg/vm/engine/tae/options/options.go | 2 +- pkg/vm/engine/tae/options/types.go | 19 ++++++++++--------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pkg/tnservice/cfg.go b/pkg/tnservice/cfg.go index e2175c3bdb2ae..a715a7b9125f4 100644 --- a/pkg/tnservice/cfg.go +++ b/pkg/tnservice/cfg.go @@ -31,6 +31,7 @@ import ( "github.com/matrixorigin/matrixone/pkg/pb/txn" "github.com/matrixorigin/matrixone/pkg/txn/rpc" "github.com/matrixorigin/matrixone/pkg/util/toml" + "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/options" ) var ( @@ -50,7 +51,6 @@ var ( defaultFlushInterval = time.Second * 60 defaultScanInterval = time.Second * 5 - defaultIncrementalInterval = time.Minute * 5 defaultGlobalMinCount = int64(40) defaultMinCount = int64(100) defaultReservedWALEntryCount = uint64(5000) @@ -264,7 +264,7 @@ func (c *Config) Validate() error { c.Ckp.MinCount = defaultMinCount } if c.Ckp.IncrementalInterval.Duration == 0 { - c.Ckp.IncrementalInterval.Duration = defaultIncrementalInterval + c.Ckp.IncrementalInterval.Duration = options.DefaultCheckpointIncrementalInterval } if c.Ckp.GlobalMinCount == 0 { c.Ckp.GlobalMinCount = defaultGlobalMinCount @@ -380,7 +380,7 @@ func (c *Config) SetDefaultValue() { c.Ckp.MinCount = defaultMinCount } if c.Ckp.IncrementalInterval.Duration == 0 { - c.Ckp.IncrementalInterval.Duration = defaultIncrementalInterval + c.Ckp.IncrementalInterval.Duration = options.DefaultCheckpointIncrementalInterval } if c.Ckp.GlobalMinCount == 0 { c.Ckp.GlobalMinCount = defaultGlobalMinCount diff --git a/pkg/vm/engine/tae/db/checkpoint/cfg.go b/pkg/vm/engine/tae/db/checkpoint/cfg.go index 0873ca44b8806..2c3749c6f0ce4 100644 --- a/pkg/vm/engine/tae/db/checkpoint/cfg.go +++ b/pkg/vm/engine/tae/db/checkpoint/cfg.go @@ -19,6 +19,7 @@ import ( "time" "github.com/matrixorigin/matrixone/pkg/common/mpool" + "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/options" ) type CheckpointCfg struct { @@ -57,7 +58,7 @@ func (cfg CheckpointCfg) String() string { func (cfg *CheckpointCfg) FillDefaults() { if cfg.IncrementalInterval <= 0 { - cfg.IncrementalInterval = time.Minute * 5 + cfg.IncrementalInterval = options.DefaultCheckpointIncrementalInterval } if cfg.MinCount <= 0 { cfg.MinCount = 10000 diff --git a/pkg/vm/engine/tae/options/options.go b/pkg/vm/engine/tae/options/options.go index a6947adf85150..8d672e59b9bdc 100644 --- a/pkg/vm/engine/tae/options/options.go +++ b/pkg/vm/engine/tae/options/options.go @@ -179,7 +179,7 @@ func (o *Options) FillDefaults(dirname string) *Options { o.CheckpointCfg.TransferInterval = DefaultCheckpointTransferInterval } if o.CheckpointCfg.IncrementalInterval <= 0 { - o.CheckpointCfg.IncrementalInterval = DefaultCheckpointIncremetalInterval + o.CheckpointCfg.IncrementalInterval = DefaultCheckpointIncrementalInterval } if o.CheckpointCfg.GlobalMinCount <= 0 { o.CheckpointCfg.GlobalMinCount = DefaultCheckpointMinCount diff --git a/pkg/vm/engine/tae/options/types.go b/pkg/vm/engine/tae/options/types.go index 815a40a396437..0061857829f04 100644 --- a/pkg/vm/engine/tae/options/types.go +++ b/pkg/vm/engine/tae/options/types.go @@ -37,15 +37,16 @@ const ( DefaultBlockMaxRows = objectio.BlockMaxRows DefaultBlocksPerObject = uint16(256) - DefaultScannerInterval = time.Second * 5 - DefaultCheckpointFlushInterval = time.Minute - DefaultCheckpointTransferInterval = time.Second * 5 - DefaultCheckpointMinCount = int64(100) - DefaultCheckpointIncremetalInterval = time.Minute * 5 - DefaultCheckpointGlobalMinCount = 10 - DefaultGlobalVersionInterval = time.Hour - DefaultGCCheckpointInterval = time.Minute - DefaultOverallFlushMemControl = common.Const1GBytes + DefaultScannerInterval = time.Second * 5 + DefaultCheckpointFlushInterval = time.Minute + DefaultCheckpointTransferInterval = time.Second * 5 + DefaultCheckpointMinCount = int64(100) + DefaultCheckpointIncrementalInterval = time.Minute * 5 + DefaultCheckpointIncremetalInterval = DefaultCheckpointIncrementalInterval + DefaultCheckpointGlobalMinCount = 10 + DefaultGlobalVersionInterval = time.Hour + DefaultGCCheckpointInterval = time.Minute + DefaultOverallFlushMemControl = common.Const1GBytes DefaultScanGCInterval = time.Minute * 30 DefaultGCTTL = time.Hour From 2bec8fd5def29e230b7ffc27ab26ec5096446829 Mon Sep 17 00:00:00 2001 From: jiangxinmeng1 <51114574+jiangxinmeng1@users.noreply.github.com> Date: Fri, 3 Jul 2026 16:49:41 +0800 Subject: [PATCH 3/5] fix --- etc/launch-dynamic-cn/tn.toml | 2 +- etc/launch-dynamic-with-proxy/tn.toml | 2 +- etc/launch-minio-local/tn.toml | 2 +- etc/launch-multi-cn/tn.toml | 2 +- etc/launch-tae-compose/config/tn.toml | 2 +- etc/launch-with-proxy/tn.toml | 2 +- pkg/embed/template.go | 2 +- pkg/objectio/arena_pool.go | 15 ++++++++------- pkg/tnservice/cfg_test.go | 3 +++ pkg/vm/engine/tae/options/cfg_test.go | 5 +++++ 10 files changed, 23 insertions(+), 14 deletions(-) diff --git a/etc/launch-dynamic-cn/tn.toml b/etc/launch-dynamic-cn/tn.toml index 652e182738180..ecf24d1b7b04a 100644 --- a/etc/launch-dynamic-cn/tn.toml +++ b/etc/launch-dynamic-cn/tn.toml @@ -43,7 +43,7 @@ log-backend = "logservice" flush-interval = "60s" min-count = 100 scan-interval = "5s" -incremental-interval = "180s" +incremental-interval = "300s" global-min-count = 60 [tn.LogtailServer] diff --git a/etc/launch-dynamic-with-proxy/tn.toml b/etc/launch-dynamic-with-proxy/tn.toml index 652e182738180..ecf24d1b7b04a 100644 --- a/etc/launch-dynamic-with-proxy/tn.toml +++ b/etc/launch-dynamic-with-proxy/tn.toml @@ -43,7 +43,7 @@ log-backend = "logservice" flush-interval = "60s" min-count = 100 scan-interval = "5s" -incremental-interval = "180s" +incremental-interval = "300s" global-min-count = 60 [tn.LogtailServer] diff --git a/etc/launch-minio-local/tn.toml b/etc/launch-minio-local/tn.toml index 65fdbff27e59c..8bdfcaf6e6fec 100644 --- a/etc/launch-minio-local/tn.toml +++ b/etc/launch-minio-local/tn.toml @@ -58,7 +58,7 @@ log-backend = "logservice" flush-interval = "60s" min-count = 100 scan-interval = "5s" -incremental-interval = "180s" +incremental-interval = "300s" global-min-count = 60 [tn.LogtailServer] diff --git a/etc/launch-multi-cn/tn.toml b/etc/launch-multi-cn/tn.toml index 652e182738180..ecf24d1b7b04a 100644 --- a/etc/launch-multi-cn/tn.toml +++ b/etc/launch-multi-cn/tn.toml @@ -43,7 +43,7 @@ log-backend = "logservice" flush-interval = "60s" min-count = 100 scan-interval = "5s" -incremental-interval = "180s" +incremental-interval = "300s" global-min-count = 60 [tn.LogtailServer] diff --git a/etc/launch-tae-compose/config/tn.toml b/etc/launch-tae-compose/config/tn.toml index 6ea66b268fa42..172555190b8aa 100644 --- a/etc/launch-tae-compose/config/tn.toml +++ b/etc/launch-tae-compose/config/tn.toml @@ -55,7 +55,7 @@ log-backend = "logservice" flush-interval = "60s" min-count = 100 scan-interval = "5s" -incremental-interval = "180s" +incremental-interval = "300s" global-min-count = 60 [tn.LogtailServer] diff --git a/etc/launch-with-proxy/tn.toml b/etc/launch-with-proxy/tn.toml index 652e182738180..ecf24d1b7b04a 100644 --- a/etc/launch-with-proxy/tn.toml +++ b/etc/launch-with-proxy/tn.toml @@ -43,7 +43,7 @@ log-backend = "logservice" flush-interval = "60s" min-count = 100 scan-interval = "5s" -incremental-interval = "180s" +incremental-interval = "300s" global-min-count = 60 [tn.LogtailServer] diff --git a/pkg/embed/template.go b/pkg/embed/template.go index b37c61b32543b..18e132e4f8547 100644 --- a/pkg/embed/template.go +++ b/pkg/embed/template.go @@ -92,7 +92,7 @@ log-backend = "logservice" flush-interval = "60s" min-count = 100 scan-interval = "5s" -incremental-interval = "180s" +incremental-interval = "300s" global-min-count = 60 [tn.LogtailServer] diff --git a/pkg/objectio/arena_pool.go b/pkg/objectio/arena_pool.go index c3ed398b8c7eb..238dce004803f 100644 --- a/pkg/objectio/arena_pool.go +++ b/pkg/objectio/arena_pool.go @@ -128,10 +128,11 @@ func PutArena(a *WriteArena) { } // arenaDrainDelay is how long to wait after the last checkpoint before -// draining the arena pools. Using 2× the default incremental checkpoint -// interval ensures the timer is always reset during active operation, -// so pools stay warm. Draining only happens during genuine idle periods. -const arenaDrainDelay = 2 * time.Minute +// draining the arena pools. Using 2x the default incremental checkpoint +// interval (5 minutes) ensures the timer is always reset during active +// operation, so pools stay warm. Draining only happens during genuine +// idle periods. +const arenaDrainDelay = 10 * time.Minute var ( arenaDrainMu sync.Mutex @@ -139,9 +140,9 @@ var ( ) // ScheduleArenaDrain debounces arena pool draining. Each call resets the -// timer to arenaDrainDelay from now. During steady-state checkpointing -// (every ~60 s), the timer never fires and pools stay warm. Once -// activity ceases, the timer fires and RSS is reclaimed. +// timer to arenaDrainDelay from now. During steady-state checkpointing, +// the timer never fires and pools stay warm. Once activity ceases, the +// timer fires and RSS is reclaimed. func ScheduleArenaDrain() { arenaDrainMu.Lock() defer arenaDrainMu.Unlock() diff --git a/pkg/tnservice/cfg_test.go b/pkg/tnservice/cfg_test.go index 4bb99f81ce163..094b3fdb01420 100644 --- a/pkg/tnservice/cfg_test.go +++ b/pkg/tnservice/cfg_test.go @@ -17,6 +17,7 @@ package tnservice import ( "testing" + "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/options" "github.com/stretchr/testify/assert" ) @@ -33,10 +34,12 @@ func TestValidate(t *testing.T) { assert.Equal(t, defaultHeatbeatInterval, c.HAKeeper.HeatbeatInterval.Duration) assert.Equal(t, defaultHeatbeatTimeout, c.HAKeeper.HeatbeatTimeout.Duration) assert.Equal(t, defaultConnectTimeout, c.LogService.ConnectTimeout.Duration) + assert.Equal(t, options.DefaultCheckpointIncrementalInterval, c.Ckp.IncrementalInterval.Duration) assert.Equal(t, "true", c.Txn.IncrementalDedup) } func TestDefaulValue(t *testing.T) { c := Config{} c.SetDefaultValue() + assert.Equal(t, options.DefaultCheckpointIncrementalInterval, c.Ckp.IncrementalInterval.Duration) } diff --git a/pkg/vm/engine/tae/options/cfg_test.go b/pkg/vm/engine/tae/options/cfg_test.go index 02517e417b111..4f45dd3ed7478 100644 --- a/pkg/vm/engine/tae/options/cfg_test.go +++ b/pkg/vm/engine/tae/options/cfg_test.go @@ -30,3 +30,8 @@ func TestLogtailServerCfg(t *testing.T) { require.Equal(t, defaults.RPCStreamPoisonTime, validated.RPCStreamPoisonTime) require.Equal(t, defaults.PullWorkerPoolSize, validated.PullWorkerPoolSize) } + +func TestOptionsFillDefaultsCheckpointIncrementalInterval(t *testing.T) { + opts := new(Options).FillDefaults("") + require.Equal(t, DefaultCheckpointIncrementalInterval, opts.CheckpointCfg.IncrementalInterval) +} From 7719873ac80a66c32692f8b109ec5dbf3f8865dd Mon Sep 17 00:00:00 2001 From: jiangxinmeng1 <51114574+jiangxinmeng1@users.noreply.github.com> Date: Fri, 3 Jul 2026 16:52:10 +0800 Subject: [PATCH 4/5] test: cover checkpoint cfg incremental interval default --- pkg/vm/engine/tae/db/checkpoint/cfg_test.go | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pkg/vm/engine/tae/db/checkpoint/cfg_test.go diff --git a/pkg/vm/engine/tae/db/checkpoint/cfg_test.go b/pkg/vm/engine/tae/db/checkpoint/cfg_test.go new file mode 100644 index 0000000000000..7b6c9fbb2c3e3 --- /dev/null +++ b/pkg/vm/engine/tae/db/checkpoint/cfg_test.go @@ -0,0 +1,28 @@ +// Copyright 2021 Matrix Origin +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package checkpoint + +import ( + "testing" + + "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/options" + "github.com/stretchr/testify/require" +) + +func TestCheckpointCfgFillDefaultsIncrementalInterval(t *testing.T) { + cfg := new(CheckpointCfg) + cfg.FillDefaults() + require.Equal(t, options.DefaultCheckpointIncrementalInterval, cfg.IncrementalInterval) +} From 76d9555c1e7af22a611783e66fdc5c05aec586ed Mon Sep 17 00:00:00 2001 From: jiangxinmeng1 <51114574+jiangxinmeng1@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:30:17 +0800 Subject: [PATCH 5/5] chore: align docker local disk checkpoint interval --- etc/docker-multi-cn-local-disk/generate-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/docker-multi-cn-local-disk/generate-config.sh b/etc/docker-multi-cn-local-disk/generate-config.sh index 9b665fed773c3..3dca33f46f237 100755 --- a/etc/docker-multi-cn-local-disk/generate-config.sh +++ b/etc/docker-multi-cn-local-disk/generate-config.sh @@ -439,7 +439,7 @@ log-backend = "logservice" flush-interval = "60s" min-count = 100 scan-interval = "5s" -incremental-interval = "60s" +incremental-interval = "300s" global-interval = "100000s" EOF