assert() is traditionally disabled in release builds, but not in
scylladb. This hasn't caused problems so far, but the latest abseil
release includes a commit [1] that causes a 1000 insn/op regression when
NDEBUG is not defined.
Clearly, we must move towards a build system where NDEBUG is defined in
release builds. But we can't just define it blindly without vetting
all the assert() calls, as some were written with the expectation that
they are enabled in release mode.
To solve the conundrum, change all assert() calls to a new SCYLLA_ASSERT()
macro in utils/assert.hh. This macro is always defined and is not conditional
on NDEBUG, so we can later (after vetting Seastar) enable NDEBUG in release
mode.
[1] 66ef711d68
Closes scylladb/scylladb#20006
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#include "utils/assert.hh"
|
|
#include "version.hh"
|
|
#include "build_mode.hh"
|
|
|
|
#include <boost/algorithm/string/classification.hpp>
|
|
#include <boost/algorithm/string/split.hpp>
|
|
|
|
#include <seastar/core/print.hh>
|
|
|
|
static const char scylla_product_str[] = SCYLLA_PRODUCT;
|
|
static const char scylla_version_str[] = SCYLLA_VERSION;
|
|
static const char scylla_release_str[] = SCYLLA_RELEASE;
|
|
static const char scylla_build_mode_str[] = SCYLLA_BUILD_MODE_STR;
|
|
|
|
std::string scylla_version()
|
|
{
|
|
return seastar::format("{}-{}", scylla_version_str, scylla_release_str);
|
|
}
|
|
|
|
std::string scylla_build_mode()
|
|
{
|
|
return seastar::format("{}", scylla_build_mode_str);
|
|
}
|
|
|
|
std::string doc_link(std::string_view url_tail) {
|
|
const std::string_view product = scylla_product_str;
|
|
const std::string_view version = scylla_version_str;
|
|
|
|
const auto prefix = product == "scylla-enterprise" ? "enterprise" : "opensource";
|
|
|
|
std::string branch = product == "scylla-enterprise" ? "enterprise" : "master";
|
|
if (!version.ends_with("~dev")) {
|
|
std::vector<std::string> components;
|
|
boost::split(components, version, boost::algorithm::is_any_of("."));
|
|
// Version is compiled into the binary, testing will step on this immediately.
|
|
SCYLLA_ASSERT(components.size() >= 2);
|
|
branch = fmt::format("branch-{}.{}", components[0], components[1]);
|
|
}
|
|
|
|
return fmt::format("https://{}.docs.scylladb.com/{}/{}", prefix, branch, url_tail);
|
|
}
|
|
|
|
// get the version number into writeable memory, so we can grep for it if we get a core dump
|
|
std::string version_stamp_for_core
|
|
= "VERSION VERSION VERSION $Id: " + scylla_version() + " $ VERSION VERSION VERSION";
|