Skip to content

PS-11266: Basic HNSW class (phase 1 - basic modification and read operations support). - #6124

Open
dlenev wants to merge 3 commits into
percona:vector-mvpfrom
dlenev:ps-11266
Open

PS-11266: Basic HNSW class (phase 1 - basic modification and read operations support).#6124
dlenev wants to merge 3 commits into
percona:vector-mvpfrom
dlenev:ps-11266

Conversation

@dlenev

@dlenev dlenev commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

https://perconadev.atlassian.net/browse/PS-11266

Added basic implementation of in-memory HNSW index.

It supports insert and approximate k-NN search per the HNSW paper
(https://arxiv.org/abs/1603.09320) and uses arena allocator for nodes.

Streaming approximate NN search is also supported.

Added unit tests.

@dlenev
dlenev requested a review from catalinbp August 10, 2026 12:42
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h Outdated
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an arena-backed, in-memory HNSW index with approximate nearest-neighbor search.

Changes:

  • Implements insertion, k-NN, streaming search, and validation.
  • Adds unit and recall tests.
  • Registers the new test target.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
vector-common/hnsw.h Implements HNSW indexing and search.
unittest/gunit/hnsw-t.cc Tests index and streaming behavior.
unittest/gunit/CMakeLists.txt Registers HNSW tests.
Suppressed comments (1)

vector-common/hnsw.h:553

  • The allocator contract permits nullptr, and MEM_ROOT::Alloc() does return it on OOM. With NDEBUG, this assertion vanishes and placement-new at address zero is undefined behavior. Propagate allocation failure before constructing the node.
      assert(raw_mem != nullptr);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h Outdated
Comment thread vector-common/hnsw.h Outdated
@dlenev
dlenev force-pushed the ps-11266 branch 2 times, most recently from fb1df5c to 376ec06 Compare August 12, 2026 15:42
@dlenev
dlenev requested a review from catalinbp August 12, 2026 15:43
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h Outdated
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h
Comment thread vector-common/hnsw.h
@dlenev
dlenev force-pushed the ps-11266 branch 2 times, most recently from 9b5b8c6 to 6b6082b Compare August 13, 2026 10:48
@dlenev
dlenev requested a review from catalinbp August 13, 2026 10:51

@catalinbp catalinbp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with the exception of the m_visited which needs to be properly released in reset()

dlenev added 2 commits August 13, 2026 15:37
…rations support) [part 1].

https://perconadev.atlassian.net/browse/PS-11266

Added basic implementation of in-memory HNSW index.

It supports insert and approximate k-NN search per the HNSW paper
(https://arxiv.org/abs/1603.09320) and uses arena allocator for nodes.

Added unit tests.
…rations support) [part 2].

https://perconadev.atlassian.net/browse/PS-11266

Added streaming NN-search support for in-memory HNSW index.

Extended unit tests.
…rations support) [part 3].

https://perconadev.atlassian.net/browse/PS-11266

Added recall / memory / throughput benchmarks for our HNSW implementation
on a synthetic data-set.
@dlenev
dlenev requested a review from catalinbp August 13, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants