From de11f7fe358de519306e9ee9bce5776b142cef93 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Tue, 12 Sep 2017 16:43:06 +0100 Subject: [PATCH] Correctly remove session cache value of expired session. Summary: `CDataCacheRevision` stores current working timestamps in `m_timestamps` and stores complete timestamps (including unadmitted deferred values) in `m_originalTimestamps`. A value is "in" the cache if and only if its timestamp is in `m_timestamps`. In `writeNewRevision` the `.rev` file is written based on `m_originalTimestamps` so that unadmitted deferred values don't get lost. Session cache works by removing timestamps that were not created in the current session. But it needs to remove from both `m_timestamps` and `m_originalTimestamps` so that old session cache values can't get recreated by `writeNewRevision`. Test Plan: Currently being evaluated by @kbasan to check that it does not introduce unintended consequences. Reviewers: #swift_pilot_client, kbasan Reviewed By: #swift_pilot_client, kbasan Subscribers: jenkins, kbasan Tags: #swift_pilot_client Differential Revision: https://dev.swift-project.org/D53 --- src/blackmisc/datacache.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/blackmisc/datacache.cpp b/src/blackmisc/datacache.cpp index e3fe069a7..56e87370d 100644 --- a/src/blackmisc/datacache.cpp +++ b/src/blackmisc/datacache.cpp @@ -429,7 +429,11 @@ namespace BlackMisc for (auto it = sessionIds.cbegin(); it != sessionIds.cend(); ++it) { m_sessionValues[it.key()] = it.value(); - if (it.value() != m_session->uuid()) { m_timestamps.remove(it.key()); } + if (it.value() != m_session->uuid()) + { + m_timestamps.remove(it.key()); + m_originalTimestamps.remove(it.key()); + } } } else if (revisionFile.size() > 0)