#34329·yugabyte-db

[DocDB][PgVector] A ybhnsw index dropped while a snapshot schedule keeps it is still updated on every write

Author: akshatha97-ybCreated Sep 28, 2026Updated Sep 29, 2026
Labelskind/bugarea/docdbpriority/mediumstatus/awaiting-triage

Jira Link: DB-23877

Description

When a database has a snapshot schedule, DROP INDEX on a ybhnsw index keeps the index hidden until the schedule's retention ends, so a restore can bring it back. During that time the tablets keep adding every new row of the table to the dropped index: they keep inserting into its graph, keep memory for its open chunk and write new chunk files, although nothing can use the index. Without a snapshot schedule the dropped index is gone within a minute.

This adds up where every database has a snapshot schedule, as with xCluster DR. In a DR stress run whose workload drops and re-creates vector indexes, an index dropped at 09:27 was still getting new chunks at 11:30, and 219 dropped index copies per primary node held about a third of the vector index memory. Together with #31838 (every open chunk reserves its full size) this took the nodes to their memory limit.

Steps to reproduce

sql
-- database db1 with a snapshot schedule: yb-admin create_snapshot_schedule 5 180 ysql.db1
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE t (id int PRIMARY KEY, embedding vector(8)) SPLIT INTO 3 TABLETS;
INSERT INTO t
  SELECT id, (SELECT array_agg(random() * 2 - 1) FROM generate_series(1, 8) WHERE id > 0)::vector
  FROM generate_series(1, 3000) AS g(id);
CREATE INDEX t_keep ON t USING ybhnsw (embedding vector_l2_ops);
CREATE INDEX t_drop_a ON t USING ybhnsw (embedding vector_ip_ops);
CREATE INDEX t_drop_b ON t USING ybhnsw (embedding vector_cosine_ops);
SELECT oid, relname FROM pg_class WHERE relname LIKE 't_%';  -- note the index oids
-- yb-admin flush_table ysql.db1 t
DROP INDEX t_drop_a;
DROP INDEX t_drop_b;
INSERT INTO t
  SELECT id, (SELECT array_agg(random() * 2 - 1) FROM generate_series(1, 8) WHERE id > 0)::vector
  FROM generate_series(3001, 6000) AS g(id);
-- yb-admin flush_table ysql.db1 t

Count each index's chunk files on every tserver:

ls <data dir>/yb-data/tserver/data/rocksdb/table-<table id>/tablet-*.vi-<index oid>/ | grep -c '^vectorindex_'

Expected: the dropped indexes' directories stay (for a restore) but get no new chunk files.

Actual: each dropped index went from 9 to 18 chunk files, the same as the kept index. In a second database without a snapshot schedule, the same steps leave no directories for the dropped indexes a minute after the drop.

What we see on 2.31.0.0-b479

Chunk files summed over the 3 tservers (3 tablets x RF3 = 9 copies per index):

Database Index After the build and a flush A minute after DROP INDEX After 3,000 new rows and a flush
with a snapshot schedule t_keep 9 9 18
with a snapshot schedule t_drop_a (dropped) 9 9 18
with a snapshot schedule t_drop_b (dropped) 9 9 18
without a schedule t_keep 9 9 18
without a schedule t_drop_a, t_drop_b (dropped) 9 0 0

Not checked

  • indexes on the usearch engine
  • 2026.1 and 2025.2 builds
  • how long the dropped index keeps being updated (the schedule's retention here was 3 hours)

Environment

2.31.0.0-b479 (master, 061caa5dd119fa07a6691b75924fe411968d0fdd) release build, AWS, RF3, one universe (no xCluster).