mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-26 12:44:10 +00:00
* test: add inverted index compatibility case (#5188) Signed-off-by: NightG1owZ <316247938+NightG1owZ@users.noreply.github.com> * test(compat): assert the newly indexed column stays queryable (#9535) Signed-off-by: NightG1owZ <316247938+NightG1owZ@users.noreply.github.com> * test(compat): narrow to_range to versions carrying #9545 The filtered read added in the previous commit only returns rows once #9545 is present. That fix is on main only (no backport-* labels), so it ships in the v1.4.0 line. Narrow to_range to >=v1.4.0-alpha.0 so the documented downgrade invocation (--to-version v1.1.4) is not broken. Also add the missing trailing newline to the three case files. Signed-off-by: NightG1owZ <316247938+NightG1owZ@users.noreply.github.com> --------- Signed-off-by: NightG1owZ <316247938+NightG1owZ@users.noreply.github.com> Co-authored-by: NightG1owZ <316247938+NightG1owZ@users.noreply.github.com>
51 lines
1.5 KiB
SQL
51 lines
1.5 KiB
SQL
-- 1. Index metadata written by the old binary must survive.
|
|
SHOW CREATE TABLE t_inverted_index_survival;
|
|
|
|
-- 2. Rows written by the old binary must still be readable.
|
|
SELECT host, msg, cpu
|
|
FROM t_inverted_index_survival
|
|
ORDER BY host, ts;
|
|
|
|
-- 3. Filtered read on the column indexed by the old binary.
|
|
SELECT host, msg
|
|
FROM t_inverted_index_survival
|
|
WHERE msg = 'first event'
|
|
ORDER BY host, ts;
|
|
|
|
-- 4. The new binary must still be able to write into the old table.
|
|
INSERT INTO t_inverted_index_survival VALUES
|
|
('h3', 'third event', 'third note', '2026-07-07 00:02:00+0000', 3.0);
|
|
|
|
SELECT host, msg, cpu
|
|
FROM t_inverted_index_survival
|
|
ORDER BY host, ts;
|
|
|
|
-- 5. Enabling an index on an existing column must keep SSTs written before the
|
|
-- index existed readable (regression guard for #9535). 'first note' and
|
|
-- 'second note' live in the SST written by the old binary, which carries
|
|
-- inverted indexes for host/msg but not for msg2.
|
|
ALTER TABLE t_inverted_index_survival MODIFY COLUMN msg2 SET INVERTED INDEX;
|
|
|
|
SHOW CREATE TABLE t_inverted_index_survival;
|
|
|
|
SELECT host, msg2
|
|
FROM t_inverted_index_survival
|
|
WHERE msg2 = 'first note'
|
|
ORDER BY host, ts;
|
|
|
|
SELECT host, msg2
|
|
FROM t_inverted_index_survival
|
|
WHERE msg2 = 'second note'
|
|
ORDER BY host, ts;
|
|
|
|
-- A non-matching predicate must still return nothing.
|
|
SELECT host, msg2
|
|
FROM t_inverted_index_survival
|
|
WHERE msg2 = 'no such note'
|
|
ORDER BY host, ts;
|
|
|
|
-- 6. The index can still be removed afterwards.
|
|
ALTER TABLE t_inverted_index_survival MODIFY COLUMN msg2 UNSET INVERTED INDEX;
|
|
|
|
SHOW CREATE TABLE t_inverted_index_survival;
|