From 24d17c013bbfd4cd3c6657b3ce9b89fe6dc329e8 Mon Sep 17 00:00:00 2001 From: "A.J. Beamon" Date: Thu, 3 Jun 2021 13:51:47 -0700 Subject: [PATCH] Add an assert to confirm that try_emplace is inserting a new entry --- fdbrpc/AsyncFileCached.actor.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fdbrpc/AsyncFileCached.actor.h b/fdbrpc/AsyncFileCached.actor.h index e908a08e05..fd6fe27524 100644 --- a/fdbrpc/AsyncFileCached.actor.h +++ b/fdbrpc/AsyncFileCached.actor.h @@ -147,7 +147,11 @@ public: if (f.isReady() && f.isError()) return f; - itr = openFiles.try_emplace(filename, f).first; + auto result = openFiles.try_emplace(filename, f); + + // This should be inserting a new entry + ASSERT(result.second); + itr = result.first; // We return here instead of falling through to the outer scope so that we don't delete all references to // the underlying file before returning