Skip to content

Commit

Permalink
make BlockRead a singleton matrixorigin#16953
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenbin1002 committed Jun 24, 2024
1 parent ed3b716 commit d94f4fb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/vm/engine/tae/blockio/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package blockio
import (
"context"
"math"
"sync"
"time"

"github.com/matrixorigin/matrixone/pkg/common/mpool"
Expand Down Expand Up @@ -676,11 +677,19 @@ func FindIntervalForBlock(rowids []types.Rowid, id *types.Blockid) (start int, e

type BlockReadImpl struct{}

var (
instance *BlockReadImpl
once sync.Once
)

func (blk *BlockReadImpl) LoadTableByBlock(loc objectio.Location, fs fileservice.FileService) (bat *batch.Batch, release func(), err error) {
bat, release, err = LoadTombstoneColumns(context.Background(), []uint16{0}, nil, fs, loc, nil)
return bat, release, err
}

func NewBlockRead() *BlockReadImpl {
return &BlockReadImpl{}
once.Do(func() {
instance = &BlockReadImpl{}
})
return instance
}

0 comments on commit d94f4fb

Please sign in to comment.