Fix logfile sorting to not count boots with no time
We were getting:
Check failed: update_count <= node_state.second.boots.size() (3 vs. 2) : Found a cyclic boot graph, giving up.
*** Check failure stack trace: ***
@ 0x7de81f google::LogMessageFatal::~LogMessageFatal()
@ 0x471abd aos::logger::PartsSorter::ComputeBootCounts()
@ 0x471e36 aos::logger::PartsSorter::FormatNewParts()
...
Digging in, we had max_time in one direction, and were sorting against
that. This was creating a loop. This was coming from the reverse
direction (local -> remote, inside reverse_boot_times) instead of the
normal forward direction.
Sorted destination times: 797d1d0c-efc4-488e-a01f-48c2d7021b80 time {.oldest_remote_monotonic_timestamp=35.215496928sec, .oldest_local_monotonic_timestamp=13.030295776sec, .oldest_remote_unreliable_monotonic_timestamp=35.215496928sec, .oldest_local_unreliable_monotonic_timestamp=13.030295776sec}
Sorted destination times: f592a7d0-bbca-4036-9a5a-cc2d070b50ba time {.oldest_remote_monotonic_timestamp=9223372036.854775807sec, .oldest_local_monotonic_timestamp=9223372036.854775807sec, .oldest_remote_unreliable_monotonic_timestamp=9223372036.854775807sec, .oldest_local_unreliable_monotonic_timestamp=9223372036.854775807sec}
Since this data adds no value, both CHECK for it, and don't use it for
sorting. We have plenty of protections against orphaned nodes in the
graph, and adding a lie to the sorting graph is counterproductive.
Change-Id: I3477b3baf69f133e3fc8893e8bb6103ab30e2a97
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/events/logging/logfile_sorting.cc b/aos/events/logging/logfile_sorting.cc
index 1e7c817..a506850 100644
--- a/aos/events/logging/logfile_sorting.cc
+++ b/aos/events/logging/logfile_sorting.cc
@@ -1037,6 +1037,13 @@
next_boot_time.oldest_local_unreliable_monotonic_timestamp;
}
}
+
+ // Skip anything without a time in it.
+ if (boot_time.oldest_remote_unreliable_monotonic_timestamp ==
+ aos::monotonic_clock::max_time) {
+ continue;
+ }
+
source_boot_times.emplace_back(
std::make_tuple(boot_time_list.first, boot_time, max_boot_time));
@@ -1214,6 +1221,9 @@
std::vector<std::pair<std::string, BootPairTimes>>
destination_boot_times;
for (const auto &source_boot_uuid : source_node.second) {
+ CHECK_NE(source_boot_uuid.second
+ .oldest_remote_unreliable_monotonic_timestamp,
+ monotonic_clock::max_time);
destination_boot_times.emplace_back(source_boot_uuid);
}