Skip to content

Commit 3bbd3e9

Browse files
authored
fix(clp-s)!: Do not record the archive range index when log-ordering is disabled. (#1026)
1 parent 0635a2f commit 3bbd3e9

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

components/core/src/clp_s/CommandLineArguments.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) {
258258
)(
259259
"disable-log-order",
260260
po::bool_switch(&m_disable_log_order),
261-
"Do not record log order at ingestion time."
261+
"Do not record log order at ingestion time; Do not record the archive range"
262+
" index."
262263
)(
263264
"file-type",
264265
po::value<std::string>(&file_type)->value_name("FILE_TYPE")->default_value(file_type),

components/core/src/clp_s/JsonParser.cpp

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,11 @@ bool JsonParser::parse() {
511511
size_t file_split_number{0ULL};
512512
int32_t log_event_idx_node_id{};
513513
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;
517516
}
517+
log_event_idx_node_id
518+
= add_metadata_field(constants::cLogEventIdxName, NodeType::DeltaInteger);
518519
if (auto const rc = m_archive_writer->add_field_to_current_range(
519520
std::string{constants::range_index::cFilename},
520521
path.path
@@ -657,10 +658,12 @@ bool JsonParser::parse() {
657658
return false;
658659
}
659660

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+
}
664667
}
665668
}
666669
return true;
@@ -980,10 +983,11 @@ auto JsonParser::parse_from_ir() -> bool {
980983
size_t file_split_number{0ULL};
981984
int32_t log_event_idx_node_id{};
982985
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;
986988
}
989+
log_event_idx_node_id
990+
= add_metadata_field(constants::cLogEventIdxName, NodeType::DeltaInteger);
987991
if (auto const rc = m_archive_writer->add_field_to_current_range(
988992
std::string{constants::range_index::cFilename},
989993
path.path
@@ -1138,10 +1142,13 @@ auto JsonParser::parse_from_ir() -> bool {
11381142
curr_pos = decompressor.get_pos();
11391143
m_archive_writer->increment_uncompressed_size(curr_pos - last_pos);
11401144
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+
}
11451152
}
11461153
}
11471154
return true;

0 commit comments

Comments
 (0)