Skip to content
Merged
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
23 changes: 3 additions & 20 deletions be/src/io/fs/packed_file_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ Status PackedFileManager::append_small_file(const std::string& path, const Slice
location.packed_file_path = active_state->packed_file_path;
location.offset = active_state->current_offset;
location.size = data.get_size();
location.create_time = std::time(nullptr);
location.tablet_id = info.tablet_id;
location.rowset_id = info.rowset_id;
location.resource_id = info.resource_id;
Expand Down Expand Up @@ -809,30 +810,12 @@ void PackedFileManager::cleanup_expired_data() {

// Clean up expired global index entries
{
std::unordered_set<std::string> active_packed_files;
{
std::lock_guard<std::timed_mutex> current_lock(_current_packed_file_mutex);
for (const auto& [resource_id, state] : _current_packed_files) {
if (state) {
active_packed_files.insert(state->packed_file_path);
}
}
}
{
std::lock_guard<std::mutex> merge_lock(_packed_files_mutex);
for (const auto& [path, state] : _uploading_packed_files) {
active_packed_files.insert(path);
}
for (const auto& [path, state] : _uploaded_packed_files) {
active_packed_files.insert(path);
}
}

std::lock_guard<std::mutex> global_lock(_global_index_mutex);
auto it = _global_slice_locations.begin();
while (it != _global_slice_locations.end()) {
const auto& index = it->second;
if (active_packed_files.find(index.packed_file_path) == active_packed_files.end()) {
if (index.create_time > 0 &&
current_time - index.create_time > config::uploaded_file_retention_seconds) {
it = _global_slice_locations.erase(it);
} else {
++it;
Expand Down
1 change: 1 addition & 0 deletions be/src/io/fs/packed_file_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct PackedSliceLocation {
std::string packed_file_path;
int64_t offset;
int64_t size;
int64_t create_time = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming creation_time

int64_t tablet_id = 0;
std::string rowset_id;
std::string resource_id;
Expand Down
Loading