Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: Use mmap.scalarIndex config for text index #36400

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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 internal/core/src/common/type_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ typedef struct CMmapConfig {
uint64_t disk_limit;
uint64_t fix_file_size;
bool growing_enable_mmap;
bool enable_mmap;
bool scalar_index_enable_mmap;
} CMmapConfig;

typedef struct CTraceConfig {
Expand Down
2 changes: 1 addition & 1 deletion internal/core/src/segcore/SegmentSealedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@
const auto& field_meta = schema_->operator[](field_id);
auto& cfg = storage::MmapManager::GetInstance().GetMmapConfig();
std::unique_ptr<index::TextMatchIndex> index;
if (!cfg.GetEnableMmap()) {
if (!cfg.GetScalarIndexEnableMmap()) {

Check warning on line 2034 in internal/core/src/segcore/SegmentSealedImpl.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/segcore/SegmentSealedImpl.cpp#L2034

Added line #L2034 was not covered by tests
// build text index in ram.
index = std::make_unique<index::TextMatchIndex>(
std::numeric_limits<int64_t>::max(),
Expand Down
13 changes: 7 additions & 6 deletions internal/core/src/storage/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
uint64_t disk_limit;
uint64_t fix_file_size;
bool growing_enable_mmap;
bool enable_mmap;
bool scalar_index_enable_mmap;
bool
GetEnableGrowingMmap() const {
return growing_enable_mmap;
Expand All @@ -135,12 +135,12 @@
this->growing_enable_mmap = flag;
}
bool
GetEnableMmap() const {
return enable_mmap;
GetScalarIndexEnableMmap() const {
return scalar_index_enable_mmap;

Check warning on line 139 in internal/core/src/storage/Types.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/Types.h#L138-L139

Added lines #L138 - L139 were not covered by tests
}
void
SetEnableMmap(bool flag) {
this->enable_mmap = flag;
SetScalarIndexEnableMmap(bool flag) {
this->scalar_index_enable_mmap = flag;
}
std::string
GetMmapPath() {
Expand All @@ -154,7 +154,8 @@
<< ", disk_limit=" << disk_limit / (1024 * 1024) << "MB"
<< ", fix_file_size=" << fix_file_size / (1024 * 1024) << "MB"
<< ", growing_enable_mmap=" << std::boolalpha << growing_enable_mmap
<< ", enable_mmap=" << std::boolalpha << enable_mmap << "]";
<< ", scalar_index_enable_mmap=" << std::boolalpha
<< scalar_index_enable_mmap << "]";
return ss.str();
}
};
Expand Down
3 changes: 2 additions & 1 deletion internal/core/src/storage/storage_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
mmap_config.disk_limit = c_mmap_config.disk_limit;
mmap_config.fix_file_size = c_mmap_config.fix_file_size;
mmap_config.growing_enable_mmap = c_mmap_config.growing_enable_mmap;
mmap_config.enable_mmap = c_mmap_config.enable_mmap;
mmap_config.scalar_index_enable_mmap =
c_mmap_config.scalar_index_enable_mmap;

Check warning on line 99 in internal/core/src/storage/storage_c.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/storage_c.cpp#L98-L99

Added lines #L98 - L99 were not covered by tests
milvus::storage::MmapManager::GetInstance().Init(mmap_config);
return milvus::SuccessCStatus();
} catch (std::exception& e) {
Expand Down
12 changes: 6 additions & 6 deletions internal/util/initcore/init_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ func InitMmapManager(params *paramtable.ComponentParam) error {
diskLimit := uint64(float64(params.QueryNodeCfg.MaxMmapDiskPercentageForMmapManager.GetAsUint64()*diskCapacity) * 0.01)
mmapFileSize := params.QueryNodeCfg.FixedFileSizeForMmapManager.GetAsFloat() * 1024 * 1024
mmapConfig := C.CMmapConfig{
cache_read_ahead_policy: cCacheReadAheadPolicy,
mmap_path: cMmapChunkManagerDir,
disk_limit: C.uint64_t(diskLimit),
fix_file_size: C.uint64_t(mmapFileSize),
growing_enable_mmap: C.bool(params.QueryNodeCfg.GrowingMmapEnabled.GetAsBool()),
enable_mmap: C.bool(params.QueryNodeCfg.MmapEnabled.GetAsBool()),
cache_read_ahead_policy: cCacheReadAheadPolicy,
mmap_path: cMmapChunkManagerDir,
disk_limit: C.uint64_t(diskLimit),
fix_file_size: C.uint64_t(mmapFileSize),
growing_enable_mmap: C.bool(params.QueryNodeCfg.GrowingMmapEnabled.GetAsBool()),
scalar_index_enable_mmap: C.bool(params.QueryNodeCfg.MmapScalarIndex.GetAsBool()),
}
status := C.InitMmapManager(mmapConfig)
return HandleCStatus(&status, "InitMmapManager failed")
Expand Down
Loading