Skip to content

docs: add HNSW replication doc#7219

Open
BorysTheDev wants to merge 1 commit intomainfrom
add_HNSW_replication_doc
Open

docs: add HNSW replication doc#7219
BorysTheDev wants to merge 1 commit intomainfrom
add_HNSW_replication_doc

Conversation

@BorysTheDev
Copy link
Copy Markdown
Contributor

@BorysTheDev BorysTheDev commented Apr 24, 2026

Summary: Adds a design/spec document describing how Dragonfly replicates global HNSW vector indices during full sync.

Changes:

  • Defines the data model (shard-local DocId, encoded GlobalDocId, and global graph vs per-shard key index).
  • Specifies the RDB wire format: AUX fields (e.g. search-index, hnsw-index-metadata, shard-count) and custom opcodes for graph/mapping dumps.
  • Documents index states (kProhibit/kRestoring/kSerializing/kBuilding) and invariants used to keep dumps consistent under concurrent writes.
  • Describes master-side dump ordering (AUX → mappings → shard-0 graph dump → drain → key stream) and replica-side reconciliation/hydration.
  • Explains how shard-count mismatches trigger a remap of GlobalDocIds before installing the graph.
  • Notes version gating via VER6 capability and fallback behavior for older replicas / missing mappings.

Copilot AI review requested due to automatic review settings April 24, 2026 10:51
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Apr 24, 2026

🤖 Augment PR Summary

Summary: Adds a design/spec document describing how Dragonfly replicates global HNSW vector indices during full sync.

Changes:

  • Defines the data model (shard-local DocId, encoded GlobalDocId, and global graph vs per-shard key index).
  • Specifies the RDB wire format: AUX fields (e.g. search-index, hnsw-index-metadata, shard-count) and custom opcodes for graph/mapping dumps.
  • Documents index states (kProhibit/kRestoring/kSerializing/kBuilding) and invariants used to keep dumps consistent under concurrent writes.
  • Describes master-side dump ordering (AUX → mappings → shard-0 graph dump → drain → key stream) and replica-side reconciliation/hydration.
  • Explains how shard-count mismatches trigger a remap of GlobalDocIds before installing the graph.
  • Notes version gating via VER6 capability and fallback behavior for older replicas / missing mappings.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread docs/hnsw-index-replication.md Outdated
Comment thread docs/hnsw-index-replication.md Outdated
Comment thread docs/hnsw-index-replication.md Outdated
Comment thread docs/hnsw-index-replication.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new design/spec document describing how Dragonfly replicates global HNSW vector indices (graph + per-shard key→DocId mappings) via the RDB full-sync stream, including shard-count mismatch handling.

Changes:

  • Documented replication data model (GlobalDocId), wire format (AUX fields + opcodes 222/223), and restore protocol.
  • Defined shard-local HNSW lifecycle states/invariants relevant to concurrent writes during serialization/restore.
  • Specified a remap procedure for differing master/replica shard counts and version gating via VER6.

Comment thread docs/hnsw-index-replication.md Outdated
Comment thread docs/hnsw-index-replication.md Outdated
Comment thread docs/hnsw-index-replication.md Outdated
Comment thread docs/hnsw-index-replication.md Outdated
Comment thread docs/hnsw-index-replication.md Outdated
Comment thread docs/hnsw-index-replication.md Outdated
vyavdoshenko
vyavdoshenko previously approved these changes Apr 24, 2026
Copy link
Copy Markdown
Contributor

@vyavdoshenko vyavdoshenko left a comment

Choose a reason for hiding this comment

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

lgtm


| State | Initial condition | HNSW mutation behaviour |
|-------|-------------------|-------------------------|
| `kProhibit` | Default at index construction. | Buffered. |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The explanations here are not clear

Copy link
Copy Markdown
Collaborator

@romange romange left a comment

Choose a reason for hiding this comment

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

i strongly suggest introducing diagrams: either excalidraw or mermaid - see other docs how they do it.

@romange
Copy link
Copy Markdown
Collaborator

romange commented Apr 28, 2026

LGTM

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.

4 participants