Files
greptimedb/tests/upgrade-compat/standalone/common/table_engine_0_10_2.result
discord9 421088a868 test: sqlness upgrade compatibility tests (#5126)
* feat: simple version switch

* chore: remove debug print

* chore: add common folder

* tests: add drop table

* feat: pull versioned binary

* chore: don't use native-tls

* chore: rm outdated docs

* chore: new line

* fix: save old bin dir

* fix: switch version restart all node

* feat: use etcd

* fix: wait for election

* fix: normal sqlness

* refactor: hashmap for bin dir

* test: past 3 major version compat crate table

* refactor: allow using without setup etcd
2024-12-17 07:00:02 +00:00

138 lines
5.6 KiB
Plaintext

-- SQLNESS ARG version=v0.10.2
CREATE TABLE mito_system_metrics (
host STRING,
idc STRING,
cpu_util DOUBLE,
memory_util DOUBLE,
disk_util DOUBLE,
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
PRIMARY KEY(host, idc),
TIME INDEX(ts)
)ENGINE=mito;
Affected Rows: 0
INSERT INTO mito_system_metrics
VALUES
("host1", "idc_a", 11.8, 10.3, 10.3, 1667446797450),
("host2", "idc_a", 80.0, 70.3, 90.0, 1667446797450),
("host1", "idc_b", 50.0, 66.7, 40.6, 1667446797450);
Affected Rows: 3
CREATE TABLE phy (ts timestamp time index, cpu_util double) engine=metric with ("physical_metric_table" = "");
Affected Rows: 0
CREATE TABLE system_metrics (
host STRING,
cpu_util DOUBLE,
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
PRIMARY KEY(host),
TIME INDEX(ts)
)ENGINE=metric with ("on_physical_table" = "phy");
Affected Rows: 0
INSERT INTO system_metrics (host, cpu_util, ts)
VALUES
('host1', 11.8, 1667446797450),
('host2', 80.0, 1667446797450),
('host1', 50.0, 1667446797450);
Affected Rows: 3
-- SQLNESS ARG version=latest
SHOW CREATE TABLE mito_system_metrics;
+---------------------+-----------------------------------------------------------+
| Table | Create Table |
+---------------------+-----------------------------------------------------------+
| mito_system_metrics | CREATE TABLE IF NOT EXISTS "mito_system_metrics" ( |
| | "host" STRING NULL, |
| | "idc" STRING NULL, |
| | "cpu_util" DOUBLE NULL, |
| | "memory_util" DOUBLE NULL, |
| | "disk_util" DOUBLE NULL, |
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
| | TIME INDEX ("ts"), |
| | PRIMARY KEY ("host", "idc") |
| | ) |
| | |
| | ENGINE=mito |
| | |
+---------------------+-----------------------------------------------------------+
SHOW CREATE TABLE system_metrics;
+----------------+-----------------------------------------------------------+
| Table | Create Table |
+----------------+-----------------------------------------------------------+
| system_metrics | CREATE TABLE IF NOT EXISTS "system_metrics" ( |
| | "cpu_util" DOUBLE NULL, |
| | "host" STRING NULL, |
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
| | TIME INDEX ("ts"), |
| | PRIMARY KEY ("host") |
| | ) |
| | |
| | ENGINE=metric |
| | WITH( |
| | on_physical_table = 'phy' |
| | ) |
+----------------+-----------------------------------------------------------+
INSERT INTO mito_system_metrics
VALUES
("host3", "idc_a", 90.0, 70.3, 90.0, 1667446797450),
("host4", "idc_a", 70.0, 70.3, 90.0, 1667446797450),
("host5", "idc_a", 60.0, 70.3, 90.0, 1667446797450);
Affected Rows: 3
INSERT INTO system_metrics (host, cpu_util, ts)
VALUES
('host3', 90.0, 1667446797450),
('host4', 70.0, 1667446797450),
('host5', 60.0, 1667446797450);
Affected Rows: 3
SELECT * FROM mito_system_metrics;
+-------+-------+----------+-------------+-----------+-------------------------+
| host | idc | cpu_util | memory_util | disk_util | ts |
+-------+-------+----------+-------------+-----------+-------------------------+
| host1 | idc_a | 11.8 | 10.3 | 10.3 | 2022-11-03T03:39:57.450 |
| host1 | idc_b | 50.0 | 66.7 | 40.6 | 2022-11-03T03:39:57.450 |
| host2 | idc_a | 80.0 | 70.3 | 90.0 | 2022-11-03T03:39:57.450 |
| host3 | idc_a | 90.0 | 70.3 | 90.0 | 2022-11-03T03:39:57.450 |
| host4 | idc_a | 70.0 | 70.3 | 90.0 | 2022-11-03T03:39:57.450 |
| host5 | idc_a | 60.0 | 70.3 | 90.0 | 2022-11-03T03:39:57.450 |
+-------+-------+----------+-------------+-----------+-------------------------+
SELECT * FROM system_metrics;
+----------+-------+-------------------------+
| cpu_util | host | ts |
+----------+-------+-------------------------+
| 80.0 | host2 | 2022-11-03T03:39:57.450 |
| 70.0 | host4 | 2022-11-03T03:39:57.450 |
| 60.0 | host5 | 2022-11-03T03:39:57.450 |
| 90.0 | host3 | 2022-11-03T03:39:57.450 |
| 50.0 | host1 | 2022-11-03T03:39:57.450 |
+----------+-------+-------------------------+
DROP TABLE mito_system_metrics;
Affected Rows: 0
DROP TABLE system_metrics;
Affected Rows: 0
DROP TABLE phy;
Affected Rows: 0