test: run sqlness for flat format (#7178)

* test: support flat format in sqlness

Signed-off-by: evenyag <realevenyag@gmail.com>

* test: replace region stats test result with NUM

Signed-off-by: evenyag <realevenyag@gmail.com>

* ci: add flat format to sqlness ci

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
This commit is contained in:
Yingwen
2025-11-05 19:23:12 +08:00
committed by GitHub
parent 50c9600ef8
commit 0939dc1d32
8 changed files with 31 additions and 3 deletions

View File

@@ -613,6 +613,9 @@ jobs:
- name: "MySQL Kvbackend" - name: "MySQL Kvbackend"
opts: "--setup-mysql" opts: "--setup-mysql"
kafka: false kafka: false
- name: "Flat format"
opts: "--enable-flat-format"
kafka: false
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -808,7 +811,7 @@ jobs:
- name: Setup external services - name: Setup external services
working-directory: tests-integration/fixtures working-directory: tests-integration/fixtures
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait
- name: Run nextest cases - name: Run nextest cases
run: cargo llvm-cov nextest --workspace --lcov --output-path lcov.info -F dashboard -F pg_kvbackend -F mysql_kvbackend run: cargo llvm-cov nextest --workspace --lcov --output-path lcov.info -F dashboard -F pg_kvbackend -F mysql_kvbackend
env: env:

View File

@@ -22,6 +22,7 @@ INSERT INTO test VALUES
Affected Rows: 3 Affected Rows: 3
-- SQLNESS SLEEP 3s -- SQLNESS SLEEP 3s
-- SQLNESS REPLACE (\s+\d+\s+) <NUM>
-- For regions using different WAL implementations, the manifest size may vary. -- For regions using different WAL implementations, the manifest size may vary.
-- The remote WAL implementation additionally stores a flushed entry ID when creating the manifest. -- The remote WAL implementation additionally stores a flushed entry ID when creating the manifest.
SELECT SUM(region_rows),SUM(written_bytes_since_open), SUM(memtable_size), SUM(sst_size), SUM(index_size) SELECT SUM(region_rows),SUM(written_bytes_since_open), SUM(memtable_size), SUM(sst_size), SUM(index_size)
@@ -31,15 +32,16 @@ SELECT SUM(region_rows),SUM(written_bytes_since_open), SUM(memtable_size), SUM(s
+-------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------+----------------------------------------------------+------------------------------------------------------+ +-------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------+----------------------------------------------------+------------------------------------------------------+
| sum(information_schema.region_statistics.region_rows) | sum(information_schema.region_statistics.written_bytes_since_open) | sum(information_schema.region_statistics.memtable_size) | sum(information_schema.region_statistics.sst_size) | sum(information_schema.region_statistics.index_size) | | sum(information_schema.region_statistics.region_rows) | sum(information_schema.region_statistics.written_bytes_since_open) | sum(information_schema.region_statistics.memtable_size) | sum(information_schema.region_statistics.sst_size) | sum(information_schema.region_statistics.index_size) |
+-------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------+----------------------------------------------------+------------------------------------------------------+ +-------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------+----------------------------------------------------+------------------------------------------------------+
| 3 | 78 | 78 | 0 | 0 | |<NUM>|<NUM>|<NUM>|<NUM>|<NUM>|
+-------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------+----------------------------------------------------+------------------------------------------------------+ +-------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------+----------------------------------------------------+------------------------------------------------------+
-- SQLNESS REPLACE (\s+\d+\s+) <NUM>
SELECT data_length, index_length, avg_row_length, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'test'; SELECT data_length, index_length, avg_row_length, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'test';
+-------------+--------------+----------------+------------+ +-------------+--------------+----------------+------------+
| data_length | index_length | avg_row_length | table_rows | | data_length | index_length | avg_row_length | table_rows |
+-------------+--------------+----------------+------------+ +-------------+--------------+----------------+------------+
| 0 | 0 | 26 | 3 | |<NUM>|<NUM>|<NUM>|<NUM>|
+-------------+--------------+----------------+------------+ +-------------+--------------+----------------+------------+
DROP TABLE test; DROP TABLE test;

View File

@@ -17,12 +17,14 @@ INSERT INTO test VALUES
(21, 'c', 21); (21, 'c', 21);
-- SQLNESS SLEEP 3s -- SQLNESS SLEEP 3s
-- SQLNESS REPLACE (\s+\d+\s+) <NUM>
-- For regions using different WAL implementations, the manifest size may vary. -- For regions using different WAL implementations, the manifest size may vary.
-- The remote WAL implementation additionally stores a flushed entry ID when creating the manifest. -- The remote WAL implementation additionally stores a flushed entry ID when creating the manifest.
SELECT SUM(region_rows),SUM(written_bytes_since_open), SUM(memtable_size), SUM(sst_size), SUM(index_size) SELECT SUM(region_rows),SUM(written_bytes_since_open), SUM(memtable_size), SUM(sst_size), SUM(index_size)
FROM INFORMATION_SCHEMA.REGION_STATISTICS WHERE table_id FROM INFORMATION_SCHEMA.REGION_STATISTICS WHERE table_id
IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'test' and table_schema = 'public'); IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'test' and table_schema = 'public');
-- SQLNESS REPLACE (\s+\d+\s+) <NUM>
SELECT data_length, index_length, avg_row_length, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'test'; SELECT data_length, index_length, avg_row_length, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'test';
DROP TABLE test; DROP TABLE test;

View File

@@ -3,6 +3,12 @@ mode = 'distributed'
require_lease_before_startup = true require_lease_before_startup = true
rpc_runtime_size = 8 rpc_runtime_size = 8
[[region_engine]]
[region_engine.mito]
{{ if enable_flat_format }}
default_experimental_flat_format = true
{{ endif }}
[wal] [wal]
{{ if is_raft_engine }} {{ if is_raft_engine }}
provider = "raft_engine" provider = "raft_engine"

View File

@@ -2,6 +2,12 @@ mode = 'standalone'
enable_memory_catalog = false enable_memory_catalog = false
require_lease_before_startup = true require_lease_before_startup = true
[[region_engine]]
[region_engine.mito]
{{ if enable_flat_format }}
default_experimental_flat_format = true
{{ endif }}
[wal] [wal]
{{ if is_raft_engine }} {{ if is_raft_engine }}
provider = "raft_engine" provider = "raft_engine"

View File

@@ -102,6 +102,10 @@ pub struct BareCommand {
/// Extra command line arguments when starting GreptimeDB binaries. /// Extra command line arguments when starting GreptimeDB binaries.
#[clap(long)] #[clap(long)]
extra_args: Vec<String>, extra_args: Vec<String>,
/// Enable flat format for storage engine (sets default_experimental_flat_format = true).
#[clap(long, default_value = "false")]
enable_flat_format: bool,
} }
impl BareCommand { impl BareCommand {
@@ -170,6 +174,7 @@ impl BareCommand {
setup_etcd: self.setup_etcd, setup_etcd: self.setup_etcd,
setup_pg: self.setup_pg, setup_pg: self.setup_pg,
setup_mysql: self.setup_mysql, setup_mysql: self.setup_mysql,
enable_flat_format: self.enable_flat_format,
}; };
let runner = Runner::new( let runner = Runner::new(

View File

@@ -76,6 +76,7 @@ pub struct StoreConfig {
pub setup_etcd: bool, pub setup_etcd: bool,
pub(crate) setup_pg: Option<ServiceProvider>, pub(crate) setup_pg: Option<ServiceProvider>,
pub(crate) setup_mysql: Option<ServiceProvider>, pub(crate) setup_mysql: Option<ServiceProvider>,
pub enable_flat_format: bool,
} }
#[derive(Clone)] #[derive(Clone)]

View File

@@ -105,6 +105,8 @@ struct ConfigContext {
mysql_addr: String, mysql_addr: String,
// for standalone // for standalone
postgres_addr: String, postgres_addr: String,
// enable flat format for storage engine
enable_flat_format: bool,
} }
impl ServerMode { impl ServerMode {
@@ -328,6 +330,7 @@ impl ServerMode {
grpc_addr, grpc_addr,
mysql_addr, mysql_addr,
postgres_addr, postgres_addr,
enable_flat_format: db_ctx.store_config().enable_flat_format,
}; };
let rendered = tt.render(self.name(), &ctx).unwrap(); let rendered = tt.render(self.name(), &ctx).unwrap();