Handle local messages sent before remote messages after reboot
We only generate points in the time interpolation function (and
therefore only discover reboots, since a reboot can only happen at a
point). When there is data in a log before remote data, we don't
generate these points, and therefore can't replay the log.
F1118 00:05:39.808653 14 log_reader.cc:690] Check failed: monotonic_now == timestamped_message.monotonic_event_time.time : { "name": "pi2", "hostname": "raspberrypi2", "port": 9971 } Now 107.005000000sec trying to send {.boot=1, .time=107.000000000sec} failure node 1 (pi2) [
] queued_until {.boot=1, .time=109.210150000sec}
node 0 remote_data [
channel 0 [
{.channel_index=3, .queue_index={.boot=0, .index=91}, .timestamp={.boot=0, .time=9.200000000sec}, .data=0x555c65f23f80}
]
channel 1 [
{.channel_index=20, .queue_index={.boot=0, .index=622}, .timestamp={.boot=0, .time=9.210000000sec}, .data=0x555c66126a90}
]
] queued_until {.boot=0, .time=9.210350000sec}
*** Check failure stack trace: ***
@ 0x7fd804015aef google::LogMessageFatal::~LogMessageFatal()
@ 0x7fd8045a7069 aos::logger::LogReader::RegisterDuringStartup()::$_3::operator()()
@ 0x7fd804258119 aos::TimerHandler::Call()
@ 0x7fd804257ead aos::SimulatedTimerHandler::HandleEvent()
@ 0x7fd804263fb1 std::_Function_handler<>::_M_invoke()
@ 0x7fd804252c18 aos::EventScheduler::CallOldestEvent()
@ 0x7fd804253f54 aos::EventSchedulerScheduler::Run()
@ 0x7fd80425b472 aos::SimulatedEventLoopFactory::Run()
@ 0x555c641e780f aos::logger::testing::ConfirmReadable()
@ 0x555c6421507f aos::logger::testing::MultinodeRebootLoggerTest_LocalMessageBeforeRemoteBeforeStartAfterReboot_Test::TestBody()
@ 0x7fd803fa0ce4 testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x7fd803fa0c21 testing::Test::Run()
@ 0x7fd803fa1fdf testing::TestInfo::Run()
@ 0x7fd803fa2b07 testing::TestSuite::Run()
@ 0x7fd803fb4d17 testing::internal::UnitTestImpl::RunAllTests()
@ 0x7fd803fb4634 testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x7fd803fb44bb testing::UnitTest::Run()
@ 0x7fd804065010 main
@ 0x7fd803aa4d0a __libc_start_main
@ 0x555c641e132a _start
The fix is to generate a point for the first local timestamp too.
Change-Id: Ic1090d35375fce295d91bccc53f0d3ca8e472770
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index 9c7fe5d..a76b876 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -983,6 +983,8 @@
if (oldest) {
CHECK_GE(oldest->timestamp.time, last_message_time_);
last_message_time_ = oldest->timestamp.time;
+ monotonic_oldest_time_ =
+ std::min(monotonic_oldest_time_, oldest->timestamp.time);
} else {
last_message_time_ = monotonic_clock::max_time;
}