diff --git a/src/coordinator/coordinator_worker.hpp b/src/coordinator/coordinator_worker.hpp index 46ca39b02..4cf74111e 100644 --- a/src/coordinator/coordinator_worker.hpp +++ b/src/coordinator/coordinator_worker.hpp @@ -98,6 +98,7 @@ class Queue { } Message Pop() { + MG_ASSERT(inner_.use_count() > 0); std::unique_lock lock(inner_->mu); while (inner_->queue.empty()) { diff --git a/src/io/local_transport/local_transport_handle.hpp b/src/io/local_transport/local_transport_handle.hpp index 25a106e9b..1c2ce2510 100644 --- a/src/io/local_transport/local_transport_handle.hpp +++ b/src/io/local_transport/local_transport_handle.hpp @@ -160,8 +160,7 @@ class LocalTransportHandle { OpaquePromise opaque_promise(std::move(promise).ToUnique()); DeadlineAndOpaquePromise dop{.requested_at = now, .deadline = deadline, .promise = std::move(opaque_promise)}; - // TODO(tyler) assert not already present - + MG_ASSERT(!promises_.contains(promise_key)); promises_.emplace(std::move(promise_key), std::move(dop)); } // lock dropped diff --git a/src/io/simulator/simulator_handle.hpp b/src/io/simulator/simulator_handle.hpp index 2b236f0ec..3420786c7 100644 --- a/src/io/simulator/simulator_handle.hpp +++ b/src/io/simulator/simulator_handle.hpp @@ -129,6 +129,9 @@ class SimulatorHandle { .deadline = deadline, .promise = std::move(opaque_promise), }; + + MG_ASSERT(!promises_.contains(promise_key)); + promises_.emplace(std::move(promise_key), std::move(dop)); stats_.total_messages++; diff --git a/src/storage/v3/shard_worker.hpp b/src/storage/v3/shard_worker.hpp index b1fefdfd9..87d991cfd 100644 --- a/src/storage/v3/shard_worker.hpp +++ b/src/storage/v3/shard_worker.hpp @@ -102,6 +102,7 @@ class Queue { } Message Pop() { + MG_ASSERT(inner_.use_count() > 0); std::unique_lock lock(inner_->mu); while (inner_->queue.empty()) {