From 2a62d3f3ce30fdfc9be794016af5e49d569ae355 Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Fri, 4 Sep 2026 17:10:32 +0800 Subject: [PATCH] test(compat): cover float SST encoding Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --- .../cases/downgrade_compatibility/case.toml | 4 ++-- .../cases/downgrade_compatibility/setup.sql | 15 +++++++++++++++ .../cases/downgrade_compatibility/verify.result | 12 ++++++++++++ .../cases/downgrade_compatibility/verify.sql | 4 ++++ .../sst_float_field_encoding_upgrade/case.toml | 8 ++++++++ .../sst_float_field_encoding_upgrade/setup.sql | 13 +++++++++++++ .../verify.result | 11 +++++++++++ .../sst_float_field_encoding_upgrade/verify.sql | 3 +++ 8 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 tests/compatibility/cases/sst_float_field_encoding_upgrade/case.toml create mode 100644 tests/compatibility/cases/sst_float_field_encoding_upgrade/setup.sql create mode 100644 tests/compatibility/cases/sst_float_field_encoding_upgrade/verify.result create mode 100644 tests/compatibility/cases/sst_float_field_encoding_upgrade/verify.sql diff --git a/tests/compatibility/cases/downgrade_compatibility/case.toml b/tests/compatibility/cases/downgrade_compatibility/case.toml index ba5ee5065ed..ab0496e523d 100644 --- a/tests/compatibility/cases/downgrade_compatibility/case.toml +++ b/tests/compatibility/cases/downgrade_compatibility/case.toml @@ -1,8 +1,8 @@ name = "downgrade_compatibility" -reason = "Verify v1.1.4 can reopen a table whose region WAL options were written by the current binary, and can read all rows of an append-only table flushed and compacted with preserve_row_sequence enabled." +reason = "Verify v1.1.4 can reopen tables whose region WAL options or byte-stream-split (BSS) float SSTs were written by the current binary, and can read all rows of an append-only table flushed and compacted with preserve_row_sequence enabled." introduced_by = "fix: preserve legacy region WAL options format; preserve_row_sequence" topologies = ["distributed", "standalone"] from_range = [">=v1.2.0"] to_range = ["=v1.1.4"] -features = ["table", "wal", "downgrade", "append", "preserve_row_sequence"] +features = ["table", "wal", "downgrade", "append", "preserve_row_sequence", "sst", "float", "byte_stream_split"] owner = "metasrv" diff --git a/tests/compatibility/cases/downgrade_compatibility/setup.sql b/tests/compatibility/cases/downgrade_compatibility/setup.sql index a9415570d31..267466f9dfe 100644 --- a/tests/compatibility/cases/downgrade_compatibility/setup.sql +++ b/tests/compatibility/cases/downgrade_compatibility/setup.sql @@ -32,3 +32,18 @@ INSERT INTO t_preserve_sequence_downgrade VALUES 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'); diff --git a/tests/compatibility/cases/downgrade_compatibility/verify.result b/tests/compatibility/cases/downgrade_compatibility/verify.result index 3c052392927..ae1b9033a78 100644 --- a/tests/compatibility/cases/downgrade_compatibility/verify.result +++ b/tests/compatibility/cases/downgrade_compatibility/verify.result @@ -17,3 +17,15 @@ SELECT ts, host, val FROM t_preserve_sequence_downgrade ORDER BY ts, host; | 2024-02-09T00:02:00 | host_a | 3 | | 2024-02-09T00:03:00 | host_c | 4 | +---------------------+--------+-----+ + +SELECT ts, host, f, d +FROM t_sst_float_field_encoding_downgrade +ORDER BY ts, host; + ++---------------------+--------+------+------+ +| ts | host | f | d | ++---------------------+--------+------+------+ +| 2024-02-10T00:00:00 | host_a | 1.25 | 10.5 | +| 2024-02-10T00:01:00 | host_b | -2.5 | 20.25 | +| 2024-02-10T00:02:00 | host_c | | | ++---------------------+--------+------+------+ diff --git a/tests/compatibility/cases/downgrade_compatibility/verify.sql b/tests/compatibility/cases/downgrade_compatibility/verify.sql index 764968bf1b8..6b73c886117 100644 --- a/tests/compatibility/cases/downgrade_compatibility/verify.sql +++ b/tests/compatibility/cases/downgrade_compatibility/verify.sql @@ -1,3 +1,7 @@ SELECT ts, host, val FROM t_downgrade_compatibility ORDER BY ts, host; SELECT ts, host, val FROM t_preserve_sequence_downgrade ORDER BY ts, host; + +SELECT ts, host, f, d +FROM t_sst_float_field_encoding_downgrade +ORDER BY ts, host; diff --git a/tests/compatibility/cases/sst_float_field_encoding_upgrade/case.toml b/tests/compatibility/cases/sst_float_field_encoding_upgrade/case.toml new file mode 100644 index 00000000000..4f008775bb2 --- /dev/null +++ b/tests/compatibility/cases/sst_float_field_encoding_upgrade/case.toml @@ -0,0 +1,8 @@ +name = "sst_float_field_encoding_upgrade" +reason = "Verify newer binaries can read default-encoded Mito SSTs containing FLOAT and DOUBLE fields written by older binaries." +introduced_by = "experimental_sst_float_field_encoding" +topologies = ["distributed", "standalone"] +from_range = ["*"] +to_range = ["*"] +features = ["table", "sst", "float", "upgrade"] +owner = "storage" diff --git a/tests/compatibility/cases/sst_float_field_encoding_upgrade/setup.sql b/tests/compatibility/cases/sst_float_field_encoding_upgrade/setup.sql new file mode 100644 index 00000000000..a84b4339dfc --- /dev/null +++ b/tests/compatibility/cases/sst_float_field_encoding_upgrade/setup.sql @@ -0,0 +1,13 @@ +CREATE TABLE t_sst_float_field_encoding_upgrade( + ts TIMESTAMP TIME INDEX, + host STRING PRIMARY KEY, + f FLOAT, + d DOUBLE +) ENGINE=mito; + +INSERT INTO t_sst_float_field_encoding_upgrade 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_upgrade'); diff --git a/tests/compatibility/cases/sst_float_field_encoding_upgrade/verify.result b/tests/compatibility/cases/sst_float_field_encoding_upgrade/verify.result new file mode 100644 index 00000000000..51fa220430f --- /dev/null +++ b/tests/compatibility/cases/sst_float_field_encoding_upgrade/verify.result @@ -0,0 +1,11 @@ +SELECT ts, host, f, d +FROM t_sst_float_field_encoding_upgrade +ORDER BY ts, host; + ++---------------------+--------+------+------+ +| ts | host | f | d | ++---------------------+--------+------+------+ +| 2024-02-10T00:00:00 | host_a | 1.25 | 10.5 | +| 2024-02-10T00:01:00 | host_b | -2.5 | 20.25 | +| 2024-02-10T00:02:00 | host_c | | | ++---------------------+--------+------+------+ diff --git a/tests/compatibility/cases/sst_float_field_encoding_upgrade/verify.sql b/tests/compatibility/cases/sst_float_field_encoding_upgrade/verify.sql new file mode 100644 index 00000000000..81822cb0ac8 --- /dev/null +++ b/tests/compatibility/cases/sst_float_field_encoding_upgrade/verify.sql @@ -0,0 +1,3 @@ +SELECT ts, host, f, d +FROM t_sst_float_field_encoding_upgrade +ORDER BY ts, host;