From e2b83494b3c7f74f39f94ca94f77f931e58f13a4 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 29 Jun 2021 19:55:49 -0700 Subject: Record the source build fingerprint in SnapshotMergeStats. This also adds a manual call to WriteState(). If update_engine crashes or the device reboots, it's possible that certain stats (such as the COW file stats) will be gone by the time the merge state is recovered. Forcing a write prevents this. Note that the write was previously implicit in set_cow_file_size, but is now explicit before calling InitiateMerge(). Bug: 188909957 Test: manual test Change-Id: I27cdc72272a9fa4ff5df4968e200fc14f63d0146 Merged-In: I27cdc72272a9fa4ff5df4968e200fc14f63d0146 --- aosp/cleanup_previous_update_action.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aosp/cleanup_previous_update_action.cc b/aosp/cleanup_previous_update_action.cc index dde6b89a..5084c1e5 100644 --- a/aosp/cleanup_previous_update_action.cc +++ b/aosp/cleanup_previous_update_action.cc @@ -409,6 +409,14 @@ void CleanupPreviousUpdateAction::InitiateMergeAndWait() { merge_stats_->set_boot_complete_to_merge_start_time_ms( merge_start_time.count() - merge_stats_->boot_complete_time_ms()); + auto source_build_fingerprint = snapshot_->ReadSourceBuildFingerprint(); + merge_stats_->set_source_build_fingerprint(source_build_fingerprint); + + if (!merge_stats_->WriteState()) { + LOG(ERROR) << "Failed to write merge stats; record may be unreliable if " + "merge is interrupted."; + } + if (snapshot_->InitiateMerge()) { WaitForMergeOrSchedule(); return; -- cgit v1.2.3 From cfd7c0f39aeaf6ea98135b999b64196a7ba2eb47 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 29 Jun 2021 19:59:22 -0700 Subject: Report source and target build fingerprints in SNAPSHOT_MERGE_REPORTED. Bug: 188909957 Test: manual test Change-Id: I108c20cf1e092478be2ae59701514f32d9b0a9f3 Merged-In: I108c20cf1e092478be2ae59701514f32d9b0a9f3 --- aosp/cleanup_previous_update_action.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aosp/cleanup_previous_update_action.cc b/aosp/cleanup_previous_update_action.cc index 5084c1e5..53cb9933 100644 --- a/aosp/cleanup_previous_update_action.cc +++ b/aosp/cleanup_previous_update_action.cc @@ -485,6 +485,9 @@ void CleanupPreviousUpdateAction::ReportMergeStats() { // However, we have saved the flag in the snapshot report. bool vab_compression_used = report.compression_enabled(); + auto target_build_fingerprint = + android::base::GetProperty("ro.build.fingerprint", ""); + LOG(INFO) << "Reporting merge stats: " << android::snapshot::UpdateState_Name(report.state()) << " in " << passed_ms.count() << "ms (resumed " << report.resume_count() @@ -502,7 +505,9 @@ void CleanupPreviousUpdateAction::ReportMergeStats() { report.estimated_cow_size_bytes(), report.boot_complete_time_ms(), report.boot_complete_to_merge_start_time_ms(), - static_cast(report.merge_failure_code())); + static_cast(report.merge_failure_code()), + report.source_build_fingerprint().c_str(), + target_build_fingerprint.c_str()); #endif } -- cgit v1.2.3