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

clp-s: Ensure ArchiveWriterOption is fully initialized when splitting archives. #462

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 6 additions & 3 deletions components/core/src/clp_s/JsonParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ JsonParser::JsonParser(JsonParserOption const& option)
m_target_encoded_size(option.target_encoded_size),
m_max_document_size(option.max_document_size),
m_timestamp_key(option.timestamp_key),
m_structurize_arrays(option.structurize_arrays) {
m_structurize_arrays(option.structurize_arrays),
m_print_archive_stats(option.print_archive_stats) {
if (false == FileUtils::validate_path(option.file_paths)) {
exit(1);
}
Expand All @@ -30,11 +31,12 @@ JsonParser::JsonParser(JsonParserOption const& option)
FileUtils::find_all_files(file_path, m_file_paths);
}

ArchiveWriterOption archive_writer_option;
ArchiveWriterOption archive_writer_option{};
archive_writer_option.archives_dir = m_archives_dir;
archive_writer_option.id = m_generator();
archive_writer_option.compression_level = option.compression_level;
archive_writer_option.print_archive_stats = option.print_archive_stats;
archive_writer_option.print_archive_stats = m_print_archive_stats;
gibber9809 marked this conversation as resolved.
Show resolved Hide resolved

m_archive_writer = std::make_unique<ArchiveWriter>(option.metadata_db);
m_archive_writer->open(archive_writer_option);
Expand Down Expand Up @@ -506,10 +508,11 @@ void JsonParser::store() {
void JsonParser::split_archive() {
m_archive_writer->close();

ArchiveWriterOption archive_writer_option;
ArchiveWriterOption archive_writer_option{};
archive_writer_option.archives_dir = m_archives_dir;
archive_writer_option.id = m_generator();
archive_writer_option.compression_level = m_compression_level;
archive_writer_option.print_archive_stats = m_print_archive_stats;

m_archive_writer->open(archive_writer_option);
}
Expand Down
1 change: 1 addition & 0 deletions components/core/src/clp_s/JsonParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class JsonParser {
size_t m_target_encoded_size;
size_t m_max_document_size;
bool m_structurize_arrays{false};
bool m_print_archive_stats{false};
};
} // namespace clp_s

Expand Down
Loading