Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion etc/docker-multi-cn-local-disk/generate-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion etc/launch-dynamic-cn/tn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion etc/launch-dynamic-with-proxy/tn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion etc/launch-minio-local/tn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion etc/launch-multi-cn/tn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion etc/launch-tae-compose/config/tn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion etc/launch-with-proxy/tn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion pkg/embed/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
15 changes: 8 additions & 7 deletions pkg/objectio/arena_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,21 @@ 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
arenaDrainTimer *time.Timer
)

// 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()
Expand Down
6 changes: 3 additions & 3 deletions pkg/tnservice/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -50,7 +51,6 @@ var (

defaultFlushInterval = time.Second * 60
defaultScanInterval = time.Second * 5
defaultIncrementalInterval = time.Minute
defaultGlobalMinCount = int64(40)
defaultMinCount = int64(100)
defaultReservedWALEntryCount = uint64(5000)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pkg/tnservice/cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package tnservice
import (
"testing"

"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/options"
"github.com/stretchr/testify/assert"
)

Expand All @@ -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)
}
3 changes: 2 additions & 1 deletion pkg/vm/engine/tae/db/checkpoint/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -57,7 +58,7 @@ func (cfg CheckpointCfg) String() string {

func (cfg *CheckpointCfg) FillDefaults() {
if cfg.IncrementalInterval <= 0 {
cfg.IncrementalInterval = time.Minute
cfg.IncrementalInterval = options.DefaultCheckpointIncrementalInterval
}
if cfg.MinCount <= 0 {
cfg.MinCount = 10000
Expand Down
28 changes: 28 additions & 0 deletions pkg/vm/engine/tae/db/checkpoint/cfg_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
5 changes: 5 additions & 0 deletions pkg/vm/engine/tae/options/cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion pkg/vm/engine/tae/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions pkg/vm/engine/tae/options/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Expand Down
Loading