Skip to content

Commit

Permalink
Wait for load done before providing transient resource usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
toregge committed Dec 6, 2022
1 parent b01ebe8 commit 2e0d3a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions searchcore/src/vespa/searchcore/proton/server/ddbstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DDBState
static std::vector<vespalib::string> _stateNames;
static std::vector<vespalib::string> _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();
Expand All @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
}
Expand Down
1 change: 1 addition & 0 deletions searchcore/src/vespa/searchcore/proton/server/documentdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ class DocumentDB : public DocumentDBConfigOwner,
ExecutorThreadingService & getWriteService() { return _writeService; }

void set_attribute_usage_listener(std::unique_ptr<IAttributeUsageListener> listener);
const DDBState& get_state() const noexcept { return _state; }
};

} // namespace proton

0 comments on commit 2e0d3a9

Please sign in to comment.