diff --git a/searchcore/src/vespa/searchcore/proton/server/ddbstate.h b/searchcore/src/vespa/searchcore/proton/server/ddbstate.h index 5961ac4da627..20c0799c2439 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ddbstate.h +++ b/searchcore/src/vespa/searchcore/proton/server/ddbstate.h @@ -49,7 +49,7 @@ class DDBState static std::vector _stateNames; static std::vector _configStateNames; - void set_state(State state) noexcept { _state.store(state, std::memory_order_relaxed); } + void set_state(State state) noexcept { _state.store(state, std::memory_order_release); } public: DDBState(); @@ -67,7 +67,7 @@ class DDBState bool enterOnlineState(); void enterShutdownState(); void enterDeadState(); - State getState() const noexcept { return _state.load(std::memory_order_relaxed); } + State getState() const noexcept { return _state.load(std::memory_order_acquire); } static vespalib::string getStateString(State state); bool getClosed() const noexcept { diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 27a2db27369c..6cd1a4ec728b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -113,6 +113,9 @@ class DocumentDBResourceUsageProvider : public ITransientResourceUsageProvider { TransientResourceUsage get_transient_resource_usage() const override { // Transient disk usage is measured as the total disk usage of all current fusion indexes. // Transient memory usage is measured as the total memory usage of all memory indexes. + if (!_doc_db.get_state().get_load_done()) { + return {0, 0}; + } auto stats = _doc_db.getReadySubDB()->getSearchableStats(); return {stats.fusion_size_on_disk(), stats.memoryUsage().allocatedBytes()}; } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index ef8851130795..29a25069367b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -422,6 +422,7 @@ class DocumentDB : public DocumentDBConfigOwner, ExecutorThreadingService & getWriteService() { return _writeService; } void set_attribute_usage_listener(std::unique_ptr listener); + const DDBState& get_state() const noexcept { return _state; } }; } // namespace proton