#53909·milvus

[Enhancement]: Primary key index: add the core storage library

Author: bigsheeperCreated Sep 29, 2026Updated Sep 29, 2026
Labelskind/enhancement

Is there an existing issue for this?

  • I have searched the existing issues

What would you like to be added?

A shared library under internal/pkindex, used later by the streaming node, the data node and recovery. It contains no node or RPC code and is not wired into any component yet.

  • core/codec: order-preserving encoding of int64 and varchar primary keys, and the value layout. The first byte of a value is a kind, and the tombstone kind lets a delete in a newer layer mask an older entry.
  • core/sst: pebble sstable read and write over local files. A table is named by a Milvus global ID. One options template pins the format version, the comparer and a whole-key bloom filter for every producer and consumer.
  • core/engine: a per-vchannel engine. Writes go to generations (pebble DBs with WAL and automatic compaction disabled). Reads also cover a read-only set of committed SST files that can be replaced atomically. The engine exposes two interfaces: RW for the write path, and Lifecycle, which moves data from the generations to the committed set without a write pause.
  • pkerr: error categories shared inside the tree, and the translation to merr at a boundary.

The design doc is docs/design-docs/design_docs/20260917-primary-key-index-core-library.md. The change adds github.com/cockroachdb/pebble v1.1.5 to the root module.

Why is this needed?

The write-path interceptor (#53594) keeps the index in memory, so the index is lost on every WAL open. This library is the storage layer that later makes the index persistent: frozen writes are flushed to SST files, uploaded, committed, and read back as the committed set.

Anything else?

Follow-ups, not in this change:

  • connect the write-path interceptor to this engine instead of its test-only memory engine
  • the handover driver: upload the flushed SST files, commit the manifest, then install the committed set
  • recovery of the index after a WAL open, as part of the WAL recovery framework
  • a pull-based iterator for the offline merge

Part of #52305