mirror of https://github.com/milvus-io/milvus.git
parent
d0510210df
commit
826c1fb850
|
@ -643,11 +643,19 @@ func (s *LocalSegment) LoadField(rowCount int64, data *schemapb.FieldData) error
|
|||
return err
|
||||
}
|
||||
|
||||
var mmapDirPath *C.char = nil
|
||||
path := paramtable.Get().QueryNodeCfg.MmapDirPath.GetValue()
|
||||
if len(path) > 0 {
|
||||
mmapDirPath = C.CString(path)
|
||||
defer C.free(unsafe.Pointer(mmapDirPath))
|
||||
}
|
||||
|
||||
loadInfo := C.CLoadFieldDataInfo{
|
||||
field_id: C.int64_t(fieldID),
|
||||
blob: (*C.uint8_t)(unsafe.Pointer(&dataBlob[0])),
|
||||
blob_size: C.uint64_t(len(dataBlob)),
|
||||
row_count: C.int64_t(rowCount),
|
||||
field_id: C.int64_t(fieldID),
|
||||
blob: (*C.uint8_t)(unsafe.Pointer(&dataBlob[0])),
|
||||
blob_size: C.uint64_t(len(dataBlob)),
|
||||
row_count: C.int64_t(rowCount),
|
||||
mmap_dir_path: mmapDirPath,
|
||||
}
|
||||
|
||||
status := C.LoadFieldData(s.ptr, loadInfo)
|
||||
|
|
|
@ -323,6 +323,33 @@ func (suite *SegmentLoaderSuite) TestLoadDeltaLogs() {
|
|||
}
|
||||
}
|
||||
|
||||
func (suite *SegmentLoaderSuite) TestLoadWithMmap() {
|
||||
key := paramtable.Get().QueryNodeCfg.MmapDirPath.Key
|
||||
paramtable.Get().Save(key, "/tmp/mmap-test")
|
||||
defer paramtable.Get().Reset(key)
|
||||
ctx := context.Background()
|
||||
|
||||
// Load sealed
|
||||
binlogs, statsLogs, err := SaveBinLog(ctx,
|
||||
suite.collectionID,
|
||||
suite.partitionID,
|
||||
suite.segmentID,
|
||||
100,
|
||||
suite.schema,
|
||||
suite.chunkManager,
|
||||
)
|
||||
suite.NoError(err)
|
||||
|
||||
_, err = suite.loader.Load(ctx, suite.collectionID, SegmentTypeSealed, 0, &querypb.SegmentLoadInfo{
|
||||
SegmentID: suite.segmentID,
|
||||
PartitionID: suite.partitionID,
|
||||
CollectionID: suite.collectionID,
|
||||
BinlogPaths: binlogs,
|
||||
Statslogs: statsLogs,
|
||||
})
|
||||
suite.NoError(err)
|
||||
}
|
||||
|
||||
func TestSegmentLoader(t *testing.T) {
|
||||
suite.Run(t, &SegmentLoaderSuite{})
|
||||
}
|
||||
|
|
|
@ -202,6 +202,11 @@ func (node *QueryNode) InitSegcore() {
|
|||
C.InitCpuNum(cCPUNum)
|
||||
|
||||
initcore.InitLocalStorageConfig(paramtable.Get())
|
||||
|
||||
mmapDirPath := paramtable.Get().QueryNodeCfg.MmapDirPath.GetValue()
|
||||
if len(mmapDirPath) > 0 {
|
||||
log.Info("mmap enabled", zap.String("dir", mmapDirPath))
|
||||
}
|
||||
}
|
||||
|
||||
// Init function init historical and streaming module to manage segments
|
||||
|
|
Loading…
Reference in New Issue