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: Remove map directory after release #39116

Open
wants to merge 1 commit 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
9 changes: 9 additions & 0 deletions internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "query/SearchBruteForce.h"
#include "query/SearchOnSealed.h"
#include "storage/DataCodec.h"
#include "storage/LocalChunkManagerSingleton.h"
#include "storage/Util.h"
#include "storage/ThreadPools.h"
#include "storage/MmapManager.h"
Expand Down Expand Up @@ -523,6 +524,8 @@
auto dir = filepath.parent_path();
std::filesystem::create_directories(dir);

map_dir_path_ = dir.string();

Check warning on line 527 in internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp#L527

Added line #L527 was not covered by tests

auto file = File::Open(filepath.string(), O_CREAT | O_TRUNC | O_RDWR);

auto& field_meta = (*schema_)[field_id];
Expand Down Expand Up @@ -1315,6 +1318,12 @@
auto mm = storage::MmapManager::GetInstance().GetMmapChunkManager();
mm->UnRegister(mmap_descriptor_);
}

if (!map_dir_path_.empty()) {
storage::LocalChunkManagerSingleton::GetInstance()
.GetChunkManager()
->RemoveDir(map_dir_path_);

Check warning on line 1325 in internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp#L1323-L1325

Added lines #L1323 - L1325 were not covered by tests
}
}

void
Expand Down
1 change: 1 addition & 0 deletions internal/core/src/segcore/ChunkedSegmentSealedImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ class ChunkedSegmentSealedImpl : public SegmentSealed {

// whether the segment is sorted by the pk
bool is_sorted_by_pk_ = false;
std::string map_dir_path_;
};

} // namespace milvus::segcore
Loading