mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-08-26 07:58:47 +00:00
a08d3b7e63
* feat: support enabling skip_wal with ALTER TABLE (#8730) * feat: support enabling skip_wal with alter table Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test: cover skip wal on metric physical region Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: retry skip wal alter on route changes Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: address skip wal review feedback Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: preserve skip wal create options Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: prefer typed skip wal option Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: address skip wal review comments Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: canonicalize legacy skip wal option Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: keep typed skip wal canonical Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: simplify skip wal option tracking Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> Signed-off-by: evenyag <realevenyag@gmail.com> * test(object-store): fix racy SecureFs abort test (#8720) test_writer_abort_is_unsupported_without_atomic_write asserted the file content immediately after abort() returned Unsupported. SecureFsWriter writes through tokio::fs::File, whose write_all() only enqueues a blocking write task (tokio's poll_write returns Ready before the write completes), so the data may not be visible yet when the test reads the file. Drop the race-prone content assertion and only verify the Unsupported contract. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> Signed-off-by: evenyag <realevenyag@gmail.com> Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> Co-authored-by: jeremyhi <jiachun_feng@proton.me> Co-authored-by: Lei, HUANG <6406592+v0y4g3r@users.noreply.github.com>
63 lines
1.5 KiB
SQL
63 lines
1.5 KiB
SQL
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)
|
|
) WITH (skip_wal = "true");
|
|
|
|
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 restart=true
|
|
SELECT * FROM system_metrics;
|
|
|
|
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);
|
|
|
|
ADMIN flush_table('system_metrics');
|
|
|
|
-- SQLNESS ARG restart=true
|
|
SELECT * FROM system_metrics;
|
|
|
|
DROP TABLE system_metrics;
|
|
|
|
CREATE TABLE alter_skip_wal (
|
|
host STRING,
|
|
val DOUBLE,
|
|
ts TIMESTAMP,
|
|
PRIMARY KEY(host),
|
|
TIME INDEX(ts)
|
|
);
|
|
|
|
INSERT INTO alter_skip_wal VALUES ('host1', 1, 1000);
|
|
|
|
ALTER TABLE alter_skip_wal SET 'skip_wal' = 'true';
|
|
|
|
SHOW CREATE TABLE alter_skip_wal;
|
|
|
|
ALTER TABLE alter_skip_wal SET 'skip_wal' = 'false';
|
|
|
|
ALTER TABLE alter_skip_wal UNSET 'skip_wal';
|
|
|
|
INSERT INTO alter_skip_wal VALUES ('host2', 2, 2000);
|
|
|
|
SELECT * FROM alter_skip_wal ORDER BY ts;
|
|
|
|
-- The post-ALTER row can be lost because restart does not flush skip-WAL memtables.
|
|
-- SQLNESS ARG restart=true
|
|
SHOW CREATE TABLE alter_skip_wal;
|
|
|
|
SELECT * FROM alter_skip_wal ORDER BY ts;
|
|
|
|
DROP TABLE alter_skip_wal;
|