diff options
11 files changed, 28 insertions, 33 deletions
diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp index c7cf710958d..b43b7a59c5b 100644 --- a/document/src/vespa/document/update/documentupdate.cpp +++ b/document/src/vespa/document/update/documentupdate.cpp @@ -25,8 +25,6 @@ namespace document { namespace { -constexpr unsigned char CONTENT_HASTYPE = 0x01; - vespalib::stringref readCStr(nbostream & stream) { const char * s = stream.peek(); diff --git a/logd/src/logd/CMakeLists.txt b/logd/src/logd/CMakeLists.txt index 49644f1b199..865d810fe0e 100644 --- a/logd/src/logd/CMakeLists.txt +++ b/logd/src/logd/CMakeLists.txt @@ -7,8 +7,8 @@ find_package(Protobuf REQUIRED) protobuf_generate_cpp(logd_PROTOBUF_SRCS logd_PROTOBUF_HDRS ../../../logserver/src/protobuf/log_protocol.proto) # protoc-generated files emit compiler warnings that we normally treat as errors. -if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set_source_files_properties(${logd_PROTOBUF_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-suggest-override") +if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") + set_source_files_properties(${logd_PROTOBUF_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-array-bounds -Wno-suggest-override") endif() vespa_add_library(logd STATIC diff --git a/metrics/src/vespa/metrics/metricmanager.cpp b/metrics/src/vespa/metrics/metricmanager.cpp index 2308102506b..dcc02696e2d 100644 --- a/metrics/src/vespa/metrics/metricmanager.cpp +++ b/metrics/src/vespa/metrics/metricmanager.cpp @@ -4,10 +4,6 @@ #include "countmetric.h" #include "valuemetric.h" #include "metricset.h" -#include "summetric.h" -#include "jsonwriter.h" -#include "textwriter.h" -#include "xmlwriter.h" #include <vespa/config/print/ostreamconfigwriter.h> #include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/vespalib/util/stringfmt.h> @@ -27,6 +23,11 @@ typedef MetricsmanagerConfig Config; MetricManager::ConsumerSpec::ConsumerSpec() = default; MetricManager::ConsumerSpec::~ConsumerSpec() = default; +time_t +MetricManager::Timer::getTime() const { + return std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count(); +} + void MetricManager::assertMetricLockLocked(const MetricLockGuard& g) const { if (!g.monitors(_waiter)) { @@ -45,7 +46,7 @@ MetricManager::ConsumerSpec::print(std::ostream& out, bool verbose, for (const Metric::String & name : includedMetrics) { sortedMetrics.insert(name); } - for (auto s : sortedMetrics) { + for (const auto & s : sortedMetrics) { out << "\n" << indent << " " << s; } out << ")"; @@ -327,7 +328,7 @@ namespace { { LOG(spam, "Adding metrics for consumer %s", c.name.c_str()); } - ConsumerMetricBuilder::~ConsumerMetricBuilder() { } + ConsumerMetricBuilder::~ConsumerMetricBuilder() = default; } diff --git a/metrics/src/vespa/metrics/metricmanager.h b/metrics/src/vespa/metrics/metricmanager.h index 3b8de5927ec..f2b2926873f 100644 --- a/metrics/src/vespa/metrics/metricmanager.h +++ b/metrics/src/vespa/metrics/metricmanager.h @@ -70,7 +70,7 @@ public: struct Timer { virtual ~Timer() {} - virtual time_t getTime() const { return time(0); } + virtual time_t getTime() const; virtual time_t getTimeInMilliSecs() const { return getTime() * 1000; } }; @@ -85,7 +85,7 @@ public: ConsumerSpec(ConsumerSpec &&) = default; ConsumerSpec & operator= (ConsumerSpec &&) = default; ConsumerSpec(); - ~ConsumerSpec(); + ~ConsumerSpec() override; bool contains(const Metric& m) const { return (includedMetrics.find(m.getPath()) != includedMetrics.end()); @@ -126,8 +126,8 @@ private: LongAverageMetric _sleepTimes; public: - MetricManager(std::unique_ptr<Timer> timer = std::unique_ptr<Timer>(new Timer)); - ~MetricManager(); + MetricManager(std::unique_ptr<Timer> timer = std::make_unique<Timer>()); + ~MetricManager() override; void stop(); diff --git a/searchcore/src/apps/vespa-gen-testdocs/CMakeLists.txt b/searchcore/src/apps/vespa-gen-testdocs/CMakeLists.txt index f5e593e5532..dd40dab8ef2 100644 --- a/searchcore/src/apps/vespa-gen-testdocs/CMakeLists.txt +++ b/searchcore/src/apps/vespa-gen-testdocs/CMakeLists.txt @@ -6,4 +6,3 @@ vespa_add_executable(searchcore_vespa-gen-testdocs_app INSTALL bin DEPENDS ) -vespa_add_target_system_dependency(searchcore_vespa-gen-testdocs_app crypto) diff --git a/searchlib/src/vespa/searchlib/engine/CMakeLists.txt b/searchlib/src/vespa/searchlib/engine/CMakeLists.txt index e0c8e3113a4..0dc183289c0 100644 --- a/searchlib/src/vespa/searchlib/engine/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/engine/CMakeLists.txt @@ -4,9 +4,9 @@ find_package(Protobuf REQUIRED) protobuf_generate_cpp(searchlib_engine_PROTOBUF_SRCS searchlib_engine_PROTOBUF_HDRS ../../../../src/protobuf/search_protocol.proto) # protoc-generated files emit compiler warnings that we normally treat as errors. -if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") set_source_files_properties(${searchlib_engine_PROTOBUF_SRCS} - PROPERTIES COMPILE_FLAGS "-Wno-suggest-override") + PROPERTIES COMPILE_FLAGS "-Wno-array-bounds -Wno-suggest-override") endif() vespa_add_library(searchlib_engine OBJECT diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index a56104ff717..d1631c50880 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -1273,10 +1273,10 @@ FileStorHandlerImpl::Stripe::dumpQueueHtml(std::ostream & os) const namespace { void dump_lock_entry(const document::BucketId& bucketId, const FileStorHandlerImpl::Stripe::LockEntry& entry, - api::LockingRequirements lock_mode, uint32_t now_ts, std::ostream& os) { + api::LockingRequirements lock_mode, FileStorHandlerImpl::Clock::time_point now_ts, std::ostream& os) { os << api::MessageType::get(entry.msgType).getName() << ":" << entry.msgId << " (" << bucketId << ", " << api::to_string(lock_mode) - << " lock) Running for " << (now_ts - entry.timestamp) << " secs<br/>\n"; + << " lock) Running for " << std::chrono::duration_cast<std::chrono::seconds>(now_ts - entry.timestamp).count() << " secs<br/>\n"; } } @@ -1284,7 +1284,7 @@ void dump_lock_entry(const document::BucketId& bucketId, const FileStorHandlerIm void FileStorHandlerImpl::Stripe::dumpActiveHtml(std::ostream & os) const { - uint32_t now = time(nullptr); + Clock::time_point now = Clock::now(); vespalib::MonitorGuard guard(_lock); for (const auto & e : _lockedBuckets) { if (e.second._exclusiveLock) { diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h index d46aa635354..fd6ab5e8b9a 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h @@ -72,21 +72,22 @@ public: using PriorityIdx = bmi::nth_index<PriorityQueue, 1>::type; using BucketIdx = bmi::nth_index<PriorityQueue, 2>::type; + using Clock = std::chrono::steady_clock; struct Disk; class Stripe { public: struct LockEntry { - uint32_t timestamp; + Clock::time_point timestamp; uint8_t priority; api::MessageType::Id msgType; api::StorageMessage::Id msgId; - LockEntry() : timestamp(0), priority(0), msgType(), msgId(0) { } + LockEntry() : timestamp(), priority(0), msgType(), msgId(0) { } LockEntry(uint8_t priority_, api::MessageType::Id msgType_, api::StorageMessage::Id msgId_) - : timestamp(time(nullptr)), priority(priority_), msgType(msgType_), msgId(msgId_) + : timestamp(Clock::now()), priority(priority_), msgType(msgType_), msgId(msgId_) { } }; diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp index 64c0970cf9d..c5a0a031067 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.cpp +++ b/storage/src/vespa/storage/storageserver/storagenode.cpp @@ -161,10 +161,10 @@ StorageNode::initialize() _context.getComponentRegister().setBucketSpacesConfig(*_bucketSpacesConfig); _metrics = std::make_shared<StorageMetricSet>(); - _component.reset(new StorageComponent(_context.getComponentRegister(), "storagenode")); + _component = std::make_unique<StorageComponent>(_context.getComponentRegister(), "storagenode"); _component->registerMetric(*_metrics); if (!_context.getComponentRegister().hasMetricManager()) { - _metricManager.reset(new metrics::MetricManager); + _metricManager = std::make_unique<metrics::MetricManager>(); _context.getComponentRegister().setMetricManager(*_metricManager); } _component->registerMetricUpdateHook(*this, framework::SecondTime(300)); diff --git a/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt b/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt index cff34afa00c..113a4372068 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt +++ b/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt @@ -9,8 +9,8 @@ PROTOBUF_GENERATE_CPP(storageapi_PROTOBUF_SRCS storageapi_PROTOBUF_HDRS # protoc-generated files emit compiler warnings that we normally treat as errors. # Instead of rolling our own compiler plugin we'll pragmatically disable the noise. -if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set_source_files_properties(${storageapi_PROTOBUF_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-suggest-override -Wno-inline") +if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") + set_source_files_properties(${storageapi_PROTOBUF_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-array-bounds -Wno-suggest-override -Wno-inline") endif() # protoc explicitly annotates methods with inline, which triggers -Werror=inline when # the header file grows over a certain size. diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/clock/realclock.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/clock/realclock.cpp index f8c3c2a3f99..810eced1b3e 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/clock/realclock.cpp +++ b/storageframework/src/vespa/storageframework/defaultimplementation/clock/realclock.cpp @@ -3,9 +3,7 @@ #include "realclock.h" #include <sys/time.h> -namespace storage { -namespace framework { -namespace defaultimplementation { +namespace storage::framework::defaultimplementation { MicroSecTime RealClock::getTimeInMicros() const { struct timeval mytime; @@ -30,6 +28,4 @@ MonotonicTimePoint RealClock::getMonotonicTime() const { return std::chrono::steady_clock::now(); } -} // defaultimplementation -} // framework -} // storage +} |