From cf548256d6107e68ce02c315cd1fab37853663a8 Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Wed, 15 Nov 2023 14:23:11 +0000 Subject: Explicitly print backtrace on bucket space invariant violation This is to help catch an unknown edge case that can happen if distributor operation cancellation is enabled. --- .../storage/distributor/distributor_bucket_space_repo.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'storage') diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp index d5d4accd70a..7dea2e621e1 100644 --- a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp +++ b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -34,7 +35,10 @@ DistributorBucketSpace & DistributorBucketSpaceRepo::get(BucketSpace bucketSpace) { auto itr = _map.find(bucketSpace); - assert(itr != _map.end()); + if (itr == _map.end()) [[unlikely]] { + LOG(error, "Bucket space %zu does not have a valid mapping. %s", bucketSpace.getId(), vespalib::getStackTrace(0).c_str()); + abort(); + } return *itr->second; } @@ -42,7 +46,10 @@ const DistributorBucketSpace & DistributorBucketSpaceRepo::get(BucketSpace bucketSpace) const { auto itr = _map.find(bucketSpace); - assert(itr != _map.end()); + if (itr == _map.end()) [[unlikely]] { + LOG(error, "Bucket space %zu does not have a valid mapping. %s", bucketSpace.getId(), vespalib::getStackTrace(0).c_str()); + abort(); + } return *itr->second; } -- cgit v1.2.3