diff options
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/ddbstate.h | 5 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/documentdb.cpp | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/ddbstate.h b/searchcore/src/vespa/searchcore/proton/server/ddbstate.h index be5f081ce52..5961ac4da62 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ddbstate.h +++ b/searchcore/src/vespa/searchcore/proton/server/ddbstate.h @@ -94,6 +94,11 @@ public: return getDelayedConfig(state); } + bool get_load_done() const noexcept { + State state(getState()); + return state >= State::REPLAY_TRANSACTION_LOG; + } + void clearDelayedConfig(); ConfigState getConfigState() const noexcept { return _configState.load(std::memory_order_relaxed); } static vespalib::string getConfigStateString(ConfigState configState); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index e8c3ac885ea..66b4d293100 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -612,13 +612,21 @@ DocumentDB::closeSubDBs() size_t DocumentDB::getNumDocs() const { - return _subDBs.getReadySubDB()->getNumDocs(); + if (_state.get_load_done()) { + return _subDBs.getReadySubDB()->getNumDocs(); + } else { + return 0u; + } } size_t DocumentDB::getNumActiveDocs() const { - return _subDBs.getReadySubDB()->getNumActiveDocs(); + if (_state.get_load_done()) { + return _subDBs.getReadySubDB()->getNumActiveDocs(); + } else { + return 0u; + } } void |