mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-19 06:20:38 +00:00
* feat: support table ddl for custom_storage * refactor: rename extract_variant_name to name * chore: add blank * chore: keep compatible * feat: rename custom_stores to providers * chore: rename * chore: config * refactor: add should_retry in client Error * fix: test fail * chore: remove unused options * chore: remove unused import * chore: remove the blanks. * chore: revert --------- Co-authored-by: dennis zhuang <killme2008@gmail.com>
124 lines
4.7 KiB
Plaintext
124 lines
4.7 KiB
Plaintext
CREATE TABLE system_metrics (
|
|
id INT UNSIGNED,
|
|
host STRING,
|
|
cpu DOUBLE,
|
|
disk FLOAT COMMENT 'comment',
|
|
ts TIMESTAMP NOT NULL DEFAULT current_timestamp(),
|
|
TIME INDEX (ts),
|
|
PRIMARY KEY (id, host)
|
|
)
|
|
PARTITION BY RANGE COLUMNS (id) (
|
|
PARTITION r0 VALUES LESS THAN (5),
|
|
PARTITION r1 VALUES LESS THAN (9),
|
|
PARTITION r2 VALUES LESS THAN (MAXVALUE),
|
|
)
|
|
ENGINE=mito
|
|
WITH(
|
|
ttl = '7d',
|
|
write_buffer_size = 1024
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
SHOW CREATE TABLE system_metrics;
|
|
|
|
+----------------+-----------------------------------------------------------+
|
|
| Table | Create Table |
|
|
+----------------+-----------------------------------------------------------+
|
|
| system_metrics | CREATE TABLE IF NOT EXISTS "system_metrics" ( |
|
|
| | "id" INT UNSIGNED NULL, |
|
|
| | "host" STRING NULL, |
|
|
| | "cpu" DOUBLE NULL, |
|
|
| | "disk" FLOAT NULL COMMENT 'comment', |
|
|
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
|
|
| | TIME INDEX ("ts"), |
|
|
| | PRIMARY KEY ("id", "host") |
|
|
| | ) |
|
|
| | PARTITION BY RANGE COLUMNS ("id") ( |
|
|
| | PARTITION r0 VALUES LESS THAN (5), |
|
|
| | PARTITION r1 VALUES LESS THAN (9), |
|
|
| | PARTITION r2 VALUES LESS THAN (MAXVALUE) |
|
|
| | ) |
|
|
| | ENGINE=mito |
|
|
| | WITH( |
|
|
| | regions = 3, |
|
|
| | ttl = '7days', |
|
|
| | write_buffer_size = '1.0KiB' |
|
|
| | ) |
|
|
+----------------+-----------------------------------------------------------+
|
|
|
|
DROP TABLE system_metrics;
|
|
|
|
Affected Rows: 0
|
|
|
|
create table table_without_partition (
|
|
ts TIMESTAMP TIME INDEX NOT NULL DEFAULT current_timestamp()
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
show create table table_without_partition;
|
|
|
|
+-------------------------+-----------------------------------------------------------+
|
|
| Table | Create Table |
|
|
+-------------------------+-----------------------------------------------------------+
|
|
| table_without_partition | CREATE TABLE IF NOT EXISTS "table_without_partition" ( |
|
|
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
|
|
| | TIME INDEX ("ts") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | WITH( |
|
|
| | regions = 1 |
|
|
| | ) |
|
|
+-------------------------+-----------------------------------------------------------+
|
|
|
|
drop table table_without_partition;
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE TABLE not_supported_table_options_keys (
|
|
id INT UNSIGNED,
|
|
host STRING,
|
|
cpu DOUBLE,
|
|
disk FLOAT,
|
|
ts TIMESTAMP NOT NULL DEFAULT current_timestamp(),
|
|
TIME INDEX (ts),
|
|
PRIMARY KEY (id, host)
|
|
)
|
|
PARTITION BY RANGE COLUMNS (id) (
|
|
PARTITION r0 VALUES LESS THAN (5),
|
|
PARTITION r1 VALUES LESS THAN (9),
|
|
PARTITION r2 VALUES LESS THAN (MAXVALUE),
|
|
)
|
|
ENGINE=mito
|
|
WITH(
|
|
foo = 123,
|
|
ttl = '7d',
|
|
write_buffer_size = 1024
|
|
);
|
|
|
|
Error: 1004(InvalidArguments), Invalid table option key: foo
|
|
|
|
CREATE TABLE not_supported_table_storage_option (
|
|
id INT UNSIGNED,
|
|
host STRING,
|
|
cpu DOUBLE,
|
|
disk FLOAT,
|
|
ts TIMESTAMP NOT NULL DEFAULT current_timestamp(),
|
|
TIME INDEX (ts),
|
|
PRIMARY KEY (id, host)
|
|
)
|
|
PARTITION BY RANGE COLUMNS (id) (
|
|
PARTITION r0 VALUES LESS THAN (5),
|
|
PARTITION r1 VALUES LESS THAN (9),
|
|
PARTITION r2 VALUES LESS THAN (MAXVALUE),
|
|
)
|
|
ENGINE=mito
|
|
WITH(
|
|
storage = 'S3'
|
|
);
|
|
|
|
Error: 1004(InvalidArguments), Object store not found: s3
|
|
|