compile

package
v0.0.0-debug-20260702 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package compile implements the HNSW plugin's compile-layer (DDL) hooks.

HNSW is the most feature-rich vector index on the compile side:

  • Gated by the `experimental_hnsw_index` flag.
  • Skips initial population for CCPR (publication-sourced) tables.
  • Branches on sync vs async — async indexes don't run an immediate populate, only register a CDC task.
  • Registers an ISCP CDC task that maintains the hidden tables from the source table's CDC stream.

All of those features go through methods on CompileContext (see pkg/indexplugin/compile/hooks.go) so this package doesn't have to import pkg/sql/compile.

Lifted from:

  • pkg/sql/compile/ddl_index_algo.go:627 (handleVectorHnswIndex)
  • pkg/sql/compile/util.go:554,576 (gen{Delete,Build}HnswIndex)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks

type Hooks struct{}

func (Hooks) HandleCreateIndex

func (h Hooks) HandleCreateIndex(ctx compileplugin.CompileContext, indexDefs map[string]*plan.IndexDef) error

HandleCreateIndex is lifted from Scope.handleVectorHnswIndex (pkg/sql/compile/ddl_index_algo.go:627).

func (Hooks) HandleDropIndex

func (Hooks) HandleDropIndex(_ compileplugin.CompileContext, defs map[string]*plan.IndexDef) error

HandleDropIndex is a no-op: the generic CDC unregister path in pkg/sql/compile/ddl.go already calls DropIndexCdcTask during DROP INDEX (ddl.go:2511). This hook is the seam for any algorithm-specific cleanup not covered there.

func (Hooks) HandleReindex

func (h Hooks) HandleReindex(ctx compileplugin.CompileContext, indexDefs map[string]*plan.IndexDef, forceSync bool) error

HandleReindex: same code path as create, but honors forceSync so an ALTER REINDEX … FORCE_SYNC (e.g. restore's RestoreTable) rebuilds an always-async HNSW index synchronously instead of deferring to CDC.

func (Hooks) IdxcronMetadata

func (Hooks) IdxcronMetadata(_ compileplugin.CompileContext) ([]byte, error)

IdxcronMetadata: HNSW has no idxcron action (SyncDescriptor().IdxcronAction==""). This method is never called for HNSW.

func (Hooks) RestoreInitSQL

func (Hooks) RestoreInitSQL(ctx compileplugin.CompileContext, indexDefs map[string]*plan.IndexDef) (bool, string, error)

RestoreInitSQL — see CAGRA. Rebuilds the HNSW index post-commit during restore.

func (Hooks) ValidateReindexParams

func (Hooks) ValidateReindexParams(old map[string]string, alter compileplugin.ReindexParamUpdate) (map[string]string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL