summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@yahooinc.com>2023-03-29 16:26:15 +0200
committerGitHub <noreply@github.com>2023-03-29 16:26:15 +0200
commit70211538e30cd49226d09d4e65ba17ff40ec2432 (patch)
tree5530babe9132e998161a85a567ca3140b7350024
parent79798b43c050c325ad3e5295620d064d73bf95e2 (diff)
parentbb438fabf05b22646853204ebf6bfead5ae84a92 (diff)
Merge pull request #26634 from vespa-engine/toregge/report-memory-usage-for-document-meta-store
Report memory usage for document meta store.
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp25
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/document_meta_store_explorer.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/util/state_explorer_utils.cpp26
-rw-r--r--searchlib/src/vespa/searchlib/util/state_explorer_utils.h2
4 files changed, 39 insertions, 23 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp
index 2deabeda797..6244bdbea33 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp
@@ -15,6 +15,7 @@ using search::attribute::Status;
using search::AddressSpaceUsage;
using search::AttributeVector;
using search::IEnumStore;
+using search::StateExplorerUtils;
using vespalib::AddressSpace;
using vespalib::MemoryUsage;
using search::attribute::MultiValueMappingBase;
@@ -27,26 +28,6 @@ namespace proton {
namespace {
void
-convertStatusToSlime(const Status &status, Cursor &object)
-{
- object.setLong("numDocs", status.getNumDocs());
- object.setLong("numValues", status.getNumValues());
- object.setLong("numUniqueValues", status.getNumUniqueValues());
- object.setLong("lastSerialNum", status.getLastSyncToken());
- object.setLong("updateCount", status.getUpdateCount());
- object.setLong("nonIdempotentUpdateCount", status.getNonIdempotentUpdateCount());
- object.setLong("bitVectors", status.getBitVectors());
- {
- Cursor &memory = object.setObject("memoryUsage");
- memory.setLong("allocatedBytes", status.getAllocated());
- memory.setLong("usedBytes", status.getUsed());
- memory.setLong("deadBytes", status.getDead());
- memory.setLong("onHoldBytes", status.getOnHold());
- memory.setLong("onHoldBytesMax", status.getOnHoldMax());
- }
-}
-
-void
convertGenerationToSlime(const AttributeVector &attr, Cursor &object)
{
object.setLong("oldest_used", attr.get_oldest_used_generation());
@@ -73,7 +54,7 @@ convertAddressSpaceUsageToSlime(const AddressSpaceUsage &usage, Cursor &object)
void
convertMemoryUsageToSlime(const MemoryUsage &usage, Cursor &object)
{
- search::StateExplorerUtils::memory_usage_to_slime(usage, object);
+ StateExplorerUtils::memory_usage_to_slime(usage, object);
}
void
@@ -136,7 +117,7 @@ AttributeVectorExplorer::get_state_helper(const AttributeVector& attr, const ves
const Status &status = attr.getStatus();
Cursor &object = inserter.insertObject();
if (full) {
- convertStatusToSlime(status, object.setObject("status"));
+ StateExplorerUtils::status_to_slime(status, object.setObject("status"));
convertGenerationToSlime(attr, object.setObject("generation"));
convertAddressSpaceUsageToSlime(attr.getAddressSpaceUsage(), object.setObject("addressSpaceUsage"));
// TODO: Consider making enum store, multivalue mapping, posting list attribute and tensor attribute
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/document_meta_store_explorer.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/document_meta_store_explorer.cpp
index 5a1f0f42507..ffb9acd5501 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/document_meta_store_explorer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/document_meta_store_explorer.cpp
@@ -1,8 +1,12 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "document_meta_store_explorer.h"
+#include "documentmetastore.h"
+#include <vespa/searchlib/util/state_explorer_utils.h>
#include <vespa/vespalib/data/slime/cursor.h>
+using search::StateExplorerUtils;
+using search::attribute::Status;
using vespalib::slime::Cursor;
using vespalib::slime::Inserter;
@@ -18,6 +22,11 @@ DocumentMetaStoreExplorer::get_state(const Inserter &inserter, bool full) const
{
Cursor &object = inserter.insertObject();
if (full) {
+ auto dms = dynamic_cast<const DocumentMetaStore*>(&_metaStore->get());
+ if (dms != nullptr) {
+ const Status &status = dms->getStatus();
+ StateExplorerUtils::status_to_slime(status, object.setObject("status"));
+ }
search::LidUsageStats stats = _metaStore->get().getLidUsageStats();
object.setLong("usedLids", stats.getUsedLids());
object.setLong("activeLids", _metaStore->get().getNumActiveLids());
diff --git a/searchlib/src/vespa/searchlib/util/state_explorer_utils.cpp b/searchlib/src/vespa/searchlib/util/state_explorer_utils.cpp
index 00e2e081302..d61737d2a5f 100644
--- a/searchlib/src/vespa/searchlib/util/state_explorer_utils.cpp
+++ b/searchlib/src/vespa/searchlib/util/state_explorer_utils.cpp
@@ -1,13 +1,18 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "state_explorer_utils.h"
+#include <vespa/searchcommon/attribute/status.h>
#include <vespa/vespalib/data/slime/cursor.h>
#include <vespa/vespalib/util/memoryusage.h>
+using search::attribute::Status;
+using vespalib::MemoryUsage;
+using vespalib::slime::Cursor;
+
namespace search {
void
-StateExplorerUtils::memory_usage_to_slime(const vespalib::MemoryUsage& usage, vespalib::slime::Cursor& object)
+StateExplorerUtils::memory_usage_to_slime(const MemoryUsage& usage, Cursor& object)
{
object.setLong("allocated", usage.allocatedBytes());
object.setLong("used", usage.usedBytes());
@@ -15,5 +20,24 @@ StateExplorerUtils::memory_usage_to_slime(const vespalib::MemoryUsage& usage, ve
object.setLong("onHold", usage.allocatedBytesOnHold());
}
+void
+StateExplorerUtils::status_to_slime(const Status &status, Cursor &object)
+{
+ object.setLong("numDocs", status.getNumDocs());
+ object.setLong("numValues", status.getNumValues());
+ object.setLong("numUniqueValues", status.getNumUniqueValues());
+ object.setLong("lastSerialNum", status.getLastSyncToken());
+ object.setLong("updateCount", status.getUpdateCount());
+ object.setLong("nonIdempotentUpdateCount", status.getNonIdempotentUpdateCount());
+ object.setLong("bitVectors", status.getBitVectors());
+ {
+ Cursor &memory = object.setObject("memoryUsage");
+ memory.setLong("allocatedBytes", status.getAllocated());
+ memory.setLong("usedBytes", status.getUsed());
+ memory.setLong("deadBytes", status.getDead());
+ memory.setLong("onHoldBytes", status.getOnHold());
+ memory.setLong("onHoldBytesMax", status.getOnHoldMax());
+ }
}
+}
diff --git a/searchlib/src/vespa/searchlib/util/state_explorer_utils.h b/searchlib/src/vespa/searchlib/util/state_explorer_utils.h
index eebac033714..9a8d1a7d9db 100644
--- a/searchlib/src/vespa/searchlib/util/state_explorer_utils.h
+++ b/searchlib/src/vespa/searchlib/util/state_explorer_utils.h
@@ -2,6 +2,7 @@
#pragma once
+namespace search::attribute { class Status; }
namespace vespalib { class MemoryUsage; }
namespace vespalib::slime { struct Cursor; }
@@ -13,6 +14,7 @@ namespace search {
class StateExplorerUtils {
public:
static void memory_usage_to_slime(const vespalib::MemoryUsage& usage, vespalib::slime::Cursor& object);
+ static void status_to_slime(const search::attribute::Status &status, vespalib::slime::Cursor &object);
};
}