@@ -511,10 +511,11 @@ bool JsonParser::parse() {
511
511
size_t file_split_number{0ULL };
512
512
int32_t log_event_idx_node_id{};
513
513
auto initialize_fields_for_archive = [&]() -> bool {
514
- if (m_record_log_order) {
515
- log_event_idx_node_id
516
- = add_metadata_field (constants::cLogEventIdxName, NodeType::DeltaInteger);
514
+ if (false == m_record_log_order) {
515
+ return true ;
517
516
}
517
+ log_event_idx_node_id
518
+ = add_metadata_field (constants::cLogEventIdxName, NodeType::DeltaInteger);
518
519
if (auto const rc = m_archive_writer->add_field_to_current_range (
519
520
std::string{constants::range_index::cFilename},
520
521
path.path
@@ -657,10 +658,12 @@ bool JsonParser::parse() {
657
658
return false ;
658
659
}
659
660
660
- if (auto const rc = m_archive_writer->close_current_range (); ErrorCodeSuccess != rc) {
661
- SPDLOG_ERROR (" Failed to close metadata range: {}" , static_cast <int64_t >(rc));
662
- std::ignore = m_archive_writer->close ();
663
- return false ;
661
+ if (m_record_log_order) {
662
+ if (auto const rc = m_archive_writer->close_current_range (); ErrorCodeSuccess != rc) {
663
+ SPDLOG_ERROR (" Failed to close metadata range: {}" , static_cast <int64_t >(rc));
664
+ std::ignore = m_archive_writer->close ();
665
+ return false ;
666
+ }
664
667
}
665
668
}
666
669
return true ;
@@ -980,10 +983,11 @@ auto JsonParser::parse_from_ir() -> bool {
980
983
size_t file_split_number{0ULL };
981
984
int32_t log_event_idx_node_id{};
982
985
auto initialize_fields_for_archive = [&]() -> bool {
983
- if (m_record_log_order) {
984
- log_event_idx_node_id
985
- = add_metadata_field (constants::cLogEventIdxName, NodeType::DeltaInteger);
986
+ if (false == m_record_log_order) {
987
+ return true ;
986
988
}
989
+ log_event_idx_node_id
990
+ = add_metadata_field (constants::cLogEventIdxName, NodeType::DeltaInteger);
987
991
if (auto const rc = m_archive_writer->add_field_to_current_range (
988
992
std::string{constants::range_index::cFilename},
989
993
path.path
@@ -1138,10 +1142,13 @@ auto JsonParser::parse_from_ir() -> bool {
1138
1142
curr_pos = decompressor.get_pos ();
1139
1143
m_archive_writer->increment_uncompressed_size (curr_pos - last_pos);
1140
1144
decompressor.close ();
1141
- if (auto const rc = m_archive_writer->close_current_range (); ErrorCodeSuccess != rc) {
1142
- SPDLOG_ERROR (" Failed to close metadata range: {}" , static_cast <int64_t >(rc));
1143
- std::ignore = m_archive_writer->close ();
1144
- return false ;
1145
+
1146
+ if (m_record_log_order) {
1147
+ if (auto const rc = m_archive_writer->close_current_range (); ErrorCodeSuccess != rc) {
1148
+ SPDLOG_ERROR (" Failed to close metadata range: {}" , static_cast <int64_t >(rc));
1149
+ std::ignore = m_archive_writer->close ();
1150
+ return false ;
1151
+ }
1145
1152
}
1146
1153
}
1147
1154
return true ;
0 commit comments