[DocDB][PgVector] ybhnsw CREATE INDEX keeps running until its timeout after a short network cut, although every tablet has built the index
Jira Link: DB-23905
Description
A ybhnsw CREATE INDEX can fail on its timeout after a short network cut between two tservers, although every tablet has finished building the index.
After the network comes back, the tserver that runs the CREATE INDEX session keeps logging PollVectorIndexReady: No leader for <tablet> for one tablet, about 10 times a second, until the deadline. That tablet kept the same leader the whole time, and the leader finished building its part of the index a few seconds after the network came back. The poll then ends with done, ready = 0 and CREATE INDEX fails.
Steps to reproduce
- RF3 universe with 3 tservers. Create a table with 3 tablets and load some vectors:
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE vec_ci_part_1 (id int PRIMARY KEY, embedding vector(8)) SPLIT INTO 3 TABLETS;
INSERT INTO vec_ci_part_1
SELECT id, (SELECT array_agg(random() * 2 - 1) FROM generate_series(1, 8) WHERE id > 0)::vector
FROM generate_series(1, 30000) AS g(id);- Pick a tablet whose leader is on tserver Y, and another tserver X (neither of them the master leader).
- Drop all traffic between X and Y in both directions (for example with
iptables -A INPUT -s <Y> -j DROPandiptables -A OUTPUT -d <Y> -j DROPon X). Keep some other queries going through X while the network is cut. - 5 seconds later, from a YSQL session on X:
CREATE INDEX vec_ci_part_1_l2 ON vec_ci_part_1 USING ybhnsw (embedding vector_l2_ops) WITH (m = 16, ef_construction = 64);- Restore the network after 5 minutes.
Expected: CREATE INDEX returns within a few seconds of the network coming back.
Actual: in 1 of 3 rounds it kept running. X's tserver logged PollVectorIndexReady: No leader for 0090478137f049a5b1b29027c2acc5f7 11,905 times over the next 20 minutes, the poll ended with done, ready = 0, and CREATE INDEX failed with canceling statement due to statement timeout 25 minutes after it started. In the other 2 rounds, CREATE INDEX finished 3-4 seconds after the network came back.
What we see on 2.31.0.0-b479
| Round | Network cut | CREATE INDEX |
|---|---|---|
| 1 | 5 minutes | still running 3 minutes after the network came back; failed on the statement timeout after 25 minutes |
| 2 | 5 minutes | finished 3.7 s after the network came back |
| 3 | 5 minutes | finished 3.6 s after the network came back |
Round 1, in UTC:
19:00:12 network between X and Y cut
19:05:10 network restored
19:05:16 Y (leader of 0090478137..., same leader and term since 19:00:08):
Backfill: Backfilled ... VI 00004000000030008000000000004001
19:05:16 X: PollVectorIndexReady: No leader for 0090478137f049a5b1b29027c2acc5f7
... (11,905 times, about 10 per second)
19:25:19 X: PollVectorIndexReady: Table id: 00004000000030008000000000004001 done, ready = 0
19:25:19 ERROR: canceling statement due to statement timeout
STATEMENT: CREATE INDEX vec_ci_part_1_l2 ON vec_ci_part_1 USING ybhnsw (...)During the cut, X's tserver log also shows it marking Y as unreachable, about every 15 seconds.
A stress run with a 5-minute network partition between two nodes failed the same way. There, CREATE INDEX failed with PollVectorIndexReady RPC ... timed out after 602.000s, 5 minutes after the network was back, although every tablet copy had built the index. The same repro with a 60-second cut was not stuck in any of 3 rounds.
Not checked
- indexes on the usearch engine
- 2026.1 and 2025.2 builds
Environment
2.31.0.0-b479 (master, 061caa5dd119fa07a6691b75924fe411968d0fdd) release build, AWS, RF3, c5.xlarge, one universe (no xCluster). Tservers run with --vmodule=pg_client_service=4, which prints the No leader for lines.
Source: yugabyte/yugabyte-db