summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@vespa.ai>2023-11-15 15:52:03 +0100
committerGitHub <noreply@github.com>2023-11-15 15:52:03 +0100
commit989a264bee42420d70b6b62730aa23763b830b07 (patch)
treefa1a7fb18f17e39b7cf4947065a13392fd06ca11
parent241e9149b0a61f35467d39cc8c66d6a1962c8465 (diff)
parentcf548256d6107e68ce02c315cd1fab37853663a8 (diff)
Merge pull request #29339 from vespa-engine/vekterli/print-backtrace-on-invariant-failure
Explicitly print backtrace on bucket space invariant violation
-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;
}