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

@@ -22,6 +22,7 @@ INSERT INTO test VALUES
Affected Rows: 3
-- SQLNESS SLEEP 3s
-- SQLNESS REPLACE (\s+\d+\s+) <NUM>
-- 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.
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) |
+-------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------+----------------------------------------------------+------------------------------------------------------+
| 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';
+-------------+--------------+----------------+------------+
| data_length | index_length | avg_row_length | table_rows |
+-------------+--------------+----------------+------------+
| 0 | 0 | 26 | 3 |
|<NUM>|<NUM>|<NUM>|<NUM>|
+-------------+--------------+----------------+------------+
DROP TABLE test;

View File

@@ -17,12 +17,14 @@ INSERT INTO test VALUES
(21, 'c', 21);
-- SQLNESS SLEEP 3s
-- SQLNESS REPLACE (\s+\d+\s+) <NUM>
-- 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.
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
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';
DROP TABLE test;

View File

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

View File

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

View File

@@ -102,6 +102,10 @@ pub struct BareCommand {
/// Extra command line arguments when starting GreptimeDB binaries.
#[clap(long)]
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 {
@@ -170,6 +174,7 @@ impl BareCommand {
setup_etcd: self.setup_etcd,
setup_pg: self.setup_pg,
setup_mysql: self.setup_mysql,
enable_flat_format: self.enable_flat_format,
};
let runner = Runner::new(

View File

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

View File

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