Skip to content

Commit

Permalink
update 2
Browse files Browse the repository at this point in the history
  • Loading branch information
XuPeng-SH committed Feb 20, 2025
1 parent 6d012a1 commit 1dab786
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 11 deletions.
9 changes: 2 additions & 7 deletions pkg/vm/engine/tae/db/test/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import (
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/handle"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/txnif"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/logstore/driver"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/logstore/driver/logservicedriver"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/logstore/wal"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/logtail"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/mergesort"
Expand Down Expand Up @@ -11549,15 +11548,11 @@ func Test_Controller2(t *testing.T) {
}

func Test_RWDB1(t *testing.T) {
_, clientFactory := logservicedriver.NewMockServiceAndClientFactory()
ctx := context.Background()
wOpts := config.WithLongScanAndCKPOpts(nil)
wOpts.WalClientFactory = clientFactory
wOpts := config.WithLongScanAndCKPOpts(nil, options.WithWalClientFactory(nil))
wTae := testutil.NewTestEngine(ctx, ModuleName, t, wOpts)
defer wTae.Close()
rOpts := config.WithLongScanAndCKPOpts(nil)
rOpts.WalClientFactory = clientFactory

rOpts := config.WithLongScanAndCKPOpts(nil, options.WithWalClientFactory(wOpts.WalClientFactory))
rTae := testutil.NewReplayTestEngine(ctx, ModuleName, t, rOpts)

i := 0
Expand Down
10 changes: 10 additions & 0 deletions pkg/vm/engine/tae/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/objectio"
"github.com/matrixorigin/matrixone/pkg/txn/clock"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/logstore/driver/logservicedriver"
)

func WithTransferTableTTL(ttl time.Duration) func(*Options) {
Expand All @@ -33,6 +34,15 @@ func WithTransferTableTTL(ttl time.Duration) func(*Options) {
}
}

func WithWalClientFactory(factory logservicedriver.LogServiceClientFactory) func(*Options) {
return func(opts *Options) {
opts.WalClientFactory = factory
if opts.WalClientFactory == nil {
_, opts.WalClientFactory = logservicedriver.NewMockServiceAndClientFactory()
}
}
}

func WithCheckpointMinCount(count int64) func(*Options) {
return func(opts *Options) {
if opts.CheckpointCfg == nil {
Expand Down
32 changes: 28 additions & 4 deletions pkg/vm/engine/tae/testutils/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ func WithQuickScanAndCKPOpts2(in *options.Options, factor int) (opts *options.Op
return opts
}

func WithQuickScanAndCKPOpts(in *options.Options) (opts *options.Options) {
func WithQuickScanAndCKPOpts(
in *options.Options,
ops ...func(*options.Options),
) (opts *options.Options) {
if in == nil {
opts = new(options.Options)
} else {
Expand All @@ -56,10 +59,16 @@ func WithQuickScanAndCKPOpts(in *options.Options) (opts *options.Options) {
opts.CatalogCfg = new(options.CatalogCfg)
opts.CatalogCfg.GCInterval = time.Millisecond * 1
opts.Ctx = context.Background()
for _, op := range ops {
op(opts)
}
return opts
}

func WithQuickScanAndCKPAndGCOpts(in *options.Options) (opts *options.Options) {
func WithQuickScanAndCKPAndGCOpts(
in *options.Options,
ops ...func(*options.Options),
) (opts *options.Options) {
if in == nil {
opts = new(options.Options)
} else {
Expand All @@ -81,10 +90,16 @@ func WithQuickScanAndCKPAndGCOpts(in *options.Options) (opts *options.Options) {
opts.GCCfg.GCTTL = time.Millisecond * 1
opts.GCCfg.GCDeleteBatchSize = 2
opts.Ctx = context.Background()
for _, op := range ops {
op(opts)
}
return opts
}

func WithLongScanAndCKPOpts(in *options.Options) (opts *options.Options) {
func WithLongScanAndCKPOpts(
in *options.Options,
ops ...func(*options.Options),
) (opts *options.Options) {
if in == nil {
opts = new(options.Options)
} else {
Expand All @@ -97,10 +112,16 @@ func WithLongScanAndCKPOpts(in *options.Options) (opts *options.Options) {
opts.CheckpointCfg.GlobalMinCount = 10000000
opts.CheckpointCfg.BlockRows = 10
opts.Ctx = context.Background()
for _, option := range ops {
option(opts)
}
return opts
}

func WithLongScanAndCKPOptsAndQuickGC(in *options.Options) (opts *options.Options) {
func WithLongScanAndCKPOptsAndQuickGC(
in *options.Options,
ops ...func(*options.Options),
) (opts *options.Options) {
if in == nil {
opts = new(options.Options)
} else {
Expand All @@ -117,5 +138,8 @@ func WithLongScanAndCKPOptsAndQuickGC(in *options.Options) (opts *options.Option
opts.GCCfg.GCTTL = time.Millisecond * 1
opts.GCCfg.GCDeleteBatchSize = 2
opts.Ctx = context.Background()
for _, option := range ops {
option(opts)
}
return opts
}

0 comments on commit 1dab786

Please sign in to comment.