-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add append mode to table options (#3624)
* feat: add append mode to table options * test: add append mode test * test: rename test tables * chore: Add delete test for append mode
- Loading branch information
Showing
4 changed files
with
114 additions
and
1 deletion.
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
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,73 @@ | ||
create table if not exists append_mode_on( | ||
host string, | ||
ts timestamp, | ||
cpu double, | ||
TIME INDEX (ts), | ||
PRIMARY KEY(host) | ||
) | ||
engine=mito | ||
with('append_mode'='true'); | ||
|
||
Affected Rows: 0 | ||
|
||
INSERT INTO append_mode_on VALUES ('host1',0, 0), ('host2', 1, 1,); | ||
|
||
Affected Rows: 2 | ||
|
||
INSERT INTO append_mode_on VALUES ('host1',0, 0), ('host2', 1, 1,); | ||
|
||
Affected Rows: 2 | ||
|
||
SELECT * from append_mode_on ORDER BY host, ts; | ||
|
||
+-------+-------------------------+-----+ | ||
| host | ts | cpu | | ||
+-------+-------------------------+-----+ | ||
| host1 | 1970-01-01T00:00:00 | 0.0 | | ||
| host1 | 1970-01-01T00:00:00 | 0.0 | | ||
| host2 | 1970-01-01T00:00:00.001 | 1.0 | | ||
| host2 | 1970-01-01T00:00:00.001 | 1.0 | | ||
+-------+-------------------------+-----+ | ||
|
||
-- SQLNESS REPLACE (region\s\d+\(\d+\,\s\d+\)) region | ||
DELETE FROM append_mode_on WHERE host = 'host1'; | ||
|
||
Error: 1004(InvalidArguments), Invalid request to region, reason: DELETE is not allowed under append mode | ||
|
||
create table if not exists append_mode_off( | ||
host string, | ||
ts timestamp, | ||
cpu double, | ||
TIME INDEX (ts), | ||
PRIMARY KEY(host) | ||
) | ||
engine=mito | ||
with('append_mode'='false'); | ||
|
||
Affected Rows: 0 | ||
|
||
INSERT INTO append_mode_off VALUES ('host1',0, 0), ('host2', 1, 1,); | ||
|
||
Affected Rows: 2 | ||
|
||
INSERT INTO append_mode_off VALUES ('host1',0, 10), ('host2', 1, 11,); | ||
|
||
Affected Rows: 2 | ||
|
||
SELECT * from append_mode_off ORDER BY host, ts; | ||
|
||
+-------+-------------------------+------+ | ||
| host | ts | cpu | | ||
+-------+-------------------------+------+ | ||
| host1 | 1970-01-01T00:00:00 | 10.0 | | ||
| host2 | 1970-01-01T00:00:00.001 | 11.0 | | ||
+-------+-------------------------+------+ | ||
|
||
DROP TABLE append_mode_on; | ||
|
||
Affected Rows: 0 | ||
|
||
DROP TABLE append_mode_off; | ||
|
||
Affected Rows: 0 | ||
|
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,38 @@ | ||
create table if not exists append_mode_on( | ||
host string, | ||
ts timestamp, | ||
cpu double, | ||
TIME INDEX (ts), | ||
PRIMARY KEY(host) | ||
) | ||
engine=mito | ||
with('append_mode'='true'); | ||
|
||
INSERT INTO append_mode_on VALUES ('host1',0, 0), ('host2', 1, 1,); | ||
|
||
INSERT INTO append_mode_on VALUES ('host1',0, 0), ('host2', 1, 1,); | ||
|
||
SELECT * from append_mode_on ORDER BY host, ts; | ||
|
||
-- SQLNESS REPLACE (region\s\d+\(\d+\,\s\d+\)) region | ||
DELETE FROM append_mode_on WHERE host = 'host1'; | ||
|
||
create table if not exists append_mode_off( | ||
host string, | ||
ts timestamp, | ||
cpu double, | ||
TIME INDEX (ts), | ||
PRIMARY KEY(host) | ||
) | ||
engine=mito | ||
with('append_mode'='false'); | ||
|
||
INSERT INTO append_mode_off VALUES ('host1',0, 0), ('host2', 1, 1,); | ||
|
||
INSERT INTO append_mode_off VALUES ('host1',0, 10), ('host2', 1, 11,); | ||
|
||
SELECT * from append_mode_off ORDER BY host, ts; | ||
|
||
DROP TABLE append_mode_on; | ||
|
||
DROP TABLE append_mode_off; |