Skip to content

Commit

Permalink
haiqi review
Browse files Browse the repository at this point in the history
  • Loading branch information
davemarco committed Feb 6, 2025
1 parent 48b0779 commit 846062b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions components/core/src/clp/streaming_archive/writer/Archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ void Archive::close() {
update_global_metadata();
m_global_metadata_db = nullptr;

for (auto* file : m_files_written) {
for (auto* file : m_file_metadata_for_global_update) {
delete file;
}
m_files_written.clear();
m_file_metadata_for_global_update.clear();

m_metadata_db.close();

Expand Down Expand Up @@ -593,7 +593,7 @@ void Archive::close_segment_and_persist_file_metadata(

for (auto file : files) {
file->mark_as_in_committed_segment();
m_files_written.emplace_back(file);
m_file_metadata_for_global_update.emplace_back(file);
}

persist_file_metadata(files);
Expand Down Expand Up @@ -647,7 +647,7 @@ auto Archive::update_global_metadata() -> void {
throw OperationFailed(ErrorCode_Failure, __FILENAME__, __LINE__);
}
m_global_metadata_db->add_archive(m_id_as_string, m_local_metadata.value());
m_global_metadata_db->update_metadata_for_files(m_id_as_string, m_files_written);
m_global_metadata_db->update_metadata_for_files(m_id_as_string, m_file_metadata_for_global_update);
m_global_metadata_db->close();
}

Expand Down
7 changes: 4 additions & 3 deletions components/core/src/clp/streaming_archive/writer/Archive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,10 @@ class Archive {
std::vector<File*> m_files_with_timestamps_in_segment;
std::vector<File*> m_files_without_timestamps_in_segment;

// Data for all files in this collection has been deallocated, and should only
// contain metadata.
std::vector<File*> m_files_written;
// Files in this collection only hold metadata. Files are added to this collection after
// `File::append_to_segment()` is called, which deallocates memory for timestamp,
// logtype, and variable fields.
std::vector<File*> m_file_metadata_for_global_update;

size_t m_target_segment_uncompressed_size;
Segment m_segment_for_files_with_timestamps;
Expand Down

0 comments on commit 846062b

Please sign in to comment.