Set NodeEventLoopFactory boot_uuid to logged boot_uuid
Previously, we couldn't replay relogged logfiles because they
did not correctly track the boot uuid from the ServerStatistics message,
which was very unfortunate. Since the goal of replay is to reproduce
the state of the world when we were running, set the simulated boot UUID
to match what was logged.
I still don't seem to be able to fully replay relogged files (see
comments in drivetrain_replay.cc), but I think that those issues are
likely independent of this particular problem and I haven't yet written
a test to conveniently reproduce it.
Change-Id: I121ea4001e6fee7595b4fe1a2b200ffa1ae9bd40
diff --git a/aos/events/logging/logger.cc b/aos/events/logging/logger.cc
index 2e0f5db..5f01aab 100644
--- a/aos/events/logging/logger.cc
+++ b/aos/events/logging/logger.cc
@@ -998,6 +998,9 @@
CHECK(!HasChannel<RemoteMessage>(channel, node))
<< ": Can't have both a MessageHeader and RemoteMessage remote "
"timestamp channel.";
+ // In theory, we should check NOT_LOGGED like RemoteMessage and be more
+ // careful about updating the config, but there are fewer and fewer logs
+ // with MessageHeader remote messages, so it isn't worth the effort.
RemapLoggedChannel<MessageHeader>(channel, node, "/original",
"aos.message_bridge.RemoteMessage");
} else {
@@ -1005,7 +1008,13 @@
<< ": Failed to find {\"name\": \"" << channel << "\", \"type\": \""
<< RemoteMessage::GetFullyQualifiedName() << "\"} for node "
<< node->name()->string_view();
- RemapLoggedChannel<RemoteMessage>(channel, node);
+ // Only bother to remap if there's something on the channel. We can
+ // tell if the channel was marked NOT_LOGGED or not. This makes the
+ // config not change un-necesarily when we replay a log with NOT_LOGGED
+ // messages.
+ if (HasLoggedChannel<RemoteMessage>(channel, node)) {
+ RemapLoggedChannel<RemoteMessage>(channel, node);
+ }
}
}
}
@@ -1119,6 +1128,10 @@
<< ": Found parts from different boots "
<< LogFileVectorToString(log_files_);
}
+ if (!filtered_parts[0].source_boot_uuid.empty()) {
+ event_loop_factory_->GetNodeEventLoopFactory(node)->set_boot_uuid(
+ filtered_parts[0].source_boot_uuid);
+ }
}
states_[node_index] = std::make_unique<State>(