diff options
author | David Anderson <dvander@google.com> | 2021-06-29 19:55:49 -0700 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2021-07-01 15:39:09 -0700 |
commit | e2b83494b3c7f74f39f94ca94f77f931e58f13a4 (patch) | |
tree | c344ff119a30a459d1a49eb39efebe96947b563e | |
parent | 7729c21a473c7da5457786d12b65884ba3a2f594 (diff) |
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
-rw-r--r-- | aosp/cleanup_previous_update_action.cc | 8 |
1 files changed, 8 insertions, 0 deletions
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; |