-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: past 3 major version compat crate table
- Loading branch information
Showing
8 changed files
with
615 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
tests/upgrade-compat/standalone/common/table_engine_0_10_2.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
-- 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 | ||
|
60 changes: 60 additions & 0 deletions
60
tests/upgrade-compat/standalone/common/table_engine_0_10_2.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
-- 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; | ||
|
||
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); | ||
|
||
CREATE TABLE phy (ts timestamp time index, cpu_util double) engine=metric with ("physical_metric_table" = ""); | ||
|
||
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"); | ||
|
||
INSERT INTO system_metrics (host, cpu_util, ts) | ||
VALUES | ||
('host1', 11.8, 1667446797450), | ||
('host2', 80.0, 1667446797450), | ||
('host1', 50.0, 1667446797450); | ||
|
||
-- SQLNESS ARG version=latest | ||
SHOW CREATE TABLE mito_system_metrics; | ||
|
||
SHOW CREATE TABLE system_metrics; | ||
|
||
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); | ||
|
||
INSERT INTO system_metrics (host, cpu_util, ts) | ||
VALUES | ||
('host3', 90.0, 1667446797450), | ||
('host4', 70.0, 1667446797450), | ||
('host5', 60.0, 1667446797450); | ||
|
||
SELECT * FROM mito_system_metrics; | ||
|
||
SELECT * FROM system_metrics; | ||
|
||
DROP TABLE mito_system_metrics; | ||
|
||
DROP TABLE system_metrics; | ||
|
||
DROP TABLE phy; |
Oops, something went wrong.