Skip to content

Commit

Permalink
Don't set timestamp format when splitting a timestamp-less file (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davemarco authored Jan 20, 2024
1 parent 776fc3a commit 65e64f4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions components/core/src/clp/streaming_archive/writer/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ auto split_file(
Archive& archive_writer
) -> void {
auto const& encoded_file = archive_writer.get_file();
auto has_ts_pattern = encoded_file.has_ts_pattern();
auto orig_file_id = encoded_file.get_orig_file_id();
auto split_ix = encoded_file.get_split_ix();
archive_writer.set_file_is_split(true);
close_file_and_append_to_segment(archive_writer);

archive_writer.create_and_open_file(path_for_compression, group_id, orig_file_id, ++split_ix);
// Initialize the file's timestamp pattern to the previous split's pattern
archive_writer.change_ts_pattern(last_timestamp_pattern);
if (has_ts_pattern) {
// Initialize the file's timestamp pattern to the previous split's pattern
archive_writer.change_ts_pattern(last_timestamp_pattern);
}
}

auto split_file_and_archive(
Expand All @@ -43,6 +46,7 @@ auto split_file_and_archive(
Archive& archive_writer
) -> void {
auto const& encoded_file = archive_writer.get_file();
auto has_ts_pattern = encoded_file.has_ts_pattern();
auto orig_file_id = encoded_file.get_orig_file_id();
auto split_ix = encoded_file.get_split_ix();
archive_writer.set_file_is_split(true);
Expand All @@ -51,8 +55,10 @@ auto split_file_and_archive(
split_archive(archive_user_config, archive_writer);

archive_writer.create_and_open_file(path_for_compression, group_id, orig_file_id, ++split_ix);
// Initialize the file's timestamp pattern to the previous split's pattern
archive_writer.change_ts_pattern(last_timestamp_pattern);
if (has_ts_pattern) {
// Initialize the file's timestamp pattern to the previous split's pattern
archive_writer.change_ts_pattern(last_timestamp_pattern);
}
}

auto close_file_and_append_to_segment(Archive& archive_writer) -> void {
Expand Down

0 comments on commit 65e64f4

Please sign in to comment.