summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@vespa.ai>2023-11-15 14:23:11 +0000
committerTor Brede Vekterli <vekterli@vespa.ai>2023-11-15 14:23:11 +0000
commitcf548256d6107e68ce02c315cd1fab37853663a8 (patch)
treefa1a7fb18f17e39b7cf4947065a13392fd06ca11 /storage
parent241e9149b0a61f35467d39cc8c66d6a1962c8465 (diff)
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.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp11
1 files changed, 9 insertions, 2 deletions
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 <vespa/vdslib/state/cluster_state_bundle.h>
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/document/bucket/fixed_bucket_spaces.h>
+#include <vespa/vespalib/util/backtrace.h>
#include <cassert>
#include <vespa/log/log.h>
@@ -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;
}