yugabyte/yugabyte-db
GitHub で見る[YSQL] Inconsistent index created post huge restore
Open
#28,952 opened on 2025年10月15日
area/ysqlgood first issuekind/enhancementpriority/low
説明
Jira Link: DB-18684
Description
Version: 2.27.0.0-b590 Steps (simple repro at end)
- Restore huge backup (multi-table 2 TB backup)
- Create weird indexes, including timestamp columns.
Indexes created are inconsistent. Table schema -
Size: 2TB backup (6TB data on 3 nodes) | Tables: 30 (test_1...test_30)
Schema:
test_N (
k varchar NOT NULL,
v1 varchar, v2 int, v3 money, v4 jsonb, v5 timestamp, v6 text, v7 date,
v8 boolean, v9 test_enum, v10 time,
<pattern repeats for v11-v30: int, varchar×2, int, money, jsonb, timestamp, text, date, boolean, test_enum, time>
)
PRIMARY KEY (k HASH)
Index query -
CREATE INDEX test_20_idx_250649 ON test_20 (v1, extract(epoch from v5), v5, k, length(v6)) INCLUDE (v4, v10) ;
db=# select yb_index_check('test_20_idx_250649'::regclass);
ERROR: inconsistent index row due to binary mismatch of key attribute
DETAIL: index: 'test_20_idx_250649', ybbasectid: '\x4700195331326438313333662d393561352d343733312d386135612d3930633536633637316361613a3230383834363900002121', index attnum: 2
Another index query -
db=# CREATE INDEX test_20_idx_250649_sample1 ON test_20 (v1, extract(epoch from v5), v5, k, length(v6)) INCLUDE (v9, v10) ;
CREATE INDEX
db=# select yb_index_check('test_20_idx_250649_sample1'::regclass);
ERROR: inconsistent index row due to binary mismatch of key attribute
DETAIL: index: 'test_20_idx_250649_sample1', ybbasectid: '\x4700195331326438313333662d393561352d343733312d386135612d3930633536633637316361613a3230383834363900002121', index attnum: 2
During no point in test was there any nemesis involved.
Simple repro -
CREATE TABLE test (v5 timestamp);
INSERT INTO test SELECT NOW() - (random() * interval '365 days') AS v5 FROM generate_series(1, 10000);
CREATE INDEX test_idx ON test (extract(epoch from v5)) ;
select yb_index_check('test_idx'::regclass);
Tried this on 2024.2.4.0 and it didn't fail, so it is a regression
Issue Type
kind/bug
Warning: Please confirm that this issue does not contain any sensitive information
- I confirm this issue does not contain any sensitive information.