mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-12-04 00:15:29 +00:00
* test(compat): downgrade to v1.2.1 instead of v1.1.4 SSTs written since #10528 can have inverted-index segments that cross row group boundaries. Readers older than v1.2.0 do not split such segments and return fewer rows, so v1.1.x is no longer a supported downgrade target. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(cmd): record the decoded row group size of a replacement SST sst_replace set max_row_group_decoded_size to 0 for the replacement file. Compute it from the replacement footer with the helper writers use, which is now public in mito2. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): derive decoded value bytes from size statistics for old SSTs SSTs written before #10528 have no greptime:max_row_group_value_bytes or greptime:max_row_value_width footer keys, so a row group of repeated large dictionary-encoded values was sized by its encoded bytes on the first compaction and read after upgrade. When the keys are absent, sum the unencoded_byte_array_data_bytes size statistic of each row group's byte array column chunks instead, skipping columns that readers decode as Arrow dictionaries like the writer does. Parquet writers record the statistic whenever column statistics are enabled, which mito did by default with parquet >= 53 (v0.12.0). Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): count only top-level var-len columns in the size statistics fallback The fallback summed every non-dictionary byte array leaf, including leaves nested in structs such as JSON2 columns, which the footer keys do not count. New files without var-len values write no keys, so they took the fallback and got a larger decoded size than before. Count only leaves that are top-level string or binary columns, which matches var_len_value_bytes and leaves key-less new files unchanged. Drop the early exit, which dictionary primary keys defeated anyway. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(mito2): index the Arrow schema by root column in the size statistics fallback Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(compat): look up an inverted index segment that crosses a row group boundary after downgrade Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(compat): also downgrade to v1.2.0, the oldest reader that splits index segments Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): treat unparseable footer size keys as absent Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * docs(compat): state the v1.2.0 downgrade floor Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
90 lines
2.8 KiB
SQL
90 lines
2.8 KiB
SQL
CREATE TABLE t_downgrade_compatibility(
|
|
ts TIMESTAMP TIME INDEX,
|
|
host STRING PRIMARY KEY,
|
|
val INT
|
|
);
|
|
|
|
INSERT INTO t_downgrade_compatibility VALUES
|
|
('2024-02-09 00:00:00+0000', 'host_a', 1),
|
|
('2024-02-09 00:01:00+0000', 'host_b', 2);
|
|
|
|
ADMIN FLUSH_TABLE('t_downgrade_compatibility');
|
|
|
|
CREATE TABLE t_preserve_sequence_downgrade(
|
|
ts TIMESTAMP TIME INDEX,
|
|
host STRING,
|
|
val INT,
|
|
PRIMARY KEY(host)
|
|
)
|
|
ENGINE=mito
|
|
WITH(append_mode='true', preserve_row_sequence='true');
|
|
|
|
INSERT INTO t_preserve_sequence_downgrade VALUES
|
|
('2024-02-09 00:00:00+0000', 'host_a', 1),
|
|
('2024-02-09 00:01:00+0000', 'host_b', 2);
|
|
|
|
ADMIN FLUSH_TABLE('t_preserve_sequence_downgrade');
|
|
|
|
INSERT INTO t_preserve_sequence_downgrade VALUES
|
|
('2024-02-09 00:02:00+0000', 'host_a', 3),
|
|
('2024-02-09 00:03:00+0000', 'host_c', 4);
|
|
|
|
ADMIN FLUSH_TABLE('t_preserve_sequence_downgrade');
|
|
|
|
ADMIN COMPACT_TABLE('t_preserve_sequence_downgrade');
|
|
|
|
CREATE TABLE t_sst_float_field_encoding_downgrade(
|
|
ts TIMESTAMP TIME INDEX,
|
|
host STRING PRIMARY KEY,
|
|
f FLOAT,
|
|
d DOUBLE
|
|
) ENGINE=mito
|
|
WITH('experimental_sst_float_field_encoding'='byte_stream_split');
|
|
|
|
INSERT INTO t_sst_float_field_encoding_downgrade VALUES
|
|
('2024-02-10 00:00:00+0000', 'host_a', 1.25, 10.5),
|
|
('2024-02-10 00:01:00+0000', 'host_b', -2.5, 20.25),
|
|
('2024-02-10 00:02:00+0000', 'host_c', NULL, NULL);
|
|
|
|
ADMIN FLUSH_TABLE('t_sst_float_field_encoding_downgrade');
|
|
|
|
CREATE TABLE t_fulltext_bloom_v2_downgrade (
|
|
ts TIMESTAMP TIME INDEX,
|
|
msg STRING FULLTEXT INDEX WITH(analyzer = 'English', backend = 'bloom', case_sensitive = 'false')
|
|
);
|
|
|
|
INSERT INTO t_fulltext_bloom_v2_downgrade VALUES
|
|
(1, 'hello_world'),
|
|
(2, '错误error日志');
|
|
|
|
ADMIN FLUSH_TABLE('t_fulltext_bloom_v2_downgrade');
|
|
|
|
CREATE TABLE t_column_encoding_downgrade (
|
|
ts TIMESTAMP TIME INDEX,
|
|
span_id STRING COMPRESSION WITH (encoding = 'plain', page_size = '64KiB'),
|
|
ts_end TIMESTAMP(9) COMPRESSION WITH (encoding = 'delta_binary_packed')
|
|
);
|
|
|
|
INSERT INTO t_column_encoding_downgrade VALUES (1, 'a1', 1000), (2, 'a2', 2000), (3, NULL, NULL);
|
|
|
|
ADMIN FLUSH_TABLE('t_column_encoding_downgrade');
|
|
|
|
-- Row groups of 10 rows and index segments of 4 rows: the segment covering rows [8, 12)
|
|
-- crosses the first row group boundary.
|
|
CREATE TABLE t_inverted_segment_downgrade (
|
|
ts TIMESTAMP TIME INDEX,
|
|
label STRING INVERTED INDEX
|
|
) WITH (
|
|
'append_mode' = 'true',
|
|
'max_row_group_row_count' = '10',
|
|
'index.inverted_index.segment_row_count' = '4'
|
|
);
|
|
|
|
INSERT INTO t_inverted_segment_downgrade VALUES
|
|
(0, 'miss'), (1, 'miss'), (2, 'miss'), (3, 'miss'), (4, 'miss'),
|
|
(5, 'miss'), (6, 'miss'), (7, 'miss'), (8, 'hit'), (9, 'hit'),
|
|
(10, 'hit'), (11, 'hit'), (12, 'miss'), (13, 'miss'), (14, 'miss'),
|
|
(15, 'miss'), (16, 'miss'), (17, 'miss'), (18, 'miss'), (19, 'miss');
|
|
|
|
ADMIN FLUSH_TABLE('t_inverted_segment_downgrade');
|