mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-03 10:35:35 +00:00
test: remove unused legacy compatibility test suites (#9378)
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
# GreptimeDB compatibility test
|
||||
|
||||
The compatibility test check whether a newer version of GreptimeDB can read from the data written by an old version of
|
||||
GreptimeDB (the "backward" compatibility), and vice-versa (the "forward" compatibility). It's often ran in the Github
|
||||
Actions to ensure there are no breaking changes by accident.
|
||||
|
||||
The test work like this: reuse the sqlness-runner two times but each for a read or write side. For example, if we are
|
||||
testing backward compatibility, we use sqlness-runner to run the SQLs with writes against the old GreptimeDB binary, and
|
||||
use the same sqlness-runner to run the SQLs with reads against the new GreptimeDB binary. If the reads were executed
|
||||
expectedly, we have achieved backward compatibility.
|
||||
|
||||
This compatibility test is inspired by [Databend](https://github.com/datafuselabs/databend/).
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
tests/compat/test-compat.sh <old_ver>
|
||||
```
|
||||
|
||||
E.g. `tests/compat/test-compat.sh 0.6.0` tests if the data written by GreptimeDB **v0.6.0** can be read by **current**
|
||||
version of GreptimeDB, and vice-versa. By "current", it's meant the fresh binary built by current codes.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Current version of GreptimeDB's binaries must reside in `./bins`:
|
||||
|
||||
- `./bins/current/greptime`
|
||||
- `./bins/current/sqlness-runner`
|
||||
|
||||
The steps in Github Action already assure that. When running in local host, you have to `cp` them from target directory
|
||||
manually.
|
||||
@@ -1,13 +0,0 @@
|
||||
select ts, i, s, f from foo order by ts;
|
||||
|
||||
+---------------------+---+----------+-----+
|
||||
| ts | i | s | f |
|
||||
+---------------------+---+----------+-----+
|
||||
| 2024-02-01T17:00:00 | 1 | my_tag_1 | |
|
||||
| 2024-02-01T18:00:00 | 2 | my_tag_2 | |
|
||||
| 2024-02-01T19:00:00 | 3 | my_tag_3 | |
|
||||
| 2024-02-01T20:00:00 | 4 | my_tag_4 | 4.4 |
|
||||
| 2024-02-01T21:00:00 | 5 | my_tag_5 | 5.5 |
|
||||
| 2024-02-01T22:00:00 | 6 | my_tag_6 | 6.6 |
|
||||
+---------------------+---+----------+-----+
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
select ts, i, s, f from foo order by ts;
|
||||
@@ -1,25 +0,0 @@
|
||||
create table foo(ts timestamp time index, s string primary key, i int);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
insert into foo values
|
||||
("2024-02-02 01:00:00+0800", "my_tag_1", 1),
|
||||
("2024-02-02 02:00:00+0800", "my_tag_2", 2),
|
||||
("2024-02-02 03:00:00+0800", "my_tag_3", 3);
|
||||
|
||||
Affected Rows: 3
|
||||
|
||||
-- Alter the table to trigger a flush (will be executed before process being terminated).
|
||||
-- Otherwise the SST might not be generated (the data could be remained in WAL).
|
||||
-- If we have the explicitly flush table interface in the future, it's still good to have the alter table in the test.
|
||||
alter table foo add column f float;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
insert into foo values
|
||||
("2024-02-02 04:00:00+0800", "my_tag_4", 4, 4.4),
|
||||
("2024-02-02 05:00:00+0800", "my_tag_5", 5, 5.5),
|
||||
("2024-02-02 06:00:00+0800", "my_tag_6", 6, 6.6);
|
||||
|
||||
Affected Rows: 3
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
create table foo(ts timestamp time index, s string primary key, i int);
|
||||
|
||||
insert into foo values
|
||||
("2024-02-02 01:00:00+0800", "my_tag_1", 1),
|
||||
("2024-02-02 02:00:00+0800", "my_tag_2", 2),
|
||||
("2024-02-02 03:00:00+0800", "my_tag_3", 3);
|
||||
|
||||
-- Alter the table to trigger a flush (will be executed before process being terminated).
|
||||
-- Otherwise the SST might not be generated (the data could be remained in WAL).
|
||||
-- If we have the explicitly flush table interface in the future, it's still good to have the alter table in the test.
|
||||
alter table foo add column f float;
|
||||
|
||||
insert into foo values
|
||||
("2024-02-02 04:00:00+0800", "my_tag_4", 4, 4.4),
|
||||
("2024-02-02 05:00:00+0800", "my_tag_5", 5, 5.5),
|
||||
("2024-02-02 06:00:00+0800", "my_tag_6", 6, 6.6);
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
|
||||
usage() {
|
||||
echo " Tests the compatibility between different versions of GreptimeDB."
|
||||
echo " Expects the directory './bins/current' contains the newly built binaries."
|
||||
echo " Usage: $0 <old_version>"
|
||||
}
|
||||
|
||||
# The previous version of GreptimeDB to test compatibility with.
|
||||
# e.g. old_ver="0.6.0"
|
||||
old_ver="$1"
|
||||
|
||||
if [ -z $old_ver ]
|
||||
then
|
||||
usage
|
||||
exit -1
|
||||
fi
|
||||
|
||||
SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
|
||||
echo " === SCRIPT_PATH: $SCRIPT_PATH"
|
||||
source "${SCRIPT_PATH}/util.sh"
|
||||
|
||||
# go to work tree root
|
||||
cd "$SCRIPT_PATH/../../"
|
||||
|
||||
download_binary "$old_ver"
|
||||
|
||||
run_test $old_ver "backward"
|
||||
|
||||
echo " === Clear GreptimeDB data before running forward compatibility test"
|
||||
rm -rf /tmp/greptimedb-standalone
|
||||
|
||||
run_test $old_ver "forward"
|
||||
|
||||
echo "Compatibility test run successfully!"
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Assemble the GreptimeDB binary download URL for a specific version.
|
||||
binary_url() {
|
||||
local ver="$1"
|
||||
local bin_tar="greptime-$(uname -s | tr '[:upper:]' '[:lower:]')-amd64-v$ver.tar.gz"
|
||||
echo "https://github.com/GreptimeTeam/greptimedb/releases/download/v$ver/$bin_tar"
|
||||
}
|
||||
|
||||
# Download a specific version of GreptimeDB binary tar file, untar it to folder `./bins/$ver`.
|
||||
# `ver` is semver without prefix `v`
|
||||
download_binary() {
|
||||
local ver="$1"
|
||||
local url="$(binary_url $ver)"
|
||||
local bin_tar="greptime-$(uname -s | tr '[:upper:]' '[:lower:]')-amd64-v$ver.tar.gz"
|
||||
|
||||
if [ -f ./bins/$ver/greptime ]; then
|
||||
echo " === binaries exist: $(ls ./bins/$ver/* | tr '\n' ' ')"
|
||||
chmod +x ./bins/$ver/*
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -f "$bin_tar" ]; then
|
||||
echo " === tar file exists: $bin_tar"
|
||||
else
|
||||
echo " === Download binary ver: $ver"
|
||||
echo " === Download binary url: $url"
|
||||
curl --connect-timeout 5 --retry 5 --retry-delay 1 -L "$url" -o "$bin_tar"
|
||||
fi
|
||||
|
||||
mkdir -p ./bins/$ver
|
||||
tar -xf "$bin_tar" --strip-components=1 -C ./bins/$ver
|
||||
|
||||
echo " === unpacked: ./bins/$ver:"
|
||||
ls -lh ./bins/$ver
|
||||
|
||||
chmod +x ./bins/$ver/*
|
||||
}
|
||||
|
||||
# Test data compatibility that:
|
||||
# - the data written by an old version of GreptimeDB can be read by the current one
|
||||
# - the data written by the current version of GreptimeDB can be read by an old one ("forward" compatibility)
|
||||
run_test() {
|
||||
local old_ver="$1"
|
||||
local forward="$2"
|
||||
|
||||
local write_case_dir="./tests/compat/case/write"
|
||||
local read_case_dir="./tests/compat/case/read"
|
||||
local bin_old="./bins/$old_ver/greptime"
|
||||
local bin_new="./bins/current/greptime"
|
||||
local runner="./bins/current/sqlness-runner"
|
||||
|
||||
echo " === Test with:"
|
||||
echo " === old greptimedb version:"
|
||||
"$bin_old" --version
|
||||
echo " === new greptimedb version:"
|
||||
"$bin_new" --version
|
||||
|
||||
# "forward" means we are testing forward compatibility:
|
||||
# the data generated by current version GreptimeDB can be used by old.
|
||||
# So we run new GreptimeDB binary first to write, then run old to read.
|
||||
# And the opposite for backward compatibility.
|
||||
if [ "$forward" == "forward" ]
|
||||
then
|
||||
echo " === Running forward compat test ..."
|
||||
echo " === Run test: write with current GreptimeDB"
|
||||
$runner bare --bins-dir $(dirname $bin_new) --case-dir $write_case_dir
|
||||
else
|
||||
echo " === Running backward compat test ..."
|
||||
echo " === Run test: write with old GreptimeDB"
|
||||
$runner bare --bins-dir $(dirname $bin_old) --case-dir $write_case_dir
|
||||
fi
|
||||
|
||||
if [ "$forward" == 'forward' ]
|
||||
then
|
||||
echo " === Run test: read with old GreptimeDB"
|
||||
$runner bare --bins-dir $(dirname $bin_old) --case-dir $read_case_dir
|
||||
else
|
||||
echo " === Run test: read with current GreptimeDB"
|
||||
$runner bare --bins-dir $(dirname $bin_new) --case-dir $read_case_dir
|
||||
fi
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../standalone/common
|
||||
@@ -1,137 +0,0 @@
|
||||
-- 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
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
-- 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;
|
||||
@@ -1,137 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.11.0
|
||||
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
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.11.0
|
||||
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;
|
||||
@@ -1,137 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
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
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
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;
|
||||
@@ -1,62 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE alter_drop_test (
|
||||
id INT,
|
||||
val_to_drop STRING,
|
||||
val_to_keep STRING,
|
||||
ts TIMESTAMP TIME INDEX,
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO alter_drop_test(id, val_to_drop, val_to_keep, ts) VALUES (1, 'a', 'x', 1672531200000);
|
||||
|
||||
Affected Rows: 1
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
ALTER TABLE alter_drop_test DROP COLUMN val_to_drop;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
SHOW CREATE TABLE alter_drop_test;
|
||||
|
||||
+-----------------+------------------------------------------------+
|
||||
| Table | Create Table |
|
||||
+-----------------+------------------------------------------------+
|
||||
| alter_drop_test | CREATE TABLE IF NOT EXISTS "alter_drop_test" ( |
|
||||
| | "id" INT NULL, |
|
||||
| | "val_to_keep" STRING NULL, |
|
||||
| | "ts" TIMESTAMP(3) NOT NULL, |
|
||||
| | TIME INDEX ("ts"), |
|
||||
| | PRIMARY KEY ("id") |
|
||||
| | ) |
|
||||
| | |
|
||||
| | ENGINE=mito |
|
||||
| | |
|
||||
+-----------------+------------------------------------------------+
|
||||
|
||||
SELECT * FROM alter_drop_test ORDER BY id;
|
||||
|
||||
+----+-------------+---------------------+
|
||||
| id | val_to_keep | ts |
|
||||
+----+-------------+---------------------+
|
||||
| 1 | x | 2023-01-01T00:00:00 |
|
||||
+----+-------------+---------------------+
|
||||
|
||||
INSERT INTO alter_drop_test(id, val_to_keep, ts) VALUES (2, 'y', 1672531201000);
|
||||
|
||||
Affected Rows: 1
|
||||
|
||||
SELECT * FROM alter_drop_test ORDER BY id;
|
||||
|
||||
+----+-------------+---------------------+
|
||||
| id | val_to_keep | ts |
|
||||
+----+-------------+---------------------+
|
||||
| 1 | x | 2023-01-01T00:00:00 |
|
||||
| 2 | y | 2023-01-01T00:00:01 |
|
||||
+----+-------------+---------------------+
|
||||
|
||||
DROP TABLE alter_drop_test;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE alter_drop_test (
|
||||
id INT,
|
||||
val_to_drop STRING,
|
||||
val_to_keep STRING,
|
||||
ts TIMESTAMP TIME INDEX,
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
INSERT INTO alter_drop_test(id, val_to_drop, val_to_keep, ts) VALUES (1, 'a', 'x', 1672531200000);
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
ALTER TABLE alter_drop_test DROP COLUMN val_to_drop;
|
||||
|
||||
SHOW CREATE TABLE alter_drop_test;
|
||||
|
||||
SELECT * FROM alter_drop_test ORDER BY id;
|
||||
|
||||
INSERT INTO alter_drop_test(id, val_to_keep, ts) VALUES (2, 'y', 1672531201000);
|
||||
|
||||
SELECT * FROM alter_drop_test ORDER BY id;
|
||||
|
||||
DROP TABLE alter_drop_test;
|
||||
@@ -1,54 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE alter_test (
|
||||
id INT,
|
||||
val STRING,
|
||||
ts TIMESTAMP TIME INDEX,
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO alter_test(id, val, ts) VALUES (1, 'a', 1672531200000);
|
||||
|
||||
Affected Rows: 1
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
ALTER TABLE alter_test ADD COLUMN new_col INT;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
SHOW CREATE TABLE alter_test;
|
||||
|
||||
+------------+-------------------------------------------+
|
||||
| Table | Create Table |
|
||||
+------------+-------------------------------------------+
|
||||
| alter_test | CREATE TABLE IF NOT EXISTS "alter_test" ( |
|
||||
| | "id" INT NULL, |
|
||||
| | "val" STRING NULL, |
|
||||
| | "ts" TIMESTAMP(3) NOT NULL, |
|
||||
| | "new_col" INT NULL, |
|
||||
| | TIME INDEX ("ts"), |
|
||||
| | PRIMARY KEY ("id") |
|
||||
| | ) |
|
||||
| | |
|
||||
| | ENGINE=mito |
|
||||
| | |
|
||||
+------------+-------------------------------------------+
|
||||
|
||||
INSERT INTO alter_test(id, val, ts, new_col) VALUES (2, 'b', 1672531201000, 100);
|
||||
|
||||
Affected Rows: 1
|
||||
|
||||
SELECT * FROM alter_test ORDER BY id;
|
||||
|
||||
+----+-----+---------------------+---------+
|
||||
| id | val | ts | new_col |
|
||||
+----+-----+---------------------+---------+
|
||||
| 1 | a | 2023-01-01T00:00:00 | |
|
||||
| 2 | b | 2023-01-01T00:00:01 | 100 |
|
||||
+----+-----+---------------------+---------+
|
||||
|
||||
DROP TABLE alter_test;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE alter_test (
|
||||
id INT,
|
||||
val STRING,
|
||||
ts TIMESTAMP TIME INDEX,
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
INSERT INTO alter_test(id, val, ts) VALUES (1, 'a', 1672531200000);
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
ALTER TABLE alter_test ADD COLUMN new_col INT;
|
||||
|
||||
SHOW CREATE TABLE alter_test;
|
||||
|
||||
INSERT INTO alter_test(id, val, ts, new_col) VALUES (2, 'b', 1672531201000, 100);
|
||||
|
||||
SELECT * FROM alter_test ORDER BY id;
|
||||
|
||||
DROP TABLE alter_test;
|
||||
@@ -1,47 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE 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)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO 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
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
SHOW CREATE TABLE system_metrics;
|
||||
|
||||
+----------------+-----------------------------------------------------------+
|
||||
| Table | Create Table |
|
||||
+----------------+-----------------------------------------------------------+
|
||||
| system_metrics | CREATE TABLE IF NOT EXISTS "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 |
|
||||
| | |
|
||||
+----------------+-----------------------------------------------------------+
|
||||
|
||||
DROP TABLE system_metrics;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE 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)
|
||||
);
|
||||
|
||||
INSERT INTO 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);
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
SHOW CREATE TABLE system_metrics;
|
||||
|
||||
DROP TABLE system_metrics;
|
||||
@@ -1,153 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE test_ttl_0s(ts TIMESTAMP TIME INDEX, val INT) WITH (ttl = '0 second');
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE TABLE test_ttl_1s(ts TIMESTAMP TIME INDEX, val INT) WITH (ttl = '1 second');
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE TABLE test_ttl_none(ts TIMESTAMP TIME INDEX, val INT);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE DATABASE ttl_db_1s WITH (ttl = '1 second');
|
||||
|
||||
Affected Rows: 1
|
||||
|
||||
CREATE DATABASE ttl_db_0s WITH (ttl = '0 second');
|
||||
|
||||
Affected Rows: 1
|
||||
|
||||
CREATE DATABASE ttl_db_none;
|
||||
|
||||
Affected Rows: 1
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
SHOW TABLES;
|
||||
|
||||
+------------------+
|
||||
| Tables_in_public |
|
||||
+------------------+
|
||||
| numbers |
|
||||
| test_ttl_0s |
|
||||
| test_ttl_1s |
|
||||
| test_ttl_none |
|
||||
+------------------+
|
||||
|
||||
SHOW CREATE TABLE test_ttl_1s;
|
||||
|
||||
+-------------+--------------------------------------------+
|
||||
| Table | Create Table |
|
||||
+-------------+--------------------------------------------+
|
||||
| test_ttl_1s | CREATE TABLE IF NOT EXISTS "test_ttl_1s" ( |
|
||||
| | "ts" TIMESTAMP(3) NOT NULL, |
|
||||
| | "val" INT NULL, |
|
||||
| | TIME INDEX ("ts") |
|
||||
| | ) |
|
||||
| | |
|
||||
| | ENGINE=mito |
|
||||
| | WITH( |
|
||||
| | ttl = '1s' |
|
||||
| | ) |
|
||||
+-------------+--------------------------------------------+
|
||||
|
||||
SHOW CREATE TABLE test_ttl_0s;
|
||||
|
||||
+-------------+--------------------------------------------+
|
||||
| Table | Create Table |
|
||||
+-------------+--------------------------------------------+
|
||||
| test_ttl_0s | CREATE TABLE IF NOT EXISTS "test_ttl_0s" ( |
|
||||
| | "ts" TIMESTAMP(3) NOT NULL, |
|
||||
| | "val" INT NULL, |
|
||||
| | TIME INDEX ("ts") |
|
||||
| | ) |
|
||||
| | |
|
||||
| | ENGINE=mito |
|
||||
| | WITH( |
|
||||
| | ttl = '0s' |
|
||||
| | ) |
|
||||
+-------------+--------------------------------------------+
|
||||
|
||||
SHOW CREATE TABLE test_ttl_none;
|
||||
|
||||
+---------------+----------------------------------------------+
|
||||
| Table | Create Table |
|
||||
+---------------+----------------------------------------------+
|
||||
| test_ttl_none | CREATE TABLE IF NOT EXISTS "test_ttl_none" ( |
|
||||
| | "ts" TIMESTAMP(3) NOT NULL, |
|
||||
| | "val" INT NULL, |
|
||||
| | TIME INDEX ("ts") |
|
||||
| | ) |
|
||||
| | |
|
||||
| | ENGINE=mito |
|
||||
| | |
|
||||
+---------------+----------------------------------------------+
|
||||
|
||||
DROP TABLE test_ttl_1s;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE test_ttl_0s;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE test_ttl_none;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
SHOW DATABASES;
|
||||
|
||||
+--------------------+
|
||||
| Database |
|
||||
+--------------------+
|
||||
| greptime_private |
|
||||
| information_schema |
|
||||
| public |
|
||||
| ttl_db_0s |
|
||||
| ttl_db_1s |
|
||||
| ttl_db_none |
|
||||
+--------------------+
|
||||
|
||||
SHOW CREATE DATABASE ttl_db_1s;
|
||||
|
||||
+-----------+-----------------------------------------+
|
||||
| Database | Create Database |
|
||||
+-----------+-----------------------------------------+
|
||||
| ttl_db_1s | CREATE DATABASE IF NOT EXISTS ttl_db_1s |
|
||||
| | WITH( |
|
||||
| | ttl = '1s' |
|
||||
| | ) |
|
||||
+-----------+-----------------------------------------+
|
||||
|
||||
SHOW CREATE DATABASE ttl_db_0s;
|
||||
|
||||
+-----------+-----------------------------------------+
|
||||
| Database | Create Database |
|
||||
+-----------+-----------------------------------------+
|
||||
| ttl_db_0s | CREATE DATABASE IF NOT EXISTS ttl_db_0s |
|
||||
| | WITH( |
|
||||
| | ttl = '0s' |
|
||||
| | ) |
|
||||
+-----------+-----------------------------------------+
|
||||
|
||||
SHOW CREATE DATABASE ttl_db_none;
|
||||
|
||||
+-------------+-------------------------------------------+
|
||||
| Database | Create Database |
|
||||
+-------------+-------------------------------------------+
|
||||
| ttl_db_none | CREATE DATABASE IF NOT EXISTS ttl_db_none |
|
||||
+-------------+-------------------------------------------+
|
||||
|
||||
DROP DATABASE ttl_db_1s;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP DATABASE ttl_db_0s;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP DATABASE ttl_db_none;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE test_ttl_0s(ts TIMESTAMP TIME INDEX, val INT) WITH (ttl = '0 second');
|
||||
|
||||
CREATE TABLE test_ttl_1s(ts TIMESTAMP TIME INDEX, val INT) WITH (ttl = '1 second');
|
||||
|
||||
CREATE TABLE test_ttl_none(ts TIMESTAMP TIME INDEX, val INT);
|
||||
|
||||
CREATE DATABASE ttl_db_1s WITH (ttl = '1 second');
|
||||
|
||||
CREATE DATABASE ttl_db_0s WITH (ttl = '0 second');
|
||||
|
||||
CREATE DATABASE ttl_db_none;
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
SHOW TABLES;
|
||||
|
||||
SHOW CREATE TABLE test_ttl_1s;
|
||||
|
||||
SHOW CREATE TABLE test_ttl_0s;
|
||||
|
||||
SHOW CREATE TABLE test_ttl_none;
|
||||
|
||||
DROP TABLE test_ttl_1s;
|
||||
|
||||
DROP TABLE test_ttl_0s;
|
||||
|
||||
DROP TABLE test_ttl_none;
|
||||
|
||||
SHOW DATABASES;
|
||||
|
||||
SHOW CREATE DATABASE ttl_db_1s;
|
||||
|
||||
SHOW CREATE DATABASE ttl_db_0s;
|
||||
|
||||
SHOW CREATE DATABASE ttl_db_none;
|
||||
|
||||
DROP DATABASE ttl_db_1s;
|
||||
|
||||
DROP DATABASE ttl_db_0s;
|
||||
|
||||
DROP DATABASE ttl_db_none;
|
||||
@@ -1,32 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE update_test (
|
||||
id INT,
|
||||
val INT,
|
||||
ts TIMESTAMP TIME INDEX,
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO update_test(id, val, ts) VALUES (1, 10, 1672531200000), (2, 20, 1672531201000);
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
UPDATE update_test SET val = 100 WHERE id = 1;
|
||||
|
||||
Error: 1001(Unsupported), SQL statement is not supported, keyword: UPDATE
|
||||
|
||||
SELECT * FROM update_test ORDER BY id;
|
||||
|
||||
+----+-----+---------------------+
|
||||
| id | val | ts |
|
||||
+----+-----+---------------------+
|
||||
| 1 | 10 | 2023-01-01T00:00:00 |
|
||||
| 2 | 20 | 2023-01-01T00:00:01 |
|
||||
+----+-----+---------------------+
|
||||
|
||||
DROP TABLE update_test;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
-- SQLNESS ARG version=v0.9.5
|
||||
CREATE TABLE update_test (
|
||||
id INT,
|
||||
val INT,
|
||||
ts TIMESTAMP TIME INDEX,
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
INSERT INTO update_test(id, val, ts) VALUES (1, 10, 1672531200000), (2, 20, 1672531201000);
|
||||
|
||||
-- SQLNESS ARG version=latest
|
||||
UPDATE update_test SET val = 100 WHERE id = 1;
|
||||
|
||||
SELECT * FROM update_test ORDER BY id;
|
||||
|
||||
DROP TABLE update_test;
|
||||
Reference in New Issue
Block a user