From 801d500fd443374ab04e2dc9708dd4100bea3000 Mon Sep 17 00:00:00 2001 From: Wenbin1002 Date: Tue, 2 Jul 2024 10:55:17 +0800 Subject: [PATCH] transfer page ut #16953 --- pkg/vm/engine/tae/db/test/db_test.go | 5 +++-- pkg/vm/engine/tae/tables/txnentries/flushTableTail.go | 8 ++------ pkg/vm/engine/tae/tables/txnentries/mergeobjects.go | 8 ++------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/pkg/vm/engine/tae/db/test/db_test.go b/pkg/vm/engine/tae/db/test/db_test.go index 6005e18b31c5..34760333f1c3 100644 --- a/pkg/vm/engine/tae/db/test/db_test.go +++ b/pkg/vm/engine/tae/db/test/db_test.go @@ -17,6 +17,7 @@ package test import ( "bytes" "context" + "errors" "fmt" "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/model" "math/rand" @@ -9136,8 +9137,8 @@ func TestClearPersistTransferTable(t *testing.T) { page.SetLocation(location) - tae.Runtime.TransferTable.RunTTL() time.Sleep(2 * time.Second) + tae.Runtime.TransferTable.RunTTL() _, err = tae.Runtime.TransferTable.Pin(*page.ID()) - assert.Equal(t, err, moerr.GetOkExpectedEOB()) + assert.True(t, errors.Is(err, moerr.GetOkExpectedEOB())) } diff --git a/pkg/vm/engine/tae/tables/txnentries/flushTableTail.go b/pkg/vm/engine/tae/tables/txnentries/flushTableTail.go index 3989ab2967df..12d455b97d5f 100644 --- a/pkg/vm/engine/tae/tables/txnentries/flushTableTail.go +++ b/pkg/vm/engine/tae/tables/txnentries/flushTableTail.go @@ -138,12 +138,8 @@ func (entry *flushTableTailEntry) addTransferPages() { } id := entry.ablksHandles[i].Fingerprint() entry.pageIds = append(entry.pageIds, id) - if model.RD == nil { - model.SetBlockRead(blockio.NewBlockRead()) - } - if model.FS == nil { - model.SetFileService(entry.rt.Fs.Service) - } + model.SetBlockRead(blockio.NewBlockRead()) + model.SetFileService(entry.rt.Fs.Service) page := model.NewTransferHashPage(id, time.Now(), len(m), isTransient) for srcRow, dst := range m { blkid := objectio.NewBlockidWithObjectID(entry.createdBlkHandles.GetID(), uint16(dst.BlkIdx)) diff --git a/pkg/vm/engine/tae/tables/txnentries/mergeobjects.go b/pkg/vm/engine/tae/tables/txnentries/mergeobjects.go index 70e063a547f4..bc113d1c5b72 100644 --- a/pkg/vm/engine/tae/tables/txnentries/mergeobjects.go +++ b/pkg/vm/engine/tae/tables/txnentries/mergeobjects.go @@ -112,12 +112,8 @@ func (entry *mergeObjectsEntry) prepareTransferPage() { isTransient := !tblEntry.GetLastestSchema().HasPK() id := obj.AsCommonID() id.SetBlockOffset(uint16(j)) - if model.RD == nil { - model.SetBlockRead(blockio.NewBlockRead()) - } - if model.FS == nil { - model.SetFileService(entry.rt.Fs.Service) - } + model.SetBlockRead(blockio.NewBlockRead()) + model.SetFileService(entry.rt.Fs.Service) page := model.NewTransferHashPage(id, time.Now(), len(m), isTransient) for srcRow, dst := range m { objID := entry.createdObjs[dst.ObjIdx].ID