diff options
author | Geir Storli <geirst@yahooinc.com> | 2023-09-04 15:13:31 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2023-09-04 15:27:33 +0000 |
commit | e6ca36975a9e4c2730b934e3d93bd8d91ddd7c4c (patch) | |
tree | 75d94c9051a0c7cc8710c87e7568196d0a9ce3cf /searchcore | |
parent | 3e4a2ecdd9ad0b3dab563fd8572644bb3cfae2e3 (diff) |
Add memory index write context details to index manager state explorer.
This shows which index fields that are assigned to each executor id.
Diffstat (limited to 'searchcore')
3 files changed, 29 insertions, 3 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h index 3283bfb68eb..2157e6a49ec 100644 --- a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h +++ b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h @@ -94,6 +94,10 @@ public: _index.pruneRemovedFields(schema); } void flushToDisk(const vespalib::string &flushDir, uint32_t docIdLimit, SerialNum serialNum) override; + + void insert_write_context_state(vespalib::slime::Cursor& object) const override { + _index.insert_write_context_state(object); + } }; } // namespace proton diff --git a/searchcore/src/vespa/searchcorespi/index/imemoryindex.h b/searchcore/src/vespa/searchcorespi/index/imemoryindex.h index 1b370dff262..130042bc048 100644 --- a/searchcore/src/vespa/searchcorespi/index/imemoryindex.h +++ b/searchcore/src/vespa/searchcorespi/index/imemoryindex.h @@ -7,8 +7,9 @@ #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/util/memoryusage.h> -namespace vespalib { class IDestructorCallback; } namespace document { class Document; } +namespace vespalib { class IDestructorCallback; } +namespace vespalib::slime { struct Cursor; } namespace searchcorespi::index { /** @@ -78,6 +79,8 @@ struct IMemoryIndex : public searchcorespi::IndexSearchable { virtual void pruneRemovedFields(const search::index::Schema &schema) = 0; virtual search::index::Schema::SP getPrunedSchema() const = 0; + + virtual void insert_write_context_state(vespalib::slime::Cursor& object) const = 0; }; } diff --git a/searchcore/src/vespa/searchcorespi/index/index_manager_explorer.cpp b/searchcore/src/vespa/searchcorespi/index/index_manager_explorer.cpp index 855f3c69bc9..1634937f094 100644 --- a/searchcore/src/vespa/searchcorespi/index/index_manager_explorer.cpp +++ b/searchcore/src/vespa/searchcorespi/index/index_manager_explorer.cpp @@ -2,7 +2,8 @@ #include "index_manager_explorer.h" #include "index_manager_stats.h" - +#include <vespa/searchcorespi/index/imemoryindex.h> +#include <vespa/searchcorespi/index/indexsearchablevisitor.h> #include <vespa/vespalib/data/slime/cursor.h> using vespalib::slime::Cursor; @@ -45,8 +46,23 @@ insertMemoryIndex(Cursor &arrayCursor, const MemoryIndexStats &memoryIndex) insertMemoryUsage(memoryIndexCursor, sstats.memoryUsage()); } -} +class WriteContextInserter : public IndexSearchableVisitor { +private: + Cursor& _object; + bool _has_inserted; + +public: + WriteContextInserter(Cursor& object) : _object(object), _has_inserted(false) {} + void visit(const index::IDiskIndex&) override {} + void visit(const index::IMemoryIndex& index) override { + if (!_has_inserted) { + index.insert_write_context_state(_object); + _has_inserted = true; + } + } +}; +} IndexManagerExplorer::IndexManagerExplorer(IIndexManager::SP mgr) : _mgr(std::move(mgr)) @@ -68,6 +84,9 @@ IndexManagerExplorer::get_state(const Inserter &inserter, bool full) const for (const auto &memoryIndex : stats.getMemoryIndexes()) { insertMemoryIndex(memoryIndexArrayCursor, memoryIndex); } + auto& write_contexts = object.setObject("write_contexts"); + WriteContextInserter visitor(write_contexts); + _mgr->getSearchable()->accept(visitor); } } |